Class: Peddler::APIs::SupplySources20200701

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/supply_sources_2020_07_01.rb,
lib/peddler/apis/supply_sources_2020_07_01/error.rb,
lib/peddler/apis/supply_sources_2020_07_01/address.rb,
lib/peddler/apis/supply_sources_2020_07_01/duration.rb,
lib/peddler/apis/supply_sources_2020_07_01/error_list.rb,
lib/peddler/apis/supply_sources_2020_07_01/supply_source.rb,
lib/peddler/apis/supply_sources_2020_07_01/operating_hour.rb,
lib/peddler/apis/supply_sources_2020_07_01/pickup_channel.rb,
lib/peddler/apis/supply_sources_2020_07_01/throughput_cap.rb,
lib/peddler/apis/supply_sources_2020_07_01/contact_details.rb,
lib/peddler/apis/supply_sources_2020_07_01/operating_hours.rb,
lib/peddler/apis/supply_sources_2020_07_01/return_location.rb,
lib/peddler/apis/supply_sources_2020_07_01/delivery_channel.rb,
lib/peddler/apis/supply_sources_2020_07_01/throughput_config.rb,
lib/peddler/apis/supply_sources_2020_07_01/supply_source_list.rb,
lib/peddler/apis/supply_sources_2020_07_01/outbound_capability.rb,
lib/peddler/apis/supply_sources_2020_07_01/services_capability.rb,
lib/peddler/apis/supply_sources_2020_07_01/address_with_contact.rb,
lib/peddler/apis/supply_sources_2020_07_01/parking_configuration.rb,
lib/peddler/apis/supply_sources_2020_07_01/operating_hours_by_day.rb,
lib/peddler/apis/supply_sources_2020_07_01/operational_configuration.rb,
lib/peddler/apis/supply_sources_2020_07_01/supply_source_capabilities.rb,
lib/peddler/apis/supply_sources_2020_07_01/get_supply_sources_response.rb,
lib/peddler/apis/supply_sources_2020_07_01/supply_source_configuration.rb,
lib/peddler/apis/supply_sources_2020_07_01/create_supply_source_request.rb,
lib/peddler/apis/supply_sources_2020_07_01/update_supply_source_request.rb,
lib/peddler/apis/supply_sources_2020_07_01/create_supply_source_response.rb,
lib/peddler/apis/supply_sources_2020_07_01/curbside_pickup_configuration.rb,
lib/peddler/apis/supply_sources_2020_07_01/in_store_pickup_configuration.rb,
lib/peddler/apis/supply_sources_2020_07_01/parking_with_address_configuration.rb,
lib/peddler/apis/supply_sources_2020_07_01/update_supply_source_status_request.rb

Overview

Selling Partner API for Supply Sources

Manage configurations and capabilities of seller supply sources.

Defined Under Namespace

Classes: OperatingHours, SupplySourceList

Constant Summary collapse

Error =

An error response returned when the request is unsuccessful.

Structure.new do
  # @return [String] An error code that identifies the type of error that occurred.
  attribute(:code, String)

  # @return [String] A message that describes the error condition.
  attribute(:message, String)

  # @return [String] Additional details that can help the caller understand or fix the issue.
  attribute?(:details, String)
end
Address =

A physical address.

Structure.new do
  # @return [String] The first line of the address.
  attribute(:address_line1, String, from: "addressLine1")

  # @return [String] The two digit country code. In ISO 3166-1 alpha-2 format.
  attribute(:country_code, String, from: "countryCode")

  # @return [String] The name of the person, business or institution at that address.
  attribute(:name, String)

  # @return [String] The state or region where person, business or institution is located.
  attribute(:state_or_region, String, from: "stateOrRegion")

  # @return [String] The additional address information, if required.
  attribute?(:address_line2, String, from: "addressLine2")

  # @return [String] The additional address information, if required.
  attribute?(:address_line3, String, from: "addressLine3")

  # @return [String] The city where the person, business or institution is located.
  attribute?(:city, String)

  # @return [String] The county where person, business or institution is located.
  attribute?(:county, String)

  # @return [String] The district where person, business or institution is located.
  attribute?(:district, String)

  # @return [String] The phone number of the person, business or institution located at that address.
  attribute?(:phone, String)

  # @return [String] The postal code of that address. It conatins a series of letters or digits or both, sometimes
  # including spaces or punctuation.
  attribute?(:postal_code, String, from: "postalCode")
end
Duration =

The duration of time.

Structure.new do
  # @return [String]
  attribute?(:time_unit, String, from: "timeUnit")

  # @return [Integer]
  attribute?(:value, Integer)
end
ErrorList =

A list of error responses returned when a request is unsuccessful.

Structure.new do
  # @return [Array<Error>] A list of error responses returned when a request is unsuccessful.
  attribute(:errors, [Error])
end
SupplySource =

The supply source details, including configurations and capabilities.

Structure.new do
  # @return [Address]
  attribute?(:address, Address)

  # @return [String]
  attribute?(:alias, String)

  # @return [SupplySourceCapabilities]
  attribute?(:capabilities, SupplySourceCapabilities)

  # @return [SupplySourceConfiguration]
  attribute?(:configuration, SupplySourceConfiguration)

  # @return [String]
  attribute?(:created_at, String, from: "createdAt")

  # @return [String]
  attribute?(:status, String)

  # @return [String]
  attribute?(:supply_source_code, String, from: "supplySourceCode")

  # @return [String]
  attribute?(:supply_source_id, String, from: "supplySourceId")

  # @return [String]
  attribute?(:updated_at, String, from: "updatedAt")
end
OperatingHour =

The operating hour schema

Structure.new do
  # @return [String] The closing time, ISO 8601 formatted timestamp without date, HH:mm.
  attribute?(:end_time, String, from: "endTime")

  # @return [String] The opening time, ISO 8601 formatted timestamp without date, HH:mm.
  attribute?(:start_time, String, from: "startTime")
end
PickupChannel =

The pick up channel of a supply source.

Structure.new do
  # @return [CurbsidePickupConfiguration] The configuration for supporting curbside pickup.
  attribute?(:curbside_pickup_configuration, CurbsidePickupConfiguration, from: "curbsidePickupConfiguration")

  # @return [InStorePickupConfiguration] The configuration for supporting in-store pickup.
  attribute?(:in_store_pickup_configuration, InStorePickupConfiguration, from: "inStorePickupConfiguration")

  # @return [Duration]
  attribute?(:inventory_hold_period, Duration, from: "inventoryHoldPeriod")

  # @return [:boolean]
  attribute?(:supported, :boolean, from: "isSupported")

  # @return [OperationalConfiguration]
  attribute?(:operational_configuration, OperationalConfiguration, from: "operationalConfiguration")
end
ThroughputCap =

The throughput capacity

Structure.new do
  # @return [String]
  attribute?(:time_unit, String, from: "timeUnit")

  # @return [Integer]
  attribute?(:value, Integer)
end
ContactDetails =

The contact details

Structure.new do
  # @return [Hash]
  attribute?(:primary, Hash)
end
ReturnLocation =

The address or reference to another supplySourceId to act as a return location.

Structure.new do
  # @return [AddressWithContact]
  attribute?(:address_with_contact, AddressWithContact, from: "addressWithContact")

  # @return [String] The Amazon provided `supplySourceId` where orders can be returned to.
  attribute?(:supply_source_id, String, from: "supplySourceId")
end
DeliveryChannel =

The delivery channel of a supply source.

Structure.new do
  # @return [:boolean]
  attribute?(:supported, :boolean, from: "isSupported")

  # @return [OperationalConfiguration]
  attribute?(:operational_configuration, OperationalConfiguration, from: "operationalConfiguration")
end
ThroughputConfig =

The throughput configuration.

Structure.new do
  # @return [String]
  attribute(:throughput_unit, String, from: "throughputUnit")

  # @return [ThroughputCap]
  attribute?(:throughput_cap, ThroughputCap, from: "throughputCap")
end
OutboundCapability =

The outbound capability of a supply source.

Structure.new do
  # @return [DeliveryChannel]
  attribute?(:delivery_channel, DeliveryChannel, from: "deliveryChannel")

  # @return [:boolean]
  attribute?(:supported, :boolean, from: "isSupported")

  # @return [OperationalConfiguration]
  attribute?(:operational_configuration, OperationalConfiguration, from: "operationalConfiguration")

  # @return [PickupChannel]
  attribute?(:pickup_channel, PickupChannel, from: "pickupChannel")

  # @return [ReturnLocation]
  attribute?(:return_location, ReturnLocation, from: "returnLocation")
end
ServicesCapability =

The services capability of a supply source.

Structure.new do
  # @return [:boolean] When true, `SupplySource` supports the Service capability.
  attribute?(:supported, :boolean, from: "isSupported")

  # @return [OperationalConfiguration]
  attribute?(:operational_configuration, OperationalConfiguration, from: "operationalConfiguration")
end
AddressWithContact =

The address and contact details.

Structure.new do
  # @return [Address]
  attribute?(:address, Address)

  # @return [ContactDetails]
  attribute?(:contact_details, ContactDetails, from: "contactDetails")
end
ParkingConfiguration =

The parking configuration.

Structure.new do
  # @return [Integer] The number of parking spots.
  attribute?(:number_of_parking_spots, Integer, from: "numberOfParkingSpots")

  # @return [String] The type of cost at parking location.
  attribute?(:parking_cost_type, String, from: "parkingCostType")

  # @return [String] The type of parking spot identification used at parking location.
  attribute?(:parking_spot_identification_type, String, from: "parkingSpotIdentificationType")
end
OperatingHoursByDay =

The operating hours per day

Structure.new do
  # @return [Array<OperatingHour>]
  attribute?(:friday, [OperatingHour])

  # @return [Array<OperatingHour>]
  attribute?(:monday, [OperatingHour])

  # @return [Array<OperatingHour>]
  attribute?(:saturday, [OperatingHour])

  # @return [Array<OperatingHour>]
  attribute?(:sunday, [OperatingHour])

  # @return [Array<OperatingHour>]
  attribute?(:thursday, [OperatingHour])

  # @return [Array<OperatingHour>]
  attribute?(:tuesday, [OperatingHour])

  # @return [Array<OperatingHour>]
  attribute?(:wednesday, [OperatingHour])
end
OperationalConfiguration =

The operational configuration of supplySources.

Structure.new do
  # @return [ContactDetails]
  attribute?(:contact_details, ContactDetails, from: "contactDetails")

  # @return [Duration]
  attribute?(:handling_time, Duration, from: "handlingTime")

  # @return [OperatingHoursByDay]
  attribute?(:operating_hours_by_day, OperatingHoursByDay, from: "operatingHoursByDay")

  # @return [ThroughputConfig]
  attribute?(:throughput_config, ThroughputConfig, from: "throughputConfig")
end
SupplySourceCapabilities =

The capabilities of a supply source.

Structure.new do
  # @return [OutboundCapability]
  attribute?(:outbound, OutboundCapability)

  # @return [ServicesCapability]
  attribute?(:services, ServicesCapability)
end
GetSupplySourcesResponse =

The paginated list of supply sources.

Structure.new do
  # @return [String] If present, use this pagination token to retrieve the next page of supply sources.
  attribute?(:next_page_token, String, from: "nextPageToken")

  # @return [Array<Object>]
  attribute?(:supply_sources, Array, from: "supplySources")
end
SupplySourceConfiguration =

Includes configuration and timezone of a supply source.

Structure.new do
  # @return [OperationalConfiguration]
  attribute?(:operational_configuration, OperationalConfiguration, from: "operationalConfiguration")

  # @return [String] Please see RFC 6557, should be a canonical time zone ID as listed here:
  # https://www.joda.org/joda-time/timezones.html.
  attribute?(:timezone, String)
end
CreateSupplySourceRequest =

A request to create a supply source.

Structure.new do
  # @return [Address]
  attribute(:address, Address)

  # @return [String]
  attribute(:alias, String)

  # @return [String]
  attribute(:supply_source_code, String, from: "supplySourceCode")
end
UpdateSupplySourceRequest =

A request to update the configuration and capabilities of a supply source.

Structure.new do
  # @return [String]
  attribute?(:alias, String)

  # @return [SupplySourceCapabilities]
  attribute?(:capabilities, SupplySourceCapabilities)

  # @return [SupplySourceConfiguration]
  attribute?(:configuration, SupplySourceConfiguration)
end
CreateSupplySourceResponse =

The result of creating a new supply source.

Structure.new do
  # @return [String]
  attribute(:supply_source_code, String, from: "supplySourceCode")

  # @return [String]
  attribute(:supply_source_id, String, from: "supplySourceId")
end
CurbsidePickupConfiguration =

The curbside pickup configuration of a supply source.

Structure.new do
  # @return [:boolean] When true, curbside pickup is supported by the supply source.
  attribute?(:supported, :boolean, from: "isSupported")

  # @return [OperationalConfiguration] The operational configuration for the curbside pickup configuration.
  attribute?(:operational_configuration, OperationalConfiguration, from: "operationalConfiguration")

  # @return [ParkingWithAddressConfiguration] The parking configuration for curbside pickup with address for
  # customers to use.
  attribute?(:parking_with_address_configuration, ParkingWithAddressConfiguration, from: "parkingWithAddressConfiguration")
end
InStorePickupConfiguration =

The in-store pickup configuration of a supply source.

Structure.new do
  # @return [:boolean] When true, in-store pickup is supported by the supply source (default: `isSupported` value
  # in `PickupChannel`).
  attribute?(:supported, :boolean, from: "isSupported")

  # @return [ParkingConfiguration] The parking configuration for in-store pickup.
  attribute?(:parking_configuration, ParkingConfiguration, from: "parkingConfiguration")
end
ParkingWithAddressConfiguration =

The parking configuration with the address.

Structure.new do
  # @return [Address] The address of the parking location.
  attribute?(:address, Address)

  # @return [Integer] The number of parking spots.
  attribute?(:number_of_parking_spots, Integer, from: "numberOfParkingSpots")

  # @return [String] The type of cost at parking location.
  attribute?(:parking_cost_type, String, from: "parkingCostType")

  # @return [String] The type of parking spot identification used at parking location.
  attribute?(:parking_spot_identification_type, String, from: "parkingSpotIdentificationType")
end
UpdateSupplySourceStatusRequest =

A request to update the status of a supply source.

Structure.new do
  # @return [String]
  attribute?(:status, String)
end

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #endpoint, #retries

Instance Method Summary collapse

Methods inherited from Peddler::API

#endpoint_uri, #http, #initialize, #meter, #retriable, #sandbox, #sandbox?, #use, #via

Constructor Details

This class inherits a constructor from Peddler::API

Instance Method Details

#archive_supply_source(supply_source_id) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Archive a supply source, making it inactive. Cannot be undone.

Parameters:

  • supply_source_id (String)

    The unique identifier of a supply source.

Returns:



70
71
72
73
74
# File 'lib/peddler/apis/supply_sources_2020_07_01.rb', line 70

def archive_supply_source(supply_source_id)
  path = "/supplySources/2020-07-01/supplySources/#{percent_encode(supply_source_id)}"
  parser = -> { ErrorList }
  delete(path, parser:)
end

#create_supply_source(payload) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Create a new supply source.

Parameters:

  • payload (Hash)

    A request to create a supply source.

Returns:



34
35
36
37
38
39
# File 'lib/peddler/apis/supply_sources_2020_07_01.rb', line 34

def create_supply_source(payload)
  path = "/supplySources/2020-07-01/supplySources"
  body = payload
  parser = -> { CreateSupplySourceResponse }
  post(path, body:, parser:)
end

#get_supply_source(supply_source_id) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Retrieve a supply source.

Parameters:

  • supply_source_id (String)

    The unique identifier of a supply source.

Returns:



46
47
48
49
50
# File 'lib/peddler/apis/supply_sources_2020_07_01.rb', line 46

def get_supply_source(supply_source_id)
  path = "/supplySources/2020-07-01/supplySources/#{percent_encode(supply_source_id)}"
  parser = -> { SupplySource }
  get(path, parser:)
end

#get_supply_sources(next_page_token: nil, page_size: 10) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

The path to retrieve paginated supply sources.

Parameters:

  • next_page_token (String) (defaults to: nil)

    The pagination token to retrieve a specific page of results.

  • page_size (Number) (defaults to: 10)

    The number of supply sources to return per paginated request.

Returns:



19
20
21
22
23
24
25
26
27
# File 'lib/peddler/apis/supply_sources_2020_07_01.rb', line 19

def get_supply_sources(next_page_token: nil, page_size: 10)
  path = "/supplySources/2020-07-01/supplySources"
  params = {
    "nextPageToken" => next_page_token,
    "pageSize" => page_size,
  }.compact
  parser = -> { GetSupplySourcesResponse }
  get(path, params:, parser:)
end

#update_supply_source(supply_source_id, payload: nil) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Update the configuration and capabilities of a supply source.

Parameters:

  • supply_source_id (String)

    The unique identitier of a supply source.

  • payload (Hash) (defaults to: nil)

Returns:



58
59
60
61
62
63
# File 'lib/peddler/apis/supply_sources_2020_07_01.rb', line 58

def update_supply_source(supply_source_id, payload: nil)
  path = "/supplySources/2020-07-01/supplySources/#{percent_encode(supply_source_id)}"
  body = payload
  parser = -> { ErrorList }
  put(path, body:, parser:)
end

#update_supply_source_status(supply_source_id, payload: nil) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Update the status of a supply source.

Parameters:

  • supply_source_id (String)

    The unique identifier of a supply source.

  • payload (Hash) (defaults to: nil)

Returns:



82
83
84
85
86
87
# File 'lib/peddler/apis/supply_sources_2020_07_01.rb', line 82

def update_supply_source_status(supply_source_id, payload: nil)
  path = "/supplySources/2020-07-01/supplySources/#{percent_encode(supply_source_id)}/status"
  body = payload
  parser = -> { ErrorList }
  put(path, body:, parser:)
end