Class: MuffinMan::Feeds::V20210630

Inherits:
SpApiClient show all
Defined in:
lib/muffin_man/feeds/v20210630.rb

Constant Summary collapse

FEED_PATH =
"/feeds/2021-06-30"

Constants inherited from SpApiClient

SpApiClient::ACCESS_TOKEN_URL, SpApiClient::AWS_REGION_MAP, SpApiClient::SERVICE_NAME, SpApiClient::UNPROCESSABLE_ENTITY_STATUS_CODE

Instance Attribute Summary

Attributes inherited from SpApiClient

#access_token_cache_key, #aws_access_key_id, #aws_secret_access_key, #client_id, #client_secret, #config, #credentials, #local_var_path, #pii_data_elements, #query_params, #refresh_token, #region, #request_body, #request_type, #sandbox, #scope, #sts_iam_role_arn

Instance Method Summary collapse

Methods inherited from SpApiClient

#initialize

Constructor Details

This class inherits a constructor from MuffinMan::SpApiClient

Instance Method Details

#create_feed(feed_type, marketplace_ids, input_feed_document_id, params = {}) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/muffin_man/feeds/v20210630.rb', line 9

def create_feed(feed_type, marketplace_ids, input_feed_document_id, params = {})
  @local_var_path = "#{FEED_PATH}/feeds"
  @request_body = { "feedType" => feed_type, "marketplaceIds" => marketplace_ids,
                    "inputFeedDocumentId" => input_feed_document_id }.merge(sp_api_params(params))
  @request_type = "POST"
  call_api
end

#create_feed_document(content_type, params = {}) ⇒ Object



31
32
33
34
35
36
# File 'lib/muffin_man/feeds/v20210630.rb', line 31

def create_feed_document(content_type, params = {})
  @local_var_path = "#{FEED_PATH}/documents"
  @request_body = { "contentType" => content_type }.merge(sp_api_params(params))
  @request_type = "POST"
  call_api
end

#get_feed(feed_id) ⇒ Object



25
26
27
28
29
# File 'lib/muffin_man/feeds/v20210630.rb', line 25

def get_feed(feed_id)
  @local_var_path = "#{FEED_PATH}/feeds/#{feed_id}"
  @request_type = "GET"
  call_api
end

#get_feed_document(feed_document_id) ⇒ Object



38
39
40
41
42
# File 'lib/muffin_man/feeds/v20210630.rb', line 38

def get_feed_document(feed_document_id)
  @local_var_path = "#{FEED_PATH}/documents/#{feed_document_id}"
  @request_type = "GET"
  call_api
end

#get_feeds(params) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/muffin_man/feeds/v20210630.rb', line 17

def get_feeds(params)
  @local_var_path = "#{FEED_PATH}/feeds"
  sp_api_params = sp_api_params(params)
  @query_params = sp_api_params.key?("nextToken") ? sp_api_params.slice("nextToken") : sp_api_params
  @request_type = "GET"
  call_api
end