Class: Peddler::APIs::Vehicles20241101

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/vehicles_2024_11_01.rb,
lib/peddler/apis/vehicles_2024_11_01/error.rb,
lib/peddler/apis/vehicles_2024_11_01/vehicle.rb,
lib/peddler/apis/vehicles_2024_11_01/error_list.rb,
lib/peddler/apis/vehicles_2024_11_01/pagination.rb,
lib/peddler/apis/vehicles_2024_11_01/engine_output.rb,
lib/peddler/apis/vehicles_2024_11_01/month_and_year.rb,
lib/peddler/apis/vehicles_2024_11_01/vehicles_response.rb,
lib/peddler/apis/vehicles_2024_11_01/vehicle_identifiers.rb

Overview

The Selling Partner API for Automotive.

The Selling Partner API for Automotive provides programmatic access to information needed by selling partners to provide compatibility information about their listed products.

Constant Summary collapse

Error =

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
Vehicle =

Combinations of attributes and unique identifier that represents a vehicle in vehicle list.

Structure.new do
  # @return [Array<VehicleIdentifiers>] Identifiers that can be used to identify the vehicle uniquely
  attribute(:identifiers, [VehicleIdentifiers])

  # @return [String] Vehicle Brand.
  attribute(:make, String)

  # @return [String] Specific model of a vehicle.
  attribute(:model, String)

  # @return [String] Body style of vehicle (example: Hatchback, Cabriolet).
  attribute?(:body_style, String, from: "bodyStyle")

  # @return [String] Drive type of vehicle(example: Rear wheel drive).
  attribute?(:drive_type, String, from: "driveType")

  # @return [String] Energy Source for the vehicle(example: Petrol)
  attribute?(:energy, String)

  # @return [Array<EngineOutput>] Engine output of vehicle.
  attribute?(:engine_output, [EngineOutput], from: "engineOutput")

  # @return [String] The date on which the vehicle was last updated, in ISO-8601 date/time format.
  attribute?(:last_processed_date, String, from: "lastProcessedDate")

  # @return [MonthAndYear] Vehicle manufacturing start date.
  attribute?(:manufacturing_start_date, MonthAndYear, from: "manufacturingStartDate")

  # @return [MonthAndYear] Vehicle manufacturing stop date. If it is empty, then the vehicle is still being
  # manufactured.
  attribute?(:manufacturing_stop_date, MonthAndYear, from: "manufacturingStopDate")

  # @return [String] Denotes if the vehicle is active or deleted from Amazon's catalog.
  attribute?(:status, String)

  # @return [String] Name of the vehicle variant.
  attribute?(:variant_name, String, from: "variantName")
end
ErrorList =

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

Structure.new do
  # @return [Array<Error>] array of errors
  attribute(:errors, [Error])
end
Pagination =

When a request produces a response that exceeds the pageSize, pagination occurs. This means the response is divided into individual pages. To retrieve the next page or the previous page, you must pass the nextToken value or the previousToken value as the pageToken parameter in the next request. When you receive the last page, there will be no nextToken key in the pagination object.

Structure.new do
  # @return [String] A token that can be used to fetch the next page.
  attribute?(:next_token, String, from: "nextToken")

  # @return [String] A token that can be used to fetch the previous page.
  attribute?(:previous_token, String, from: "previousToken")
end
EngineOutput =

Engine power output of vehicle.

Structure.new do
  # @return [String] Unit for measuring engine power.
  attribute(:unit, String)

  # @return [Float] Engine power value in specified unit.
  attribute(:value, Float)
end
MonthAndYear =

Represents a month in a specific year.

Structure.new do
  # @return [Float]
  attribute?(:month, Float)

  # @return [Float]
  attribute?(:year, Float)
end
VehiclesResponse =

Get paginated list of vehicle from Amazon's catalog

Structure.new do
  # @return [Array<Vehicle>] List of vehicles from Amazon's catalog.
  attribute(:vehicles, [Vehicle])

  # @return [Pagination] If available, the `nextToken` and/or `previousToken` values required to return paginated
  # results.
  attribute?(:pagination, Pagination)
end
VehicleIdentifiers =

Combination of vehicle standard and id that can uniquely identify a vehicle from Amazon's catalog.

Structure.new do
  # @return [String] Vehicle standard used to uniquely identify a vehicle.
  attribute(:standard, String)

  # @return [String] Id that can uniquely identify a vehicle based the vehicle identification standard.
  attribute(:value, 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

#get_vehicles(marketplace_id, vehicle_type, page_token: nil, updated_after: nil) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Get the latest collection of vehicles

Amazon's catalog after this date will be returned.

Parameters:

  • page_token (String) (defaults to: nil)

    A token to fetch a certain page when there are multiple pages worth of results.

  • marketplace_id (String)

    An identifier for the marketplace in which the resource operates.

  • vehicle_type (String)

    An identifier for vehicle type.

  • updated_after (String) (defaults to: nil)

    Date in ISO 8601 format, if provided only vehicles which are modified/added to

Returns:



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/peddler/apis/vehicles_2024_11_01.rb', line 23

def get_vehicles(marketplace_id, vehicle_type, page_token: nil, updated_after: nil)
  path = "/catalog/2024-11-01/automotive/vehicles"
  params = {
    "pageToken" => page_token,
    "marketplaceId" => marketplace_id,
    "vehicleType" => vehicle_type,
    "updatedAfter" => updated_after,
  }.compact
  parser = -> { VehiclesResponse }
  get(path, params:, parser:)
end