Class: WalmartApIs::MerchantFulfillmentApi

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

Overview

MerchantFulfillmentApi

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

#cancel_shipment(shipment_id) ⇒ ApiResponse

TODO: type endpoint description here here

Parameters:

  • shipment_id (String)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/walmart_ap_is/apis/merchant_fulfillment_api.rb', line 123

def cancel_shipment(shipment_id)
  warn 'Endpoint cancel_shipment in MerchantFulfillmentApi is deprecated'
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/mfn/v4/shipments/{shipmentId}',
                                 Server::DEFAULT1)
               .template_param(new_parameter(shipment_id, key: 'shipmentId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CancelShipmentResponse.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

#create_shipment(body) ⇒ ApiResponse

Creates a shipment for an order, purchases a shipping label from the selected carrier, and returns the label for printing. description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
80
# File 'lib/walmart_ap_is/apis/merchant_fulfillment_api.rb', line 51

def create_shipment(body)
  warn 'Endpoint create_shipment in MerchantFulfillmentApi is deprecated'
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/mfn/v4/shipments',
                                 Server::DEFAULT1)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CreateShipmentResponse.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

#get_eligible_shipping_services(body) ⇒ ApiResponse

Returns available carriers and rates for a shipment based on package dimensions, weight, and destination address. type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



14
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/merchant_fulfillment_api.rb', line 14

def get_eligible_shipping_services(body)
  warn 'Endpoint get_eligible_shipping_services in MerchantFulfillmentApi '\
       'is deprecated'
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/mfn/v4/eligibleShippingServices',
                                 Server::DEFAULT1)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body)
                            .is_required(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(GetEligibleShippingServicesResponse.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

#get_label(shipment_id, format: Format::PDF) ⇒ ApiResponse

Returns the purchased shipping label for a shipment in the requested file format for printing. here

Parameters:

  • shipment_id (String)

    Required parameter: TODO: type description

  • format (Format) (defaults to: Format::PDF)

    Optional parameter: Example:PDF

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/walmart_ap_is/apis/merchant_fulfillment_api.rb', line 162

def get_label(shipment_id,
              format: Format::PDF)
  warn 'Endpoint get_label in MerchantFulfillmentApi is deprecated'
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/mfn/v4/shipments/{shipmentId}/label',
                                 Server::DEFAULT1)
               .template_param(new_parameter(shipment_id, key: 'shipmentId')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(format, key: 'format'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(Label.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

#get_shipment(shipment_id) ⇒ ApiResponse

TODO: type endpoint description here here

Parameters:

  • shipment_id (String)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



86
87
88
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
# File 'lib/walmart_ap_is/apis/merchant_fulfillment_api.rb', line 86

def get_shipment(shipment_id)
  warn 'Endpoint get_shipment in MerchantFulfillmentApi is deprecated'
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/mfn/v4/shipments/{shipmentId}',
                                 Server::DEFAULT1)
               .template_param(new_parameter(shipment_id, key: 'shipmentId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('walletAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(GetShipmentResponse.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