Class: UltracartClient::FulfillmentApi

Inherits:
Object
  • Object
show all
Defined in:
lib/ultracart_api/api/fulfillment_api.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ FulfillmentApi

Returns a new instance of FulfillmentApi.



19
20
21
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 17

def api_client
  @api_client
end

Class Method Details

.new_using_api_key(simple_key, verify_ssl = true, debugging = false) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 23

def self.new_using_api_key(simple_key, verify_ssl = true, debugging = false)
  api_config = Configuration.new
  api_config.api_key_prefix['x-ultracart-simple-key'] = simple_key
  api_config.api_version = '2017-03-01'
  api_config.verify_ssl = verify_ssl

  api_client = ApiClient.new(api_config)
  api_client.config.debugging = debugging

  UltracartClient::FulfillmentApi.new(api_client)
end

Instance Method Details

#acknowledge_orders(distribution_center_code, order_ids, opts = {}) ⇒ nil

Acknowledge receipt of orders. Acknowledge receipt of orders so that they are removed from the fulfillment queue. This method must be called after receiving and order (via webhook) or retrieving (via retrieve orders method).

Parameters:

  • distribution_center_code

    Distribution center code

  • order_ids

    Orders to acknowledge receipt of (limit 100)

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


41
42
43
44
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 41

def acknowledge_orders(distribution_center_code, order_ids, opts = {})
  acknowledge_orders_with_http_info(distribution_center_code, order_ids, opts)
  nil
end

#acknowledge_orders_with_http_info(distribution_center_code, order_ids, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Acknowledge receipt of orders. Acknowledge receipt of orders so that they are removed from the fulfillment queue. This method must be called after receiving and order (via webhook) or retrieving (via retrieve orders method).

Parameters:

  • distribution_center_code

    Distribution center code

  • order_ids

    Orders to acknowledge receipt of (limit 100)

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 52

def acknowledge_orders_with_http_info(distribution_center_code, order_ids, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FulfillmentApi.acknowledge_orders ...'
  end
  # verify the required parameter 'distribution_center_code' is set
  if @api_client.config.client_side_validation && distribution_center_code.nil?
    fail ArgumentError, "Missing the required parameter 'distribution_center_code' when calling FulfillmentApi.acknowledge_orders"
  end
  # verify the required parameter 'order_ids' is set
  if @api_client.config.client_side_validation && order_ids.nil?
    fail ArgumentError, "Missing the required parameter 'order_ids' when calling FulfillmentApi.acknowledge_orders"
  end
  # resource path
  local_var_path = '/fulfillment/distribution_centers/{distribution_center_code}/acknowledgements'.sub('{' + 'distribution_center_code' + '}', distribution_center_code.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(order_ids)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FulfillmentApi#acknowledge_orders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#generate_packing_slip(distribution_center_code, order_id, opts = {}) ⇒ OrdersResponse

Generate a packing slip for this order for the given distribution center. The packing slip PDF that is returned is base 64 encoded

Parameters:

  • distribution_center_code

    Distribution center code

  • order_id

    Order ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



101
102
103
104
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 101

def generate_packing_slip(distribution_center_code, order_id, opts = {})
  data, _status_code, _headers = generate_packing_slip_with_http_info(distribution_center_code, order_id, opts)
  data
end

#generate_packing_slip_with_http_info(distribution_center_code, order_id, opts = {}) ⇒ Array<(OrdersResponse, Fixnum, Hash)>

Generate a packing slip for this order for the given distribution center. The packing slip PDF that is returned is base 64 encoded

Parameters:

  • distribution_center_code

    Distribution center code

  • order_id

    Order ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(OrdersResponse, Fixnum, Hash)>)

    OrdersResponse data, response status code and response headers



112
113
114
115
116
117
118
119
120
121
122
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
155
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 112

def generate_packing_slip_with_http_info(distribution_center_code, order_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FulfillmentApi.generate_packing_slip ...'
  end
  # verify the required parameter 'distribution_center_code' is set
  if @api_client.config.client_side_validation && distribution_center_code.nil?
    fail ArgumentError, "Missing the required parameter 'distribution_center_code' when calling FulfillmentApi.generate_packing_slip"
  end
  # verify the required parameter 'order_id' is set
  if @api_client.config.client_side_validation && order_id.nil?
    fail ArgumentError, "Missing the required parameter 'order_id' when calling FulfillmentApi.generate_packing_slip"
  end
  # resource path
  local_var_path = '/fulfillment/distribution_centers/{distribution_center_code}/orders/{order_id}'.sub('{' + 'distribution_center_code' + '}', distribution_center_code.to_s).sub('{' + 'order_id' + '}', order_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'OrdersResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FulfillmentApi#generate_packing_slip\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_distribution_center_orders(distribution_center_code, opts = {}) ⇒ OrdersResponse

Retrieve orders queued up for this distribution center. Retrieves up to 100 orders that are queued up in this distribution center. You must acknowledge them before additional new orders will be returned. There is NO record chunking. You’ll get the same 100 records again and again until you acknowledge orders. The orders that are returned contain only items for this distribution center and are by default completely expanded with billing, buysafe, channel_partner, checkout, coupons, customer_profile, edi, gift, gift_certificate, internal, items, payment, shipping, summary, taxes.

Parameters:

  • distribution_center_code

    Distribution center code

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



161
162
163
164
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 161

def get_distribution_center_orders(distribution_center_code, opts = {})
  data, _status_code, _headers = get_distribution_center_orders_with_http_info(distribution_center_code, opts)
  data
end

#get_distribution_center_orders_with_http_info(distribution_center_code, opts = {}) ⇒ Array<(OrdersResponse, Fixnum, Hash)>

Retrieve orders queued up for this distribution center. Retrieves up to 100 orders that are queued up in this distribution center. You must acknowledge them before additional new orders will be returned. There is NO record chunking. You&#39;ll get the same 100 records again and again until you acknowledge orders. The orders that are returned contain only items for this distribution center and are by default completely expanded with billing, buysafe, channel_partner, checkout, coupons, customer_profile, edi, gift, gift_certificate, internal, items, payment, shipping, summary, taxes.

Parameters:

  • distribution_center_code

    Distribution center code

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(OrdersResponse, Fixnum, Hash)>)

    OrdersResponse data, response status code and response headers



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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 171

def get_distribution_center_orders_with_http_info(distribution_center_code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FulfillmentApi.get_distribution_center_orders ...'
  end
  # verify the required parameter 'distribution_center_code' is set
  if @api_client.config.client_side_validation && distribution_center_code.nil?
    fail ArgumentError, "Missing the required parameter 'distribution_center_code' when calling FulfillmentApi.get_distribution_center_orders"
  end
  # resource path
  local_var_path = '/fulfillment/distribution_centers/{distribution_center_code}/orders'.sub('{' + 'distribution_center_code' + '}', distribution_center_code.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'OrdersResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FulfillmentApi#get_distribution_center_orders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_distribution_centers(opts = {}) ⇒ DistributionCentersResponse

Retrieve distribution centers Retrieves the distribution centers that this user has access to.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



215
216
217
218
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 215

def get_distribution_centers(opts = {})
  data, _status_code, _headers = get_distribution_centers_with_http_info(opts)
  data
end

#get_distribution_centers_with_http_info(opts = {}) ⇒ Array<(DistributionCentersResponse, Fixnum, Hash)>

Retrieve distribution centers Retrieves the distribution centers that this user has access to.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 224

def get_distribution_centers_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FulfillmentApi.get_distribution_centers ...'
  end
  # resource path
  local_var_path = '/fulfillment/distribution_centers'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'DistributionCentersResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FulfillmentApi#get_distribution_centers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#ship_orders(distribution_center_code, shipments, opts = {}) ⇒ nil

Mark orders as shipped Store the tracking information and mark the order shipped for this distribution center.

Parameters:

  • distribution_center_code

    Distribution center code

  • shipments

    Orders to mark shipped

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


266
267
268
269
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 266

def ship_orders(distribution_center_code, shipments, opts = {})
  ship_orders_with_http_info(distribution_center_code, shipments, opts)
  nil
end

#ship_orders_with_http_info(distribution_center_code, shipments, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Mark orders as shipped Store the tracking information and mark the order shipped for this distribution center.

Parameters:

  • distribution_center_code

    Distribution center code

  • shipments

    Orders to mark shipped

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 277

def ship_orders_with_http_info(distribution_center_code, shipments, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FulfillmentApi.ship_orders ...'
  end
  # verify the required parameter 'distribution_center_code' is set
  if @api_client.config.client_side_validation && distribution_center_code.nil?
    fail ArgumentError, "Missing the required parameter 'distribution_center_code' when calling FulfillmentApi.ship_orders"
  end
  # verify the required parameter 'shipments' is set
  if @api_client.config.client_side_validation && shipments.nil?
    fail ArgumentError, "Missing the required parameter 'shipments' when calling FulfillmentApi.ship_orders"
  end
  # resource path
  local_var_path = '/fulfillment/distribution_centers/{distribution_center_code}/shipments'.sub('{' + 'distribution_center_code' + '}', distribution_center_code.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(shipments)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FulfillmentApi#ship_orders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_inventory(distribution_center_code, inventories, opts = {}) ⇒ nil

Update inventory Update the inventory for items associated with this distribution center

Parameters:

  • distribution_center_code

    Distribution center code

  • inventories

    Inventory updates (limit 500)

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


326
327
328
329
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 326

def update_inventory(distribution_center_code, inventories, opts = {})
  update_inventory_with_http_info(distribution_center_code, inventories, opts)
  nil
end

#update_inventory_with_http_info(distribution_center_code, inventories, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update inventory Update the inventory for items associated with this distribution center

Parameters:

  • distribution_center_code

    Distribution center code

  • inventories

    Inventory updates (limit 500)

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 337

def update_inventory_with_http_info(distribution_center_code, inventories, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FulfillmentApi.update_inventory ...'
  end
  # verify the required parameter 'distribution_center_code' is set
  if @api_client.config.client_side_validation && distribution_center_code.nil?
    fail ArgumentError, "Missing the required parameter 'distribution_center_code' when calling FulfillmentApi.update_inventory"
  end
  # verify the required parameter 'inventories' is set
  if @api_client.config.client_side_validation && inventories.nil?
    fail ArgumentError, "Missing the required parameter 'inventories' when calling FulfillmentApi.update_inventory"
  end
  # resource path
  local_var_path = '/fulfillment/distribution_centers/{distribution_center_code}/inventory'.sub('{' + 'distribution_center_code' + '}', distribution_center_code.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(inventories)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FulfillmentApi#update_inventory\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end