Class: Peddler::API::Feeds20210630

Inherits:
Peddler::API show all
Defined in:
lib/peddler/api/feeds_2021_06_30.rb

Overview

Selling Partner API for Feeds

The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner.

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #endpoint

Instance Method Summary collapse

Methods inherited from Peddler::API

#cannot_sandbox!, #endpoint_uri, #http, #initialize, #meter, #must_sandbox!, #retriable, #sandbox, #sandbox?, #use, #via

Constructor Details

This class inherits a constructor from Peddler::API

Instance Method Details

#cancel_feed(feed_id, rate_limit: 2.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Cancels the feed that you specify. Only feeds with ‘processingStatus=IN_QUEUE` can be cancelled. Cancelled feeds are returned in subsequent calls to the [`getFeed`](developer-docs.amazon.com/sp-api/docs/feeds-api-v2021-06-30-reference#getfeed) and [`getFeeds`](developer-docs.amazon.com/sp-api/docs/feeds-api-v2021-06-30-reference#getfeeds) operations.

Parameters:

  • feed_id (String)

    The identifier for the feed. This identifier is unique only in combination with a seller ID.

  • rate_limit (Float) (defaults to: 2.0)

    Requests per second

Returns:

  • (Hash)

    The API response



75
76
77
78
79
# File 'lib/peddler/api/feeds_2021_06_30.rb', line 75

def cancel_feed(feed_id, rate_limit: 2.0)
  path = "/feeds/2021-06-30/feeds/#{feed_id}"

  meter(rate_limit).delete(path)
end

#create_feed(body, rate_limit: 0.0083) ⇒ Hash

Note:

This operation can make a static sandbox call.

Creates a feed. Upload the contents of the feed document before calling this operation.

Parameters:

  • body (Hash)

    Information required to create the feed.

  • rate_limit (Float) (defaults to: 0.0083)

    Requests per second

Returns:

  • (Hash)

    The API response



59
60
61
62
63
# File 'lib/peddler/api/feeds_2021_06_30.rb', line 59

def create_feed(body, rate_limit: 0.0083)
  path = "/feeds/2021-06-30/feeds"

  meter(rate_limit).post(path, body:)
end

#create_feed_document(body, rate_limit: 0.5) ⇒ Hash

Note:

This operation can make a static sandbox call.

Creates a feed document for the feed type that you specify. This operation returns a presigned URL for uploading the feed document contents. It also returns a ‘feedDocumentId` value that you can pass in with a subsequent call to the [`createFeed`](developer-docs.amazon.com/sp-api/docs/feeds-api-v2021-06-30-reference#createfeed) operation.

Parameters:

  • body (Hash)

    Specifies the content type for the createFeedDocument operation.

  • rate_limit (Float) (defaults to: 0.5)

    Requests per second

Returns:

  • (Hash)

    The API response



103
104
105
106
107
# File 'lib/peddler/api/feeds_2021_06_30.rb', line 103

def create_feed_document(body, rate_limit: 0.5)
  path = "/feeds/2021-06-30/documents"

  meter(rate_limit).post(path, body:)
end

#get_feed(feed_id, rate_limit: 2.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Returns feed details (including the ‘resultDocumentId`, if available) for the feed that you specify.

Parameters:

  • feed_id (String)

    The identifier for the feed. This identifier is unique only in combination with a seller ID.

  • rate_limit (Float) (defaults to: 2.0)

    Requests per second

Returns:

  • (Hash)

    The API response



88
89
90
91
92
# File 'lib/peddler/api/feeds_2021_06_30.rb', line 88

def get_feed(feed_id, rate_limit: 2.0)
  path = "/feeds/2021-06-30/feeds/#{feed_id}"

  meter(rate_limit).get(path)
end

#get_feed_document(feed_document_id, rate_limit: 0.0222) ⇒ Hash

Note:

This operation can make a static sandbox call.

Returns the information required for retrieving a feed document’s contents.

Parameters:

  • feed_document_id (String)

    The identifier of the feed document.

  • rate_limit (Float) (defaults to: 0.0222)

    Requests per second

Returns:

  • (Hash)

    The API response



115
116
117
118
119
# File 'lib/peddler/api/feeds_2021_06_30.rb', line 115

def get_feed_document(feed_document_id, rate_limit: 0.0222)
  path = "/feeds/2021-06-30/documents/#{feed_document_id}"

  meter(rate_limit).get(path)
end

#get_feeds(feed_types: nil, marketplace_ids: nil, page_size: 10, processing_statuses: nil, created_since: nil, created_until: nil, next_token: nil, rate_limit: 0.0222) ⇒ Hash

Note:

This operation can make a static sandbox call.

Returns feed details for the feeds that match the filters that you specify.

Parameters:

  • feed_types (Array<String>) (defaults to: nil)

    A list of feed types used to filter feeds. When feedTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either feedTypes or nextToken is required.

  • marketplace_ids (Array<String>) (defaults to: nil)

    A list of marketplace identifiers used to filter feeds. The feeds returned will match at least one of the marketplaces that you specify.

  • page_size (Integer) (defaults to: 10)

    The maximum number of feeds to return in a single call.

  • processing_statuses (Array<String>) (defaults to: nil)

    A list of processing statuses used to filter feeds.

  • created_since (String) (defaults to: nil)

    The earliest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is 90 days ago. Feeds are retained for a maximum of 90 days.

  • created_until (String) (defaults to: nil)

    The latest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is now.

  • next_token (String) (defaults to: nil)

    A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getFeeds operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail.

  • rate_limit (Float) (defaults to: 0.0222)

    Requests per second

Returns:

  • (Hash)

    The API response



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/peddler/api/feeds_2021_06_30.rb', line 37

def get_feeds(feed_types: nil, marketplace_ids: nil, page_size: 10, processing_statuses: nil, created_since: nil,
  created_until: nil, next_token: nil, rate_limit: 0.0222)
  path = "/feeds/2021-06-30/feeds"
  params = {
    "feedTypes" => feed_types,
    "marketplaceIds" => marketplace_ids,
    "pageSize" => page_size,
    "processingStatuses" => processing_statuses,
    "createdSince" => created_since,
    "createdUntil" => created_until,
    "nextToken" => next_token,
  }.compact

  meter(rate_limit).get(path, params:)
end