Class: WalmartApIs::ProductTypeDefinitionsApi

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

Overview

ProductTypeDefinitionsApi

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_product_type_definition(product_type, seller_id: nil, locale: 'en_US') ⇒ ApiResponse

Placeholder — not yet implemented. here here

Parameters:

  • product_type (String)

    Required parameter: TODO: type description

  • seller_id (String) (defaults to: nil)

    Optional parameter: TODO: type description

  • locale (String) (defaults to: 'en_US')

    Optional parameter: Example:en_US

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
80
81
82
83
84
85
86
87
# File 'lib/walmart_ap_is/apis/product_type_definitions_api.rb', line 53

def get_product_type_definition(product_type,
                                seller_id: nil,
                                locale: 'en_US')
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/definitions/v4/productTypes/{productType}',
                                 Server::DEFAULT1)
               .template_param(new_parameter(product_type, key: 'productType')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(seller_id, key: 'sellerId'))
               .query_param(new_parameter(locale, key: 'locale'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ProductTypeDefinition.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('403',
                             'Forbidden',
                             ErrorListErrorException)
                .local_error('404',
                             'Not Found',
                             ErrorListErrorException)
                .local_error('429',
                             'Rate limit exceeded',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end

#search_product_type_definitions(keywords: nil, item_name: nil, locale: 'en_US') ⇒ ApiResponse

Placeholder — not yet implemented. here

Parameters:

  • keywords (String) (defaults to: nil)

    Optional parameter: TODO: type description here

  • item_name (String) (defaults to: nil)

    Optional parameter: TODO: type description

  • locale (String) (defaults to: 'en_US')

    Optional parameter: Example:en_US

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/walmart_ap_is/apis/product_type_definitions_api.rb', line 15

def search_product_type_definitions(keywords: nil,
                                    item_name: nil,
                                    locale: 'en_US')
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/definitions/v4/productTypes',
                                 Server::DEFAULT1)
               .query_param(new_parameter(keywords, key: 'keywords'))
               .query_param(new_parameter(item_name, key: 'itemName'))
               .query_param(new_parameter(locale, key: 'locale'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ProductTypeList.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             ErrorListErrorException)
                .local_error('403',
                             'Forbidden',
                             ErrorListErrorException)
                .local_error('429',
                             'Rate limit exceeded',
                             ErrorListErrorException)
                .local_error('500',
                             'Internal Server Error',
                             ErrorListErrorException))
    .execute
end