ultracart_api 4.1.162 → 4.1.164

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,567 +1,567 @@
1
- # UltracartClient::FulfillmentApi
2
-
3
- All URIs are relative to *https://secure.ultracart.com/rest/v2*
4
-
5
- | Method | HTTP request | Description |
6
- | ------ | ------------ | ----------- |
7
- | [**acknowledge_orders**](FulfillmentApi.md#acknowledge_orders) | **PUT** /fulfillment/distribution_centers/{distribution_center_code}/acknowledgements | Acknowledge receipt of orders. |
8
- | [**generate_packing_slip**](FulfillmentApi.md#generate_packing_slip) | **GET** /fulfillment/distribution_centers/{distribution_center_code}/orders/{order_id} | Generate a packing slip for this order for the given distribution center. |
9
- | [**get_distribution_center_orders**](FulfillmentApi.md#get_distribution_center_orders) | **GET** /fulfillment/distribution_centers/{distribution_center_code}/orders | Retrieve orders queued up for this distribution center. |
10
- | [**get_distribution_centers**](FulfillmentApi.md#get_distribution_centers) | **GET** /fulfillment/distribution_centers | Retrieve distribution centers |
11
- | [**ship_orders**](FulfillmentApi.md#ship_orders) | **POST** /fulfillment/distribution_centers/{distribution_center_code}/shipments | Mark orders as shipped |
12
- | [**update_inventory**](FulfillmentApi.md#update_inventory) | **POST** /fulfillment/distribution_centers/{distribution_center_code}/inventory | Update inventory |
13
-
14
-
15
- ## acknowledge_orders
16
-
17
- > acknowledge_orders(distribution_center_code, order_ids)
18
-
19
- Acknowledge receipt of orders.
20
-
21
- 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).
22
-
23
-
24
- ### Examples
25
-
26
- ```ruby
27
- require 'ultracart_api'
28
- require_relative '../constants'
29
-
30
- =begin
31
- acknowledgeOrders informs UltraCart that you (the fulfillment center) have received an order and have queued it for
32
- shipping. This method is NOT used to notify an order has shipped, only that it is going to be shipped at some
33
- point in the future.
34
-
35
- This method should be called by a fulfillment center after receiving an order either by 1) getDistributionCenterOrders
36
- or 2) webhook. Webhooks are the most efficient means for receiving orders, but if your fulfillment center lacks
37
- the ability to consume webhooks, polling by getDistributionCenterOrders is an alternate means.
38
-
39
- This method is important for notifying UltraCart that a fulfillment center has the action on an order. Until this
40
- call is made, UltraCart will continue to notify a fulfillment center of an order either by 1) subsequent webhooks or
41
- 2) continue to include an order in subsequent getDistributionCenterOrders.
42
-
43
- You will need the distribution center (DC) code. UltraCart allows for multiple DC and the code is a
44
- unique short string you assign to a DC as an easy mnemonic.
45
-
46
- For more information about UltraCart distribution centers, please see:
47
- https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377114/Distribution+Center
48
-
49
- If you do not know your DC code, query a list of all DC and print them out.
50
- result = fulfillment_api.get_distribution_centers
51
- puts result.inspect
52
-
53
- A successful call will receive back a status code 204 (No Content).
54
-
55
- Possible Errors:
56
- More than 100 order ids provided -> "order_ids can not contain more than 100 records at a time"
57
- =end
58
-
59
- distribution_center_code = 'RAMI'
60
- fulfillment_api = UltracartClient::FulfillmentApi.new_using_api_key(Constants::API_KEY)
61
-
62
- orders_ids = ['DEMO-12345', 'DEMO-12346', 'DEMO-12347', 'DEMO-12348', 'DEMO-12349']
63
-
64
- begin
65
- # limit is 100 acknowledgements at a time.
66
- fulfillment_api.acknowledge_orders(distribution_center_code, orders_ids)
67
- puts "done"
68
- rescue UltracartClient::ApiError => e
69
- # update inventory failed. examine the reason.
70
- puts "Exception when calling FulfillmentApi->acknowledge_orders: #{e.message}"
71
- exit
72
- end
73
- ```
74
-
75
-
76
- #### Using the acknowledge_orders_with_http_info variant
77
-
78
- This returns an Array which contains the response data (`nil` in this case), status code and headers.
79
-
80
- > <Array(nil, Integer, Hash)> acknowledge_orders_with_http_info(distribution_center_code, order_ids)
81
-
82
- ```ruby
83
- begin
84
- # Acknowledge receipt of orders.
85
- data, status_code, headers = api_instance.acknowledge_orders_with_http_info(distribution_center_code, order_ids)
86
- p status_code # => 2xx
87
- p headers # => { ... }
88
- p data # => nil
89
- rescue UltracartClient::ApiError => e
90
- puts "Error when calling FulfillmentApi->acknowledge_orders_with_http_info: #{e}"
91
- end
92
- ```
93
-
94
- ### Parameters
95
-
96
- | Name | Type | Description | Notes |
97
- | ---- | ---- | ----------- | ----- |
98
- | **distribution_center_code** | **String** | Distribution center code | |
99
- | **order_ids** | [**Array&lt;String&gt;**](String.md) | Orders to acknowledge receipt of (limit 100) | |
100
-
101
- ### Return type
102
-
103
- nil (empty response body)
104
-
105
- ### Authorization
106
-
107
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
108
-
109
- ### HTTP request headers
110
-
111
- - **Content-Type**: application/json
112
- - **Accept**: application/json
113
-
114
-
115
- ## generate_packing_slip
116
-
117
- > <OrderPackingSlipResponse> generate_packing_slip(distribution_center_code, order_id)
118
-
119
- Generate a packing slip for this order for the given distribution center.
120
-
121
- The packing slip PDF that is returned is base 64 encoded
122
-
123
-
124
- ### Examples
125
-
126
- ```ruby
127
- require 'ultracart_api'
128
- require_relative '../constants'
129
- require 'base64'
130
-
131
- =begin
132
- generatePackingSlip accepts a distribution center code and order_id and returns back a base64 encoded byte array pdf.
133
- Both the dc code and order_id are needed because an order may have multiple items shipping via different DCs.
134
-
135
- You will need the distribution center (DC) code. UltraCart allows for multiple DC and the code is a
136
- unique short string you assign to a DC as an easy mnemonic.
137
-
138
- For more information about UltraCart distribution centers, please see:
139
- https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377114/Distribution+Center
140
-
141
- If you do not know your DC code, query a list of all DC and print them out.
142
- result = fulfillment_api.get_distribution_centers
143
- puts result.inspect
144
-
145
- =end
146
-
147
- fulfillment_api = UltracartClient::FulfillmentApi.new_using_api_key(Constants::API_KEY)
148
-
149
- distribution_center_code = 'RAMI'
150
- orders_id = 'DEMO-12345'
151
-
152
- begin
153
- # limit is 500 inventory updates at a time. batch them if you're going large.
154
- api_response = fulfillment_api.generate_packing_slip(distribution_center_code, orders_id)
155
- base64_pdf = api_response.pdf_base64
156
- decoded_pdf = Base64.decode64(base64_pdf)
157
- File.write('packing_slip.pdf', decoded_pdf)
158
-
159
- puts "done"
160
- rescue UltracartClient::ApiError => e
161
- # update inventory failed. examine the reason.
162
- puts "Exception when calling FulfillmentApi->generate_packing_slip: #{e.message}"
163
- exit
164
- end
165
- ```
166
-
167
-
168
- #### Using the generate_packing_slip_with_http_info variant
169
-
170
- This returns an Array which contains the response data, status code and headers.
171
-
172
- > <Array(<OrderPackingSlipResponse>, Integer, Hash)> generate_packing_slip_with_http_info(distribution_center_code, order_id)
173
-
174
- ```ruby
175
- begin
176
- # Generate a packing slip for this order for the given distribution center.
177
- data, status_code, headers = api_instance.generate_packing_slip_with_http_info(distribution_center_code, order_id)
178
- p status_code # => 2xx
179
- p headers # => { ... }
180
- p data # => <OrderPackingSlipResponse>
181
- rescue UltracartClient::ApiError => e
182
- puts "Error when calling FulfillmentApi->generate_packing_slip_with_http_info: #{e}"
183
- end
184
- ```
185
-
186
- ### Parameters
187
-
188
- | Name | Type | Description | Notes |
189
- | ---- | ---- | ----------- | ----- |
190
- | **distribution_center_code** | **String** | Distribution center code | |
191
- | **order_id** | **String** | Order ID | |
192
-
193
- ### Return type
194
-
195
- [**OrderPackingSlipResponse**](OrderPackingSlipResponse.md)
196
-
197
- ### Authorization
198
-
199
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
200
-
201
- ### HTTP request headers
202
-
203
- - **Content-Type**: Not defined
204
- - **Accept**: application/json
205
-
206
-
207
- ## get_distribution_center_orders
208
-
209
- > <OrdersResponse> get_distribution_center_orders(distribution_center_code)
210
-
211
- Retrieve orders queued up for this distribution center.
212
-
213
- 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.
214
-
215
-
216
- ### Examples
217
-
218
- ```ruby
219
- require_relative '../constants'
220
- require 'ultracart_api'
221
-
222
- fulfillment_api = UltracartClient::FulfillmentApi.new_using_api_key(Constants::API_KEY)
223
-
224
- # getDistributionCenterOrders accepts a distribution center code and returns back up to 100 orders that need shipping.
225
- # There is NO pagination with this method call. Once you receive the orders, you should insert them into your
226
- # system, and acknowledge them via the acknowledgeOrders call. After you acknowledge the orders, subsequent calls
227
- # to getDistributionCenterOrders will return another batch of 100 orders.
228
- #
229
- # The orders that are returned contain only items for THIS distribution center and are by default completely expanded
230
- # with billing, channel_partner, checkout, coupons, customer_profile, edi, gift, gift_certificate, internal,
231
- # items, payment, shipping, summary, taxes
232
- #
233
- # You will need the distribution center (DC) code. UltraCart allows for multiple DC and the code is a
234
- # unique short string you assign to a DC as an easy mnemonic.
235
- #
236
- # For more information about UltraCart distribution centers, please see:
237
- # https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377114/Distribution+Center
238
- #
239
- # If you do not know your DC code, query a list of all DC and print them out.
240
- # result = fulfillment_api.get_distribution_centers
241
- # puts result.inspect
242
-
243
- begin
244
- acknowledged_orders = []
245
- distribution_center_code = 'RAMI'
246
- result = fulfillment_api.get_distribution_center_orders(distribution_center_code)
247
- orders = result.orders
248
- orders.each do |order|
249
- puts order.inspect
250
- # TODO: do something useful with this order, like adding it to your shipping queue.
251
- acknowledged_orders << order.order_id
252
- end
253
-
254
- # TODO: once you've securely and completely received it into your system, acknowledge the order.
255
- fulfillment_api.acknowledge_orders(distribution_center_code, acknowledged_orders)
256
-
257
- # After acknowledging orders, you should call getDistributionCenterOrders again until you receive zero orders to ship.
258
-
259
- puts "done"
260
- rescue UltracartClient::ApiException => e
261
- # update inventory failed. examine the reason.
262
- puts "Exception when calling FulfillmentApi->getDistributionCenterOrders: #{e.message}"
263
- exit
264
- end
265
- ```
266
-
267
-
268
- #### Using the get_distribution_center_orders_with_http_info variant
269
-
270
- This returns an Array which contains the response data, status code and headers.
271
-
272
- > <Array(<OrdersResponse>, Integer, Hash)> get_distribution_center_orders_with_http_info(distribution_center_code)
273
-
274
- ```ruby
275
- begin
276
- # Retrieve orders queued up for this distribution center.
277
- data, status_code, headers = api_instance.get_distribution_center_orders_with_http_info(distribution_center_code)
278
- p status_code # => 2xx
279
- p headers # => { ... }
280
- p data # => <OrdersResponse>
281
- rescue UltracartClient::ApiError => e
282
- puts "Error when calling FulfillmentApi->get_distribution_center_orders_with_http_info: #{e}"
283
- end
284
- ```
285
-
286
- ### Parameters
287
-
288
- | Name | Type | Description | Notes |
289
- | ---- | ---- | ----------- | ----- |
290
- | **distribution_center_code** | **String** | Distribution center code | |
291
-
292
- ### Return type
293
-
294
- [**OrdersResponse**](OrdersResponse.md)
295
-
296
- ### Authorization
297
-
298
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
299
-
300
- ### HTTP request headers
301
-
302
- - **Content-Type**: Not defined
303
- - **Accept**: application/json
304
-
305
-
306
- ## get_distribution_centers
307
-
308
- > <DistributionCentersResponse> get_distribution_centers
309
-
310
- Retrieve distribution centers
311
-
312
- Retrieves the distribution centers that this user has access to.
313
-
314
-
315
- ### Examples
316
-
317
- ```ruby
318
- require_relative '../constants'
319
- require 'ultracart_api'
320
-
321
- fulfillment_api = UltracartClient::FulfillmentApi.new_using_api_key(Constants::API_KEY)
322
-
323
- # This method returns back a list of all distribution centers configured for a merchant.
324
- #
325
- # You will need the distribution center (DC) code for most operations.
326
- # UltraCart allows for multiple DC and the code is a unique short string you assign to a DC as an easy mnemonic.
327
- # This method call is an easy way to determine what a DC code is for a particular distribution center.
328
- #
329
- # For more information about UltraCart distribution centers, please see:
330
- # https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377114/Distribution+Center
331
-
332
- begin
333
- result = fulfillment_api.get_distribution_centers
334
- puts result.inspect
335
-
336
- puts "done"
337
- rescue UltracartClient::ApiException => e
338
- # update inventory failed. examine the reason.
339
- puts "Exception when calling FulfillmentApi->getDistributionCenters: #{e.message}"
340
- exit
341
- end
342
- ```
343
-
344
-
345
- #### Using the get_distribution_centers_with_http_info variant
346
-
347
- This returns an Array which contains the response data, status code and headers.
348
-
349
- > <Array(<DistributionCentersResponse>, Integer, Hash)> get_distribution_centers_with_http_info
350
-
351
- ```ruby
352
- begin
353
- # Retrieve distribution centers
354
- data, status_code, headers = api_instance.get_distribution_centers_with_http_info
355
- p status_code # => 2xx
356
- p headers # => { ... }
357
- p data # => <DistributionCentersResponse>
358
- rescue UltracartClient::ApiError => e
359
- puts "Error when calling FulfillmentApi->get_distribution_centers_with_http_info: #{e}"
360
- end
361
- ```
362
-
363
- ### Parameters
364
-
365
- This endpoint does not need any parameter.
366
-
367
- ### Return type
368
-
369
- [**DistributionCentersResponse**](DistributionCentersResponse.md)
370
-
371
- ### Authorization
372
-
373
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
374
-
375
- ### HTTP request headers
376
-
377
- - **Content-Type**: Not defined
378
- - **Accept**: application/json
379
-
380
-
381
- ## ship_orders
382
-
383
- > ship_orders(distribution_center_code, shipments)
384
-
385
- Mark orders as shipped
386
-
387
- Store the tracking information and mark the order shipped for this distribution center.
388
-
389
-
390
- ### Examples
391
-
392
- ```ruby
393
- require_relative '../constants'
394
- require 'ultracart_api'
395
-
396
- fulfillment_api = UltracartClient::FulfillmentApi.new_using_api_key(Constants::API_KEY)
397
-
398
- # shipOrders informs UltraCart that you (the fulfillment center) have shipped an order and allows you to provide
399
- # UltraCart with tracking information.
400
- #
401
- # You will need the distribution center (DC) code. UltraCart allows for multiple DC and the code is a
402
- # unique short string you assign to a DC as an easy mnemonic.
403
- #
404
- # For more information about UltraCart distribution centers, please see:
405
- # https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377114/Distribution+Center
406
- #
407
- # If you do not know your DC code, query a list of all DC and print them out.
408
- # result = fulfillment_api.get_distribution_centers
409
- # puts result.inspect
410
- #
411
- # A successful call will receive back a status code 204 (No Content).
412
- #
413
- # Possible Errors:
414
- # More than 100 order ids provided -> "shipments can not contain more than 100 records at a time"
415
-
416
- distribution_center_code = 'RAMI'
417
- shipment = UltracartClient::FulfillmentShipment.new
418
- shipment.order_id = 'DEMO-12345'
419
- shipment.tracking_numbers = ['UPS-1234567890', 'USPS-BLAH-BLAH-BLAH'] # this order had two boxes.
420
- shipment.shipping_cost = 16.99 # the actual cost to ship this order
421
- shipment.fulfillment_fee = 8.99 # this fulfillment center is kinda pricey.
422
- shipment.package_cost = 11.99 # 11.99? we use only the finest packaging.
423
-
424
- shipments = [shipment] # up to 100 shipments per call
425
-
426
- begin
427
- # limit is 100 shipments updates at a time.
428
- fulfillment_api.ship_orders(distribution_center_code, shipments)
429
- puts "done"
430
- rescue UltracartClient::ApiException => e
431
- # update inventory failed. examine the reason.
432
- puts "Exception when calling FulfillmentApi->shipOrders: #{e.message}"
433
- exit
434
- end
435
- ```
436
-
437
-
438
- #### Using the ship_orders_with_http_info variant
439
-
440
- This returns an Array which contains the response data (`nil` in this case), status code and headers.
441
-
442
- > <Array(nil, Integer, Hash)> ship_orders_with_http_info(distribution_center_code, shipments)
443
-
444
- ```ruby
445
- begin
446
- # Mark orders as shipped
447
- data, status_code, headers = api_instance.ship_orders_with_http_info(distribution_center_code, shipments)
448
- p status_code # => 2xx
449
- p headers # => { ... }
450
- p data # => nil
451
- rescue UltracartClient::ApiError => e
452
- puts "Error when calling FulfillmentApi->ship_orders_with_http_info: #{e}"
453
- end
454
- ```
455
-
456
- ### Parameters
457
-
458
- | Name | Type | Description | Notes |
459
- | ---- | ---- | ----------- | ----- |
460
- | **distribution_center_code** | **String** | Distribution center code | |
461
- | **shipments** | [**Array&lt;FulfillmentShipment&gt;**](FulfillmentShipment.md) | Orders to mark shipped | |
462
-
463
- ### Return type
464
-
465
- nil (empty response body)
466
-
467
- ### Authorization
468
-
469
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
470
-
471
- ### HTTP request headers
472
-
473
- - **Content-Type**: application/json
474
- - **Accept**: application/json
475
-
476
-
477
- ## update_inventory
478
-
479
- > update_inventory(distribution_center_code, inventories)
480
-
481
- Update inventory
482
-
483
- Update the inventory for items associated with this distribution center
484
-
485
-
486
- ### Examples
487
-
488
- ```ruby
489
- require_relative '../constants'
490
- require 'ultracart_api'
491
-
492
- fulfillment_api = UltracartClient::FulfillmentApi.new_using_api_key(Constants::API_KEY)
493
-
494
- # updateInventory is a simple means of updating UltraCart inventory for one or more items (500 max per call)
495
- # You will need the distribution center (DC) code. UltraCart allows for multiple DC and the code is a
496
- # unique short string you assign to a DC as an easy mnemonic.
497
- #
498
- # For more information about UltraCart distribution centers, please see:
499
- # https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377114/Distribution+Center
500
- #
501
- # If you do not know your DC code, query a list of all DC and print them out.
502
- # result = fulfillment_api.get_distribution_centers
503
- # puts result.inspect
504
- #
505
- # Possible Errors:
506
- # More than 500 items provided -> "inventories can not contain more than 500 records at a time"
507
-
508
- distribution_center_code = 'RAMI'
509
- sku = '9780982021361'
510
- quantity = 9
511
- first_inventory = UltracartClient::FulfillmentInventory.new
512
- first_inventory.item_id = sku
513
- first_inventory.quantity = quantity
514
- inventory_updates = [first_inventory] # for this example, we're only updating one item.
515
-
516
- puts inventory_updates.inspect
517
-
518
- begin
519
- # limit is 500 inventory updates at a time. batch them if you're going large.
520
- fulfillment_api.update_inventory(distribution_center_code, inventory_updates)
521
- puts "done"
522
- rescue UltracartClient::ApiException => e
523
- # update inventory failed. examine the reason.
524
- puts "Exception when calling FulfillmentApi->updateInventory: #{e.message}"
525
- exit
526
- end
527
- ```
528
-
529
-
530
- #### Using the update_inventory_with_http_info variant
531
-
532
- This returns an Array which contains the response data (`nil` in this case), status code and headers.
533
-
534
- > <Array(nil, Integer, Hash)> update_inventory_with_http_info(distribution_center_code, inventories)
535
-
536
- ```ruby
537
- begin
538
- # Update inventory
539
- data, status_code, headers = api_instance.update_inventory_with_http_info(distribution_center_code, inventories)
540
- p status_code # => 2xx
541
- p headers # => { ... }
542
- p data # => nil
543
- rescue UltracartClient::ApiError => e
544
- puts "Error when calling FulfillmentApi->update_inventory_with_http_info: #{e}"
545
- end
546
- ```
547
-
548
- ### Parameters
549
-
550
- | Name | Type | Description | Notes |
551
- | ---- | ---- | ----------- | ----- |
552
- | **distribution_center_code** | **String** | Distribution center code | |
553
- | **inventories** | [**Array&lt;FulfillmentInventory&gt;**](FulfillmentInventory.md) | Inventory updates (limit 500) | |
554
-
555
- ### Return type
556
-
557
- nil (empty response body)
558
-
559
- ### Authorization
560
-
561
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
562
-
563
- ### HTTP request headers
564
-
565
- - **Content-Type**: application/json
566
- - **Accept**: application/json
567
-
1
+ # UltracartClient::FulfillmentApi
2
+
3
+ All URIs are relative to *https://secure.ultracart.com/rest/v2*
4
+
5
+ | Method | HTTP request | Description |
6
+ | ------ | ------------ | ----------- |
7
+ | [**acknowledge_orders**](FulfillmentApi.md#acknowledge_orders) | **PUT** /fulfillment/distribution_centers/{distribution_center_code}/acknowledgements | Acknowledge receipt of orders. |
8
+ | [**generate_packing_slip**](FulfillmentApi.md#generate_packing_slip) | **GET** /fulfillment/distribution_centers/{distribution_center_code}/orders/{order_id} | Generate a packing slip for this order for the given distribution center. |
9
+ | [**get_distribution_center_orders**](FulfillmentApi.md#get_distribution_center_orders) | **GET** /fulfillment/distribution_centers/{distribution_center_code}/orders | Retrieve orders queued up for this distribution center. |
10
+ | [**get_distribution_centers**](FulfillmentApi.md#get_distribution_centers) | **GET** /fulfillment/distribution_centers | Retrieve distribution centers |
11
+ | [**ship_orders**](FulfillmentApi.md#ship_orders) | **POST** /fulfillment/distribution_centers/{distribution_center_code}/shipments | Mark orders as shipped |
12
+ | [**update_inventory**](FulfillmentApi.md#update_inventory) | **POST** /fulfillment/distribution_centers/{distribution_center_code}/inventory | Update inventory |
13
+
14
+
15
+ ## acknowledge_orders
16
+
17
+ > acknowledge_orders(distribution_center_code, order_ids)
18
+
19
+ Acknowledge receipt of orders.
20
+
21
+ 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).
22
+
23
+
24
+ ### Examples
25
+
26
+ ```ruby
27
+ require 'ultracart_api'
28
+ require_relative '../constants'
29
+
30
+ =begin
31
+ acknowledgeOrders informs UltraCart that you (the fulfillment center) have received an order and have queued it for
32
+ shipping. This method is NOT used to notify an order has shipped, only that it is going to be shipped at some
33
+ point in the future.
34
+
35
+ This method should be called by a fulfillment center after receiving an order either by 1) getDistributionCenterOrders
36
+ or 2) webhook. Webhooks are the most efficient means for receiving orders, but if your fulfillment center lacks
37
+ the ability to consume webhooks, polling by getDistributionCenterOrders is an alternate means.
38
+
39
+ This method is important for notifying UltraCart that a fulfillment center has the action on an order. Until this
40
+ call is made, UltraCart will continue to notify a fulfillment center of an order either by 1) subsequent webhooks or
41
+ 2) continue to include an order in subsequent getDistributionCenterOrders.
42
+
43
+ You will need the distribution center (DC) code. UltraCart allows for multiple DC and the code is a
44
+ unique short string you assign to a DC as an easy mnemonic.
45
+
46
+ For more information about UltraCart distribution centers, please see:
47
+ https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377114/Distribution+Center
48
+
49
+ If you do not know your DC code, query a list of all DC and print them out.
50
+ result = fulfillment_api.get_distribution_centers
51
+ puts result.inspect
52
+
53
+ A successful call will receive back a status code 204 (No Content).
54
+
55
+ Possible Errors:
56
+ More than 100 order ids provided -> "order_ids can not contain more than 100 records at a time"
57
+ =end
58
+
59
+ distribution_center_code = 'RAMI'
60
+ fulfillment_api = UltracartClient::FulfillmentApi.new_using_api_key(Constants::API_KEY)
61
+
62
+ orders_ids = ['DEMO-12345', 'DEMO-12346', 'DEMO-12347', 'DEMO-12348', 'DEMO-12349']
63
+
64
+ begin
65
+ # limit is 100 acknowledgements at a time.
66
+ fulfillment_api.acknowledge_orders(distribution_center_code, orders_ids)
67
+ puts "done"
68
+ rescue UltracartClient::ApiError => e
69
+ # update inventory failed. examine the reason.
70
+ puts "Exception when calling FulfillmentApi->acknowledge_orders: #{e.message}"
71
+ exit
72
+ end
73
+ ```
74
+
75
+
76
+ #### Using the acknowledge_orders_with_http_info variant
77
+
78
+ This returns an Array which contains the response data (`nil` in this case), status code and headers.
79
+
80
+ > <Array(nil, Integer, Hash)> acknowledge_orders_with_http_info(distribution_center_code, order_ids)
81
+
82
+ ```ruby
83
+ begin
84
+ # Acknowledge receipt of orders.
85
+ data, status_code, headers = api_instance.acknowledge_orders_with_http_info(distribution_center_code, order_ids)
86
+ p status_code # => 2xx
87
+ p headers # => { ... }
88
+ p data # => nil
89
+ rescue UltracartClient::ApiError => e
90
+ puts "Error when calling FulfillmentApi->acknowledge_orders_with_http_info: #{e}"
91
+ end
92
+ ```
93
+
94
+ ### Parameters
95
+
96
+ | Name | Type | Description | Notes |
97
+ | ---- | ---- | ----------- | ----- |
98
+ | **distribution_center_code** | **String** | Distribution center code | |
99
+ | **order_ids** | [**Array&lt;String&gt;**](String.md) | Orders to acknowledge receipt of (limit 100) | |
100
+
101
+ ### Return type
102
+
103
+ nil (empty response body)
104
+
105
+ ### Authorization
106
+
107
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
108
+
109
+ ### HTTP request headers
110
+
111
+ - **Content-Type**: application/json
112
+ - **Accept**: application/json
113
+
114
+
115
+ ## generate_packing_slip
116
+
117
+ > <OrderPackingSlipResponse> generate_packing_slip(distribution_center_code, order_id)
118
+
119
+ Generate a packing slip for this order for the given distribution center.
120
+
121
+ The packing slip PDF that is returned is base 64 encoded
122
+
123
+
124
+ ### Examples
125
+
126
+ ```ruby
127
+ require 'ultracart_api'
128
+ require_relative '../constants'
129
+ require 'base64'
130
+
131
+ =begin
132
+ generatePackingSlip accepts a distribution center code and order_id and returns back a base64 encoded byte array pdf.
133
+ Both the dc code and order_id are needed because an order may have multiple items shipping via different DCs.
134
+
135
+ You will need the distribution center (DC) code. UltraCart allows for multiple DC and the code is a
136
+ unique short string you assign to a DC as an easy mnemonic.
137
+
138
+ For more information about UltraCart distribution centers, please see:
139
+ https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377114/Distribution+Center
140
+
141
+ If you do not know your DC code, query a list of all DC and print them out.
142
+ result = fulfillment_api.get_distribution_centers
143
+ puts result.inspect
144
+
145
+ =end
146
+
147
+ fulfillment_api = UltracartClient::FulfillmentApi.new_using_api_key(Constants::API_KEY)
148
+
149
+ distribution_center_code = 'RAMI'
150
+ orders_id = 'DEMO-12345'
151
+
152
+ begin
153
+ # limit is 500 inventory updates at a time. batch them if you're going large.
154
+ api_response = fulfillment_api.generate_packing_slip(distribution_center_code, orders_id)
155
+ base64_pdf = api_response.pdf_base64
156
+ decoded_pdf = Base64.decode64(base64_pdf)
157
+ File.write('packing_slip.pdf', decoded_pdf)
158
+
159
+ puts "done"
160
+ rescue UltracartClient::ApiError => e
161
+ # update inventory failed. examine the reason.
162
+ puts "Exception when calling FulfillmentApi->generate_packing_slip: #{e.message}"
163
+ exit
164
+ end
165
+ ```
166
+
167
+
168
+ #### Using the generate_packing_slip_with_http_info variant
169
+
170
+ This returns an Array which contains the response data, status code and headers.
171
+
172
+ > <Array(<OrderPackingSlipResponse>, Integer, Hash)> generate_packing_slip_with_http_info(distribution_center_code, order_id)
173
+
174
+ ```ruby
175
+ begin
176
+ # Generate a packing slip for this order for the given distribution center.
177
+ data, status_code, headers = api_instance.generate_packing_slip_with_http_info(distribution_center_code, order_id)
178
+ p status_code # => 2xx
179
+ p headers # => { ... }
180
+ p data # => <OrderPackingSlipResponse>
181
+ rescue UltracartClient::ApiError => e
182
+ puts "Error when calling FulfillmentApi->generate_packing_slip_with_http_info: #{e}"
183
+ end
184
+ ```
185
+
186
+ ### Parameters
187
+
188
+ | Name | Type | Description | Notes |
189
+ | ---- | ---- | ----------- | ----- |
190
+ | **distribution_center_code** | **String** | Distribution center code | |
191
+ | **order_id** | **String** | Order ID | |
192
+
193
+ ### Return type
194
+
195
+ [**OrderPackingSlipResponse**](OrderPackingSlipResponse.md)
196
+
197
+ ### Authorization
198
+
199
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
200
+
201
+ ### HTTP request headers
202
+
203
+ - **Content-Type**: Not defined
204
+ - **Accept**: application/json
205
+
206
+
207
+ ## get_distribution_center_orders
208
+
209
+ > <OrdersResponse> get_distribution_center_orders(distribution_center_code)
210
+
211
+ Retrieve orders queued up for this distribution center.
212
+
213
+ 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.
214
+
215
+
216
+ ### Examples
217
+
218
+ ```ruby
219
+ require_relative '../constants'
220
+ require 'ultracart_api'
221
+
222
+ fulfillment_api = UltracartClient::FulfillmentApi.new_using_api_key(Constants::API_KEY)
223
+
224
+ # getDistributionCenterOrders accepts a distribution center code and returns back up to 100 orders that need shipping.
225
+ # There is NO pagination with this method call. Once you receive the orders, you should insert them into your
226
+ # system, and acknowledge them via the acknowledgeOrders call. After you acknowledge the orders, subsequent calls
227
+ # to getDistributionCenterOrders will return another batch of 100 orders.
228
+ #
229
+ # The orders that are returned contain only items for THIS distribution center and are by default completely expanded
230
+ # with billing, channel_partner, checkout, coupons, customer_profile, edi, gift, gift_certificate, internal,
231
+ # items, payment, shipping, summary, taxes
232
+ #
233
+ # You will need the distribution center (DC) code. UltraCart allows for multiple DC and the code is a
234
+ # unique short string you assign to a DC as an easy mnemonic.
235
+ #
236
+ # For more information about UltraCart distribution centers, please see:
237
+ # https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377114/Distribution+Center
238
+ #
239
+ # If you do not know your DC code, query a list of all DC and print them out.
240
+ # result = fulfillment_api.get_distribution_centers
241
+ # puts result.inspect
242
+
243
+ begin
244
+ acknowledged_orders = []
245
+ distribution_center_code = 'RAMI'
246
+ result = fulfillment_api.get_distribution_center_orders(distribution_center_code)
247
+ orders = result.orders
248
+ orders.each do |order|
249
+ puts order.inspect
250
+ # TODO: do something useful with this order, like adding it to your shipping queue.
251
+ acknowledged_orders << order.order_id
252
+ end
253
+
254
+ # TODO: once you've securely and completely received it into your system, acknowledge the order.
255
+ fulfillment_api.acknowledge_orders(distribution_center_code, acknowledged_orders)
256
+
257
+ # After acknowledging orders, you should call getDistributionCenterOrders again until you receive zero orders to ship.
258
+
259
+ puts "done"
260
+ rescue UltracartClient::ApiException => e
261
+ # update inventory failed. examine the reason.
262
+ puts "Exception when calling FulfillmentApi->getDistributionCenterOrders: #{e.message}"
263
+ exit
264
+ end
265
+ ```
266
+
267
+
268
+ #### Using the get_distribution_center_orders_with_http_info variant
269
+
270
+ This returns an Array which contains the response data, status code and headers.
271
+
272
+ > <Array(<OrdersResponse>, Integer, Hash)> get_distribution_center_orders_with_http_info(distribution_center_code)
273
+
274
+ ```ruby
275
+ begin
276
+ # Retrieve orders queued up for this distribution center.
277
+ data, status_code, headers = api_instance.get_distribution_center_orders_with_http_info(distribution_center_code)
278
+ p status_code # => 2xx
279
+ p headers # => { ... }
280
+ p data # => <OrdersResponse>
281
+ rescue UltracartClient::ApiError => e
282
+ puts "Error when calling FulfillmentApi->get_distribution_center_orders_with_http_info: #{e}"
283
+ end
284
+ ```
285
+
286
+ ### Parameters
287
+
288
+ | Name | Type | Description | Notes |
289
+ | ---- | ---- | ----------- | ----- |
290
+ | **distribution_center_code** | **String** | Distribution center code | |
291
+
292
+ ### Return type
293
+
294
+ [**OrdersResponse**](OrdersResponse.md)
295
+
296
+ ### Authorization
297
+
298
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
299
+
300
+ ### HTTP request headers
301
+
302
+ - **Content-Type**: Not defined
303
+ - **Accept**: application/json
304
+
305
+
306
+ ## get_distribution_centers
307
+
308
+ > <DistributionCentersResponse> get_distribution_centers
309
+
310
+ Retrieve distribution centers
311
+
312
+ Retrieves the distribution centers that this user has access to.
313
+
314
+
315
+ ### Examples
316
+
317
+ ```ruby
318
+ require_relative '../constants'
319
+ require 'ultracart_api'
320
+
321
+ fulfillment_api = UltracartClient::FulfillmentApi.new_using_api_key(Constants::API_KEY)
322
+
323
+ # This method returns back a list of all distribution centers configured for a merchant.
324
+ #
325
+ # You will need the distribution center (DC) code for most operations.
326
+ # UltraCart allows for multiple DC and the code is a unique short string you assign to a DC as an easy mnemonic.
327
+ # This method call is an easy way to determine what a DC code is for a particular distribution center.
328
+ #
329
+ # For more information about UltraCart distribution centers, please see:
330
+ # https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377114/Distribution+Center
331
+
332
+ begin
333
+ result = fulfillment_api.get_distribution_centers
334
+ puts result.inspect
335
+
336
+ puts "done"
337
+ rescue UltracartClient::ApiException => e
338
+ # update inventory failed. examine the reason.
339
+ puts "Exception when calling FulfillmentApi->getDistributionCenters: #{e.message}"
340
+ exit
341
+ end
342
+ ```
343
+
344
+
345
+ #### Using the get_distribution_centers_with_http_info variant
346
+
347
+ This returns an Array which contains the response data, status code and headers.
348
+
349
+ > <Array(<DistributionCentersResponse>, Integer, Hash)> get_distribution_centers_with_http_info
350
+
351
+ ```ruby
352
+ begin
353
+ # Retrieve distribution centers
354
+ data, status_code, headers = api_instance.get_distribution_centers_with_http_info
355
+ p status_code # => 2xx
356
+ p headers # => { ... }
357
+ p data # => <DistributionCentersResponse>
358
+ rescue UltracartClient::ApiError => e
359
+ puts "Error when calling FulfillmentApi->get_distribution_centers_with_http_info: #{e}"
360
+ end
361
+ ```
362
+
363
+ ### Parameters
364
+
365
+ This endpoint does not need any parameter.
366
+
367
+ ### Return type
368
+
369
+ [**DistributionCentersResponse**](DistributionCentersResponse.md)
370
+
371
+ ### Authorization
372
+
373
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
374
+
375
+ ### HTTP request headers
376
+
377
+ - **Content-Type**: Not defined
378
+ - **Accept**: application/json
379
+
380
+
381
+ ## ship_orders
382
+
383
+ > ship_orders(distribution_center_code, shipments)
384
+
385
+ Mark orders as shipped
386
+
387
+ Store the tracking information and mark the order shipped for this distribution center.
388
+
389
+
390
+ ### Examples
391
+
392
+ ```ruby
393
+ require_relative '../constants'
394
+ require 'ultracart_api'
395
+
396
+ fulfillment_api = UltracartClient::FulfillmentApi.new_using_api_key(Constants::API_KEY)
397
+
398
+ # shipOrders informs UltraCart that you (the fulfillment center) have shipped an order and allows you to provide
399
+ # UltraCart with tracking information.
400
+ #
401
+ # You will need the distribution center (DC) code. UltraCart allows for multiple DC and the code is a
402
+ # unique short string you assign to a DC as an easy mnemonic.
403
+ #
404
+ # For more information about UltraCart distribution centers, please see:
405
+ # https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377114/Distribution+Center
406
+ #
407
+ # If you do not know your DC code, query a list of all DC and print them out.
408
+ # result = fulfillment_api.get_distribution_centers
409
+ # puts result.inspect
410
+ #
411
+ # A successful call will receive back a status code 204 (No Content).
412
+ #
413
+ # Possible Errors:
414
+ # More than 100 order ids provided -> "shipments can not contain more than 100 records at a time"
415
+
416
+ distribution_center_code = 'RAMI'
417
+ shipment = UltracartClient::FulfillmentShipment.new
418
+ shipment.order_id = 'DEMO-12345'
419
+ shipment.tracking_numbers = ['UPS-1234567890', 'USPS-BLAH-BLAH-BLAH'] # this order had two boxes.
420
+ shipment.shipping_cost = 16.99 # the actual cost to ship this order
421
+ shipment.fulfillment_fee = 8.99 # this fulfillment center is kinda pricey.
422
+ shipment.package_cost = 11.99 # 11.99? we use only the finest packaging.
423
+
424
+ shipments = [shipment] # up to 100 shipments per call
425
+
426
+ begin
427
+ # limit is 100 shipments updates at a time.
428
+ fulfillment_api.ship_orders(distribution_center_code, shipments)
429
+ puts "done"
430
+ rescue UltracartClient::ApiException => e
431
+ # update inventory failed. examine the reason.
432
+ puts "Exception when calling FulfillmentApi->shipOrders: #{e.message}"
433
+ exit
434
+ end
435
+ ```
436
+
437
+
438
+ #### Using the ship_orders_with_http_info variant
439
+
440
+ This returns an Array which contains the response data (`nil` in this case), status code and headers.
441
+
442
+ > <Array(nil, Integer, Hash)> ship_orders_with_http_info(distribution_center_code, shipments)
443
+
444
+ ```ruby
445
+ begin
446
+ # Mark orders as shipped
447
+ data, status_code, headers = api_instance.ship_orders_with_http_info(distribution_center_code, shipments)
448
+ p status_code # => 2xx
449
+ p headers # => { ... }
450
+ p data # => nil
451
+ rescue UltracartClient::ApiError => e
452
+ puts "Error when calling FulfillmentApi->ship_orders_with_http_info: #{e}"
453
+ end
454
+ ```
455
+
456
+ ### Parameters
457
+
458
+ | Name | Type | Description | Notes |
459
+ | ---- | ---- | ----------- | ----- |
460
+ | **distribution_center_code** | **String** | Distribution center code | |
461
+ | **shipments** | [**Array&lt;FulfillmentShipment&gt;**](FulfillmentShipment.md) | Orders to mark shipped | |
462
+
463
+ ### Return type
464
+
465
+ nil (empty response body)
466
+
467
+ ### Authorization
468
+
469
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
470
+
471
+ ### HTTP request headers
472
+
473
+ - **Content-Type**: application/json
474
+ - **Accept**: application/json
475
+
476
+
477
+ ## update_inventory
478
+
479
+ > update_inventory(distribution_center_code, inventories)
480
+
481
+ Update inventory
482
+
483
+ Update the inventory for items associated with this distribution center
484
+
485
+
486
+ ### Examples
487
+
488
+ ```ruby
489
+ require_relative '../constants'
490
+ require 'ultracart_api'
491
+
492
+ fulfillment_api = UltracartClient::FulfillmentApi.new_using_api_key(Constants::API_KEY)
493
+
494
+ # updateInventory is a simple means of updating UltraCart inventory for one or more items (500 max per call)
495
+ # You will need the distribution center (DC) code. UltraCart allows for multiple DC and the code is a
496
+ # unique short string you assign to a DC as an easy mnemonic.
497
+ #
498
+ # For more information about UltraCart distribution centers, please see:
499
+ # https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377114/Distribution+Center
500
+ #
501
+ # If you do not know your DC code, query a list of all DC and print them out.
502
+ # result = fulfillment_api.get_distribution_centers
503
+ # puts result.inspect
504
+ #
505
+ # Possible Errors:
506
+ # More than 500 items provided -> "inventories can not contain more than 500 records at a time"
507
+
508
+ distribution_center_code = 'RAMI'
509
+ sku = '9780982021361'
510
+ quantity = 9
511
+ first_inventory = UltracartClient::FulfillmentInventory.new
512
+ first_inventory.item_id = sku
513
+ first_inventory.quantity = quantity
514
+ inventory_updates = [first_inventory] # for this example, we're only updating one item.
515
+
516
+ puts inventory_updates.inspect
517
+
518
+ begin
519
+ # limit is 500 inventory updates at a time. batch them if you're going large.
520
+ fulfillment_api.update_inventory(distribution_center_code, inventory_updates)
521
+ puts "done"
522
+ rescue UltracartClient::ApiException => e
523
+ # update inventory failed. examine the reason.
524
+ puts "Exception when calling FulfillmentApi->updateInventory: #{e.message}"
525
+ exit
526
+ end
527
+ ```
528
+
529
+
530
+ #### Using the update_inventory_with_http_info variant
531
+
532
+ This returns an Array which contains the response data (`nil` in this case), status code and headers.
533
+
534
+ > <Array(nil, Integer, Hash)> update_inventory_with_http_info(distribution_center_code, inventories)
535
+
536
+ ```ruby
537
+ begin
538
+ # Update inventory
539
+ data, status_code, headers = api_instance.update_inventory_with_http_info(distribution_center_code, inventories)
540
+ p status_code # => 2xx
541
+ p headers # => { ... }
542
+ p data # => nil
543
+ rescue UltracartClient::ApiError => e
544
+ puts "Error when calling FulfillmentApi->update_inventory_with_http_info: #{e}"
545
+ end
546
+ ```
547
+
548
+ ### Parameters
549
+
550
+ | Name | Type | Description | Notes |
551
+ | ---- | ---- | ----------- | ----- |
552
+ | **distribution_center_code** | **String** | Distribution center code | |
553
+ | **inventories** | [**Array&lt;FulfillmentInventory&gt;**](FulfillmentInventory.md) | Inventory updates (limit 500) | |
554
+
555
+ ### Return type
556
+
557
+ nil (empty response body)
558
+
559
+ ### Authorization
560
+
561
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
562
+
563
+ ### HTTP request headers
564
+
565
+ - **Content-Type**: application/json
566
+ - **Accept**: application/json
567
+