Class: MuffinMan::Listings::V20210801

Inherits:
SpApiClient show all
Defined in:
lib/muffin_man/listings/v20210801.rb

Constant Summary

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

#delete_listings_item(seller_id, sku, marketplace_ids, issue_locale: nil) ⇒ Object



40
41
42
43
44
45
46
47
48
49
# File 'lib/muffin_man/listings/v20210801.rb', line 40

def delete_listings_item(seller_id, sku, marketplace_ids, issue_locale: nil)
  @local_var_path = "/listings/2021-08-01/items/#{seller_id}/#{sku}"
  @marketplace_ids = marketplace_ids.is_a?(Array) ? marketplace_ids : [marketplace_ids]
  @query_params = {
    "marketplaceIds" =>  @marketplace_ids.join(",")
  }
  @query_params["issueLocale"] = issue_locale if issue_locale
  @request_type = "DELETE"
  call_api
end

#get_listings_item(seller_id, sku, marketplace_ids, issue_locale: nil, included_data: []) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/muffin_man/listings/v20210801.rb', line 4

def get_listings_item(seller_id, sku, marketplace_ids, issue_locale: nil, included_data: [])
  # Options for included_data:
  #   summaries
  #   attributes
  #   issues
  #   offers
  #   fulfillmentAvailability
  #   procurement
  @local_var_path = "/listings/2021-08-01/items/#{seller_id}/#{sku}"
  @marketplace_ids = marketplace_ids.is_a?(Array) ? marketplace_ids : [marketplace_ids]
  @query_params = {
    "marketplaceIds" =>  @marketplace_ids.join(",")
  }
  @query_params["issueLocale"] = issue_locale if issue_locale
  @query_params["includedData"] = included_data.join(",") if included_data.any?
  @request_type = "GET"
  call_api
end

#patch_listings_item(seller_id, sku, marketplace_ids, product_type, patches, included_data: [], mode: nil, issue_locale: nil) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/muffin_man/listings/v20210801.rb', line 51

def patch_listings_item(seller_id, sku, marketplace_ids, product_type, patches, included_data: [], mode: nil,
                        issue_locale: nil)
  @local_var_path = "/listings/2021-08-01/items/#{seller_id}/#{sku}"
  @marketplace_ids = marketplace_ids.is_a?(Array) ? marketplace_ids : [marketplace_ids]
  @query_params = {
    "marketplaceIds" =>  @marketplace_ids.join(",")
  }
  @query_params["includedData"] = included_data.join(",") if included_data.any?
  @query_params["mode"] = mode if mode
  @query_params["issueLocale"] = issue_locale if issue_locale
  @request_body = {
    "productType" => product_type,
    "patches" => patches
  }
  @request_type = "PATCH"
  call_api
end

#put_listings_item(seller_id, sku, marketplace_ids, product_type, attributes, issue_locale: nil, requirements: nil) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/muffin_man/listings/v20210801.rb', line 23

def put_listings_item(seller_id, sku, marketplace_ids, product_type, attributes, issue_locale: nil,
                      requirements: nil)
  @local_var_path = "/listings/2021-08-01/items/#{seller_id}/#{sku}"
  @marketplace_ids = marketplace_ids.is_a?(Array) ? marketplace_ids : [marketplace_ids]
  @query_params = {
    "marketplaceIds" =>  @marketplace_ids.join(",")
  }
  @query_params["issueLocale"] = issue_locale if issue_locale
  @request_body = {
    "productType" => product_type,
    "attributes" => attributes
  }
  @request_body["requirements"] = requirements if requirements
  @request_type = "PUT"
  call_api
end