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 (String)

    Distribution center code

  • order_ids (Array<String>)

    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, Integer, 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 (String)

    Distribution center code

  • order_ids (Array<String>)

    Orders to acknowledge receipt of (limit 100)

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

    the optional parameters

Returns:

  • (Array<(nil, Integer, 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# 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' + '}', CGI.escape(distribution_center_code.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[: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'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(order_ids)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"FulfillmentApi.acknowledge_orders",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  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 = {}) ⇒ OrderPackingSlipResponse

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 (String)

    Distribution center code

  • order_id (String)

    Order ID

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

    the optional parameters

Returns:



116
117
118
119
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 116

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<(OrderPackingSlipResponse, Integer, 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 (String)

    Distribution center code

  • order_id (String)

    Order ID

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

    the optional parameters

Returns:

  • (Array<(OrderPackingSlipResponse, Integer, Hash)>)

    OrderPackingSlipResponse data, response status code and response headers



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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 127

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' + '}', CGI.escape(distribution_center_code.to_s)).sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[: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'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'OrderPackingSlipResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"FulfillmentApi.generate_packing_slip",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  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, channel_partner, checkout, coupons, customer_profile, edi, gift, gift_certificate, internal, items, payment, shipping, summary, taxes.

Parameters:

  • distribution_center_code (String)

    Distribution center code

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

    the optional parameters

Returns:



185
186
187
188
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 185

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, Integer, 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, channel_partner, checkout, coupons, customer_profile, edi, gift, gift_certificate, internal, items, payment, shipping, summary, taxes.

Parameters:

  • distribution_center_code (String)

    Distribution center code

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

    the optional parameters

Returns:

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

    OrdersResponse data, response status code and response headers



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 195

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' + '}', CGI.escape(distribution_center_code.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[: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'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'OrdersResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"FulfillmentApi.get_distribution_center_orders",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  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:



248
249
250
251
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 248

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, Integer, Hash)>

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

Parameters:

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

    the optional parameters

Returns:

  • (Array<(DistributionCentersResponse, Integer, Hash)>)

    DistributionCentersResponse data, response status code and response headers



257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 257

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 = opts[:query_params] || {}

  # header parameters
  header_params = opts[: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'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DistributionCentersResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"FulfillmentApi.get_distribution_centers",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  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 (String)

    Distribution center code

  • shipments (Array<FulfillmentShipment>)

    Orders to mark shipped

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

    the optional parameters

Returns:

  • (nil)


308
309
310
311
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 308

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, Integer, Hash)>

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

Parameters:

  • distribution_center_code (String)

    Distribution center code

  • shipments (Array<FulfillmentShipment>)

    Orders to mark shipped

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
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
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 319

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' + '}', CGI.escape(distribution_center_code.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[: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'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(shipments)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"FulfillmentApi.ship_orders",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  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 (String)

    Distribution center code

  • inventories (Array<FulfillmentInventory>)

    Inventory updates (limit 500)

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

    the optional parameters

Returns:

  • (nil)


383
384
385
386
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 383

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, Integer, Hash)>

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

Parameters:

  • distribution_center_code (String)

    Distribution center code

  • inventories (Array<FulfillmentInventory>)

    Inventory updates (limit 500)

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
# File 'lib/ultracart_api/api/fulfillment_api.rb', line 394

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' + '}', CGI.escape(distribution_center_code.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[: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'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(inventories)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"FulfillmentApi.update_inventory",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  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