Class: WalmartApIs::CatalogApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/walmart_ap_is/apis/catalog_api.rb

Overview

CatalogApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from WalmartApIs::BaseApi

Instance Method Details

#get_catalog_item(walmart_item_id, marketplace_ids, included_data: nil) ⇒ ApiResponse

TODO: type endpoint description here (14-digit numeric identifier) marketplace identifiers. Use WALMART_US for the US marketplace. sections to include in the response

Parameters:

  • walmart_item_id (String)

    Required parameter: Walmart Item ID

  • marketplace_ids (Array[MarketplaceId])

    Required parameter: Walmart

  • included_data (Array[IncludedDatum]) (defaults to: nil)

    Optional parameter: Data

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/walmart_ap_is/apis/catalog_api.rb', line 89

def get_catalog_item(walmart_item_id,
                     marketplace_ids,
                     included_data: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/catalog/v4/items/{walmartItemId}',
                                 Server::DEFAULT1)
               .template_param(new_parameter(walmart_item_id, key: 'walmartItemId')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(marketplace_ids, key: 'marketplaceIds')
                             .is_required(true))
               .query_param(new_parameter(included_data, key: 'includedData'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Item.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('403',
                             'Forbidden — insufficient permissions',
                             ErrorListErrorException)
                .local_error('404',
                             'Resource not found',
                             ErrorListErrorException)
                .local_error('429',
                             'Rate limit exceeded',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end

#search_catalog_items(marketplace_ids, keywords: nil, walmart_item_ids: nil, seller_sku: nil, gtin: nil, upc: nil, included_data: nil, page_size: 10, page_token: nil) ⇒ ApiResponse

Search the Walmart Marketplace catalog using keywords, WalmartItemId, GTIN, UPC, or seller SKU. Returns matching catalog items. marketplace identifiers. Use WALMART_US for the US marketplace. Walmart Item IDs (14-digit). Max 20. (14-digit) (12-digit) sections to include in the response (1–20). Known limitation: The PIQS keyword search backend hard-caps results at 40 items per call regardless of this value. results, obtained from pagination.nextToken in a previous response. Known limitation: Cursor-based pagination is not currently supported for keyword search. The PIQS search backend (/v3/items/walmart/search) does not return a nextCursor and does not honour this parameter. Results are capped at 40 items per call. Reserved for future use once PIQS exposes pagination support.

Parameters:

  • marketplace_ids (Array[MarketplaceId])

    Required parameter: Walmart

  • keywords (String) (defaults to: nil)

    Optional parameter: Keyword search terms

  • walmart_item_ids (String) (defaults to: nil)

    Optional parameter: Comma-separated

  • seller_sku (String) (defaults to: nil)

    Optional parameter: Seller-defined SKU

  • gtin (String) (defaults to: nil)

    Optional parameter: Global Trade Item Number

  • upc (String) (defaults to: nil)

    Optional parameter: Universal Product Code

  • included_data (Array[IncludedDatum]) (defaults to: nil)

    Optional parameter: Data

  • page_size (Integer) (defaults to: 10)

    Optional parameter: Number of results per page

  • page_token (String) (defaults to: nil)

    Optional parameter: Token for the next page of

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/walmart_ap_is/apis/catalog_api.rb', line 34

def search_catalog_items(marketplace_ids,
                         keywords: nil,
                         walmart_item_ids: nil,
                         seller_sku: nil,
                         gtin: nil,
                         upc: nil,
                         included_data: nil,
                         page_size: 10,
                         page_token: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/catalog/v4/items',
                                 Server::DEFAULT1)
               .query_param(new_parameter(marketplace_ids, key: 'marketplaceIds')
                             .is_required(true))
               .query_param(new_parameter(keywords, key: 'keywords'))
               .query_param(new_parameter(walmart_item_ids, key: 'walmartItemIds'))
               .query_param(new_parameter(seller_sku, key: 'sellerSku'))
               .query_param(new_parameter(gtin, key: 'gtin'))
               .query_param(new_parameter(upc, key: 'upc'))
               .query_param(new_parameter(included_data, key: 'includedData'))
               .query_param(new_parameter(page_size, key: 'pageSize'))
               .query_param(new_parameter(page_token, key: 'pageToken'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ItemSearchResults.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('403',
                             'Forbidden — insufficient permissions',
                             ErrorListErrorException)
                .local_error('404',
                             'Resource not found',
                             ErrorListErrorException)
                .local_error('429',
                             'Rate limit exceeded',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end