aftership-tracking-sdk 7.0.0

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.
Files changed (76) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +11 -0
  3. data/LICENSE +21 -0
  4. data/README.md +285 -0
  5. data/aftership-tracking-sdk.gemspec +27 -0
  6. data/lib/aftership-tracking-sdk/api/courier.rb +163 -0
  7. data/lib/aftership-tracking-sdk/api/estimated_delivery_date.rb +67 -0
  8. data/lib/aftership-tracking-sdk/api/last_checkpoint.rb +143 -0
  9. data/lib/aftership-tracking-sdk/api/notification.rb +403 -0
  10. data/lib/aftership-tracking-sdk/api/tracking.rb +793 -0
  11. data/lib/aftership-tracking-sdk/api_client.rb +426 -0
  12. data/lib/aftership-tracking-sdk/configuration.rb +122 -0
  13. data/lib/aftership-tracking-sdk/error.rb +125 -0
  14. data/lib/aftership-tracking-sdk/models/additional_fields_v1.rb +32 -0
  15. data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_tracking.rb +181 -0
  16. data/lib/aftership-tracking-sdk/models/carbon_emissions_tracking.rb +161 -0
  17. data/lib/aftership-tracking-sdk/models/checkpoint.rb +301 -0
  18. data/lib/aftership-tracking-sdk/models/coordinate_checkpoint.rb +161 -0
  19. data/lib/aftership-tracking-sdk/models/courier.rb +241 -0
  20. data/lib/aftership-tracking-sdk/models/courier_response_v1.rb +161 -0
  21. data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_tracking.rb +181 -0
  22. data/lib/aftership-tracking-sdk/models/custom_fields_tracking_update_tracking_by_slug_tracking_number_request.rb +139 -0
  23. data/lib/aftership-tracking-sdk/models/data_courier_response_v1.rb +161 -0
  24. data/lib/aftership-tracking-sdk/models/data_notification_response_v1.rb +151 -0
  25. data/lib/aftership-tracking-sdk/models/data_tracking_delete_response_v1.rb +151 -0
  26. data/lib/aftership-tracking-sdk/models/data_tracking_response_get_multiple_v1.rb +281 -0
  27. data/lib/aftership-tracking-sdk/models/data_tracking_response_v1.rb +151 -0
  28. data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_request.rb +191 -0
  29. data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_response.rb +191 -0
  30. data/lib/aftership-tracking-sdk/models/detect_courier_response.rb +161 -0
  31. data/lib/aftership-tracking-sdk/models/estimated_delivery_date_request.rb +221 -0
  32. data/lib/aftership-tracking-sdk/models/estimated_delivery_date_response.rb +261 -0
  33. data/lib/aftership-tracking-sdk/models/estimated_pickup_estimated_delivery_date_request.rb +181 -0
  34. data/lib/aftership-tracking-sdk/models/estimated_pickup_estimated_delivery_date_response.rb +191 -0
  35. data/lib/aftership-tracking-sdk/models/events_checkpoint.rb +161 -0
  36. data/lib/aftership-tracking-sdk/models/first_estimated_delivery_tracking.rb +191 -0
  37. data/lib/aftership-tracking-sdk/models/get_all_couriers_response.rb +161 -0
  38. data/lib/aftership-tracking-sdk/models/get_checkpoint_by_slug_tracking_number_response.rb +211 -0
  39. data/lib/aftership-tracking-sdk/models/get_checkpoint_by_tracking_id_response.rb +211 -0
  40. data/lib/aftership-tracking-sdk/models/get_trackings_response.rb +161 -0
  41. data/lib/aftership-tracking-sdk/models/get_user_couriers_response.rb +161 -0
  42. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_tracking.rb +191 -0
  43. data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_request.rb +151 -0
  44. data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_slug_tracking_number_request.rb +151 -0
  45. data/lib/aftership-tracking-sdk/models/meta_v1.rb +171 -0
  46. data/lib/aftership-tracking-sdk/models/next_couriers_tracking.rb +171 -0
  47. data/lib/aftership-tracking-sdk/models/next_couriers_tracking_create_tracking_request.rb +161 -0
  48. data/lib/aftership-tracking-sdk/models/notification.rb +161 -0
  49. data/lib/aftership-tracking-sdk/models/notification_request_v1.rb +161 -0
  50. data/lib/aftership-tracking-sdk/models/notification_response_v1.rb +161 -0
  51. data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_estimated_delivery_date_request.rb +161 -0
  52. data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_estimated_delivery_date_response.rb +161 -0
  53. data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_request.rb +191 -0
  54. data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_response.rb +191 -0
  55. data/lib/aftership-tracking-sdk/models/pagination.rb +156 -0
  56. data/lib/aftership-tracking-sdk/models/partial_delete_tracking.rb +241 -0
  57. data/lib/aftership-tracking-sdk/models/partial_update_tracking.rb +251 -0
  58. data/lib/aftership-tracking-sdk/models/predict_batch_request.rb +151 -0
  59. data/lib/aftership-tracking-sdk/models/predict_batch_response.rb +151 -0
  60. data/lib/aftership-tracking-sdk/models/reason_events_checkpoint.rb +151 -0
  61. data/lib/aftership-tracking-sdk/models/slug_group_v1.rb +37 -0
  62. data/lib/aftership-tracking-sdk/models/tag_v1.rb +34 -0
  63. data/lib/aftership-tracking-sdk/models/tracking.rb +921 -0
  64. data/lib/aftership-tracking-sdk/models/tracking_create_tracking_request.rb +551 -0
  65. data/lib/aftership-tracking-sdk/models/tracking_delete_response_v1.rb +161 -0
  66. data/lib/aftership-tracking-sdk/models/tracking_detect_courier_request.rb +261 -0
  67. data/lib/aftership-tracking-sdk/models/tracking_response_get_multiple_v1.rb +161 -0
  68. data/lib/aftership-tracking-sdk/models/tracking_response_v1.rb +161 -0
  69. data/lib/aftership-tracking-sdk/models/tracking_update_tracking_by_id_request.rb +501 -0
  70. data/lib/aftership-tracking-sdk/models/tracking_update_tracking_by_slug_tracking_number_request.rb +391 -0
  71. data/lib/aftership-tracking-sdk/models/weight_estimated_delivery_date_request.rb +161 -0
  72. data/lib/aftership-tracking-sdk/models/weight_estimated_delivery_date_response.rb +161 -0
  73. data/lib/aftership-tracking-sdk/sign_string.rb +77 -0
  74. data/lib/aftership-tracking-sdk/version.rb +5 -0
  75. data/lib/aftership-tracking-sdk.rb +47 -0
  76. metadata +157 -0
@@ -0,0 +1,551 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class TrackingCreateTrackingRequest
5
+ # Tracking number of a shipment.Duplicated tracking numbers, tracking numbers with invalid tracking number format will not be accepted.We only accept tracking numbers with length from 4 to 100We currently support the following characters in a tracking number:- A - Z- 0 - 9- `-` (Hyphen)- . (Period)- _ (Underscore)- / (Slash)
6
+ # tracking_number: String;
7
+ attr_accessor :tracking_number
8
+
9
+ # Unique courier code. Get courier codes .
10
+ # slug?: String;
11
+ attr_accessor :slug
12
+
13
+ # By default this field shows the `tracking_number`, but you can customize it as you wish with any info (e.g. the order number).
14
+ # title?: String;
15
+ attr_accessor :title
16
+
17
+ # A globally-unique identifier for the order.
18
+ # order_id?: String;
19
+ attr_accessor :order_id
20
+
21
+ # The URL for the order in your system or store.
22
+ # order_id_path?: String;
23
+ attr_accessor :order_id_path
24
+
25
+ # Custom fields that accept an object with string field. In order to protect the privacy of your customers, do not include any
26
+ # custom_fields?: Object;
27
+ attr_accessor :custom_fields
28
+
29
+ # The recipient’s language. If you set up AfterShip notifications in different languages, we use this to send the recipient tracking updates in their preferred language. Use an to specify the language.
30
+ # language?: String;
31
+ attr_accessor :language
32
+
33
+ # The promised delivery date of the order. It uses the format YYYY-MM-DD. This has no timezone and uses whatever date you provide. Since other EDDs use the shipment recipient’s timezone, we suggest following the same logic here.
34
+ # order_promised_delivery_date?: String;
35
+ attr_accessor :order_promised_delivery_date
36
+
37
+ # Shipment delivery type- pickup_at_store- pickup_at_courier- door_to_door
38
+ # delivery_type?: String;
39
+ attr_accessor :delivery_type
40
+
41
+ # Shipment pickup location for receiver
42
+ # pickup_location?: String;
43
+ attr_accessor :pickup_location
44
+
45
+ # Shipment pickup note for receiver
46
+ # pickup_note?: String;
47
+ attr_accessor :pickup_note
48
+
49
+ # Additional field required by some carriers to retrieve the tracking info. The shipper’s carrier account number. Refer to our article on for more details.
50
+ # tracking_account_number?: String;
51
+ attr_accessor :tracking_account_number
52
+
53
+ # Additional field required by some carriers to retrieve the tracking info. A type of tracking credential required by some carriers. Refer to our article on for more details.
54
+ # tracking_key?: String;
55
+ attr_accessor :tracking_key
56
+
57
+ # Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on for more details.
58
+ # tracking_ship_date?: String;
59
+ attr_accessor :tracking_ship_date
60
+
61
+ # Email address(es) to receive email notifications. Accept either array or comma separated as input. Supports up to 3 email addresses.
62
+ # emails?: String[];
63
+ attr_accessor :emails
64
+
65
+ # The phone number(s) to receive sms notifications. Enter `+` andarea `code before` phone number. Accept either array or comma separated as input. Supports up to 3 phone numbers.
66
+ # smses?: String[];
67
+ attr_accessor :smses
68
+
69
+ # Customer name of the tracking.
70
+ # customer_name?: String;
71
+ attr_accessor :customer_name
72
+
73
+ # The for more details.
74
+ # origin_country_iso3?: String;
75
+ attr_accessor :origin_country_iso3
76
+
77
+ # The state of the sender’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc.
78
+ # origin_state?: String;
79
+ attr_accessor :origin_state
80
+
81
+ # The city of the sender’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc.
82
+ # origin_city?: String;
83
+ attr_accessor :origin_city
84
+
85
+ # The postal of the sender’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc.
86
+ # origin_postal_code?: String;
87
+ attr_accessor :origin_postal_code
88
+
89
+ # The sender address that the shipment is shipping from. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc.
90
+ # origin_raw_location?: String;
91
+ attr_accessor :origin_raw_location
92
+
93
+ # The for more details.
94
+ # destination_country_iso3?: String;
95
+ attr_accessor :destination_country_iso3
96
+
97
+ # The state of the recipient’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. Also the additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on for more details.
98
+ # destination_state?: String;
99
+ attr_accessor :destination_state
100
+
101
+ # The city of the recipient’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc.
102
+ # destination_city?: String;
103
+ attr_accessor :destination_city
104
+
105
+ # The postal of the recipient’s address. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc. Also the additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on for more details.
106
+ # destination_postal_code?: String;
107
+ attr_accessor :destination_postal_code
108
+
109
+ # The shipping address that the shipment is shipping to. This can help AfterShip with various functions like tracking, carrier auto-detection and auto-correction, calculating an EDD, etc.
110
+ # destination_raw_location?: String;
111
+ attr_accessor :destination_raw_location
112
+
113
+ # Text field for the note
114
+ # note?: String;
115
+ attr_accessor :note
116
+
117
+ # Slug group is a group of slugs which belong to same courier. For example, when you inpit "fedex-group" as slug_group, AfterShip will detect the tracking with "fedex-uk", "fedex-fims", and other slugs which belong to "fedex". It cannot be used with slug at the same time. (
118
+ # slug_group?: SlugGroupV1;
119
+ attr_accessor :slug_group
120
+
121
+ # Order date in YYYY-MM-DDTHH:mm:ssZ format. e.g. 2021-07-26T11:23:51-05:00
122
+ # order_date?: String;
123
+ attr_accessor :order_date
124
+
125
+ # A unique, human-readable identifier for the order.
126
+ # order_number?: String;
127
+ attr_accessor :order_number
128
+
129
+ # The carrier service type for the shipment. If you provide info for this field, AfterShip will not update it with info from the carrier.
130
+ # shipment_type?: String;
131
+ attr_accessor :shipment_type
132
+
133
+ # Used to add tags to your shipments to help categorize and filter them easily.
134
+ # shipment_tags?: String[];
135
+ attr_accessor :shipment_tags
136
+
137
+ # If you’ve connected multiple accounts for a single carrier on AfterShip, you can now use the courier_connection_id field to tell AfterShip which carrier account you’ve used to handle a shipment so we can track it. (
138
+ # courier_connection_id?: String;
139
+ attr_accessor :courier_connection_id
140
+
141
+ # If a shipment has multiple carriers, you can use the next_couriers field to tell AfterShip who the second carrier is. This is useful if the first carrier does not send us this information.
142
+ # next_couriers?: NextCouriersTrackingCreateTrackingRequest[];
143
+ attr_accessor :next_couriers
144
+
145
+ # (Legacy) Replaced by `origin_country_iso3`. Additional field required by some carriers to retrieve the tracking info. The origin country/region of the shipment. Refer to our article on for more details.
146
+ # tracking_origin_country?: String;
147
+ attr_accessor :tracking_origin_country
148
+
149
+ # (Legacy) Replaced by `destination_country_iso3`. Additional field required by some carriers to retrieve the tracking info. The destination country/region of the shipment. Refer to our article on for more details.
150
+ # tracking_destination_country?: String;
151
+ attr_accessor :tracking_destination_country
152
+
153
+ # (Legacy) Replaced by `destination_postal_code`. Additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on for more details.
154
+ # tracking_postal_code?: String;
155
+ attr_accessor :tracking_postal_code
156
+
157
+ # (Legacy) Replaced by `destination_state`. Additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on for more details.
158
+ # tracking_state?: String;
159
+ attr_accessor :tracking_state
160
+
161
+ # The location_id refers to the place where you fulfilled the items. - If you provide a location_id, the system will automatically use it as the tracking's origin address. However, passing both location_id and any origin address information simultaneously is not allowed.- Please make sure you add your locations .
162
+ # location_id?: String;
163
+ attr_accessor :location_id
164
+
165
+ # The shipping_method string refers to the chosen method for delivering the package. Merchants typically offer various shipping methods to consumers during the checkout process, such as, Local Delivery, Free Express Worldwide Shipping, etc
166
+ # shipping_method?: String;
167
+ attr_accessor :shipping_method
168
+
169
+ # Initializes the object
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ def initialize(attributes = {})
172
+ if (!attributes.is_a?(Hash))
173
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::TrackingCreateTrackingRequest` initialize method"
174
+ end
175
+
176
+ attributes = attributes.each_with_object({}) { |(k, v), h|
177
+ h[k.to_sym] = v
178
+ }
179
+
180
+ if attributes.key?(:'tracking_number')
181
+ self.tracking_number = attributes[:'tracking_number']
182
+ end
183
+
184
+ if attributes.key?(:'slug')
185
+ self.slug = attributes[:'slug']
186
+ end
187
+
188
+ if attributes.key?(:'title')
189
+ self.title = attributes[:'title']
190
+ end
191
+
192
+ if attributes.key?(:'order_id')
193
+ self.order_id = attributes[:'order_id']
194
+ end
195
+
196
+ if attributes.key?(:'order_id_path')
197
+ self.order_id_path = attributes[:'order_id_path']
198
+ end
199
+
200
+ if attributes.key?(:'custom_fields')
201
+ self.custom_fields = attributes[:'custom_fields']
202
+ end
203
+
204
+ if attributes.key?(:'language')
205
+ self.language = attributes[:'language']
206
+ end
207
+
208
+ if attributes.key?(:'order_promised_delivery_date')
209
+ self.order_promised_delivery_date = attributes[:'order_promised_delivery_date']
210
+ end
211
+
212
+ if attributes.key?(:'delivery_type')
213
+ self.delivery_type = attributes[:'delivery_type']
214
+ end
215
+
216
+ if attributes.key?(:'pickup_location')
217
+ self.pickup_location = attributes[:'pickup_location']
218
+ end
219
+
220
+ if attributes.key?(:'pickup_note')
221
+ self.pickup_note = attributes[:'pickup_note']
222
+ end
223
+
224
+ if attributes.key?(:'tracking_account_number')
225
+ self.tracking_account_number = attributes[:'tracking_account_number']
226
+ end
227
+
228
+ if attributes.key?(:'tracking_key')
229
+ self.tracking_key = attributes[:'tracking_key']
230
+ end
231
+
232
+ if attributes.key?(:'tracking_ship_date')
233
+ self.tracking_ship_date = attributes[:'tracking_ship_date']
234
+ end
235
+
236
+ if attributes.key?(:'emails')
237
+ self.emails = attributes[:'emails']
238
+ end
239
+
240
+ if attributes.key?(:'smses')
241
+ self.smses = attributes[:'smses']
242
+ end
243
+
244
+ if attributes.key?(:'customer_name')
245
+ self.customer_name = attributes[:'customer_name']
246
+ end
247
+
248
+ if attributes.key?(:'origin_country_iso3')
249
+ self.origin_country_iso3 = attributes[:'origin_country_iso3']
250
+ end
251
+
252
+ if attributes.key?(:'origin_state')
253
+ self.origin_state = attributes[:'origin_state']
254
+ end
255
+
256
+ if attributes.key?(:'origin_city')
257
+ self.origin_city = attributes[:'origin_city']
258
+ end
259
+
260
+ if attributes.key?(:'origin_postal_code')
261
+ self.origin_postal_code = attributes[:'origin_postal_code']
262
+ end
263
+
264
+ if attributes.key?(:'origin_raw_location')
265
+ self.origin_raw_location = attributes[:'origin_raw_location']
266
+ end
267
+
268
+ if attributes.key?(:'destination_country_iso3')
269
+ self.destination_country_iso3 = attributes[:'destination_country_iso3']
270
+ end
271
+
272
+ if attributes.key?(:'destination_state')
273
+ self.destination_state = attributes[:'destination_state']
274
+ end
275
+
276
+ if attributes.key?(:'destination_city')
277
+ self.destination_city = attributes[:'destination_city']
278
+ end
279
+
280
+ if attributes.key?(:'destination_postal_code')
281
+ self.destination_postal_code = attributes[:'destination_postal_code']
282
+ end
283
+
284
+ if attributes.key?(:'destination_raw_location')
285
+ self.destination_raw_location = attributes[:'destination_raw_location']
286
+ end
287
+
288
+ if attributes.key?(:'note')
289
+ self.note = attributes[:'note']
290
+ end
291
+
292
+ if attributes.key?(:'slug_group')
293
+ self.slug_group = attributes[:'slug_group']
294
+ end
295
+
296
+ if attributes.key?(:'order_date')
297
+ self.order_date = attributes[:'order_date']
298
+ end
299
+
300
+ if attributes.key?(:'order_number')
301
+ self.order_number = attributes[:'order_number']
302
+ end
303
+
304
+ if attributes.key?(:'shipment_type')
305
+ self.shipment_type = attributes[:'shipment_type']
306
+ end
307
+
308
+ if attributes.key?(:'shipment_tags')
309
+ self.shipment_tags = attributes[:'shipment_tags']
310
+ end
311
+
312
+ if attributes.key?(:'courier_connection_id')
313
+ self.courier_connection_id = attributes[:'courier_connection_id']
314
+ end
315
+
316
+ if attributes.key?(:'next_couriers')
317
+ self.next_couriers = attributes[:'next_couriers']
318
+ end
319
+
320
+ if attributes.key?(:'tracking_origin_country')
321
+ self.tracking_origin_country = attributes[:'tracking_origin_country']
322
+ end
323
+
324
+ if attributes.key?(:'tracking_destination_country')
325
+ self.tracking_destination_country = attributes[:'tracking_destination_country']
326
+ end
327
+
328
+ if attributes.key?(:'tracking_postal_code')
329
+ self.tracking_postal_code = attributes[:'tracking_postal_code']
330
+ end
331
+
332
+ if attributes.key?(:'tracking_state')
333
+ self.tracking_state = attributes[:'tracking_state']
334
+ end
335
+
336
+ if attributes.key?(:'location_id')
337
+ self.location_id = attributes[:'location_id']
338
+ end
339
+
340
+ if attributes.key?(:'shipping_method')
341
+ self.shipping_method = attributes[:'shipping_method']
342
+ end
343
+ end
344
+
345
+ # Attribute type mapping.
346
+ def self.openapi_types
347
+ {
348
+ :'tracking_number' => :'String',
349
+ :'slug' => :'String',
350
+ :'title' => :'String',
351
+ :'order_id' => :'String',
352
+ :'order_id_path' => :'String',
353
+ :'custom_fields' => :'Object',
354
+ :'language' => :'String',
355
+ :'order_promised_delivery_date' => :'String',
356
+ :'delivery_type' => :'String',
357
+ :'pickup_location' => :'String',
358
+ :'pickup_note' => :'String',
359
+ :'tracking_account_number' => :'String',
360
+ :'tracking_key' => :'String',
361
+ :'tracking_ship_date' => :'String',
362
+ :'emails' => :'Array<String>',
363
+ :'smses' => :'Array<String>',
364
+ :'customer_name' => :'String',
365
+ :'origin_country_iso3' => :'String',
366
+ :'origin_state' => :'String',
367
+ :'origin_city' => :'String',
368
+ :'origin_postal_code' => :'String',
369
+ :'origin_raw_location' => :'String',
370
+ :'destination_country_iso3' => :'String',
371
+ :'destination_state' => :'String',
372
+ :'destination_city' => :'String',
373
+ :'destination_postal_code' => :'String',
374
+ :'destination_raw_location' => :'String',
375
+ :'note' => :'String',
376
+ :'slug_group' => :'SlugGroupV1',
377
+ :'order_date' => :'String',
378
+ :'order_number' => :'String',
379
+ :'shipment_type' => :'String',
380
+ :'shipment_tags' => :'Array<String>',
381
+ :'courier_connection_id' => :'String',
382
+ :'next_couriers' => :'Array<NextCouriersTrackingCreateTrackingRequest>',
383
+ :'tracking_origin_country' => :'String',
384
+ :'tracking_destination_country' => :'String',
385
+ :'tracking_postal_code' => :'String',
386
+ :'tracking_state' => :'String',
387
+ :'location_id' => :'String',
388
+ :'shipping_method' => :'String',
389
+ }
390
+ end
391
+
392
+ # Attribute mapping from ruby-style variable name to JSON key.
393
+ def self.attribute_map
394
+ {
395
+ :'tracking_number' => :'tracking_number',
396
+ :'slug' => :'slug',
397
+ :'title' => :'title',
398
+ :'order_id' => :'order_id',
399
+ :'order_id_path' => :'order_id_path',
400
+ :'custom_fields' => :'custom_fields',
401
+ :'language' => :'language',
402
+ :'order_promised_delivery_date' => :'order_promised_delivery_date',
403
+ :'delivery_type' => :'delivery_type',
404
+ :'pickup_location' => :'pickup_location',
405
+ :'pickup_note' => :'pickup_note',
406
+ :'tracking_account_number' => :'tracking_account_number',
407
+ :'tracking_key' => :'tracking_key',
408
+ :'tracking_ship_date' => :'tracking_ship_date',
409
+ :'emails' => :'emails',
410
+ :'smses' => :'smses',
411
+ :'customer_name' => :'customer_name',
412
+ :'origin_country_iso3' => :'origin_country_iso3',
413
+ :'origin_state' => :'origin_state',
414
+ :'origin_city' => :'origin_city',
415
+ :'origin_postal_code' => :'origin_postal_code',
416
+ :'origin_raw_location' => :'origin_raw_location',
417
+ :'destination_country_iso3' => :'destination_country_iso3',
418
+ :'destination_state' => :'destination_state',
419
+ :'destination_city' => :'destination_city',
420
+ :'destination_postal_code' => :'destination_postal_code',
421
+ :'destination_raw_location' => :'destination_raw_location',
422
+ :'note' => :'note',
423
+ :'slug_group' => :'slug_group',
424
+ :'order_date' => :'order_date',
425
+ :'order_number' => :'order_number',
426
+ :'shipment_type' => :'shipment_type',
427
+ :'shipment_tags' => :'shipment_tags',
428
+ :'courier_connection_id' => :'courier_connection_id',
429
+ :'next_couriers' => :'next_couriers',
430
+ :'tracking_origin_country' => :'tracking_origin_country',
431
+ :'tracking_destination_country' => :'tracking_destination_country',
432
+ :'tracking_postal_code' => :'tracking_postal_code',
433
+ :'tracking_state' => :'tracking_state',
434
+ :'location_id' => :'location_id',
435
+ :'shipping_method' => :'shipping_method',
436
+ }
437
+ end
438
+
439
+ # Builds the object from hash
440
+ # @param attributes [Hash] Model attributes in the form of hash
441
+ # @return [Object] Returns the model itself
442
+ def self.build_from_hash(attributes)
443
+ return nil unless attributes.is_a?(Hash)
444
+ attributes = attributes.transform_keys(&:to_sym)
445
+ transformed_hash = {}
446
+ openapi_types.each_pair do |key, type|
447
+ if attributes.key?(key) && attributes[key].nil?
448
+ transformed_hash["#{key}"] = nil
449
+ elsif type =~ /\AArray<(.*)>/i
450
+ # check to ensure the input is an array given that the attribute
451
+ # is documented as an array but the input is not
452
+ if attributes[key].is_a?(Array)
453
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
454
+ end
455
+ elsif !attributes[key].nil?
456
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
457
+ end
458
+ end
459
+ new(transformed_hash)
460
+ end
461
+
462
+ # Deserializes the data based on type
463
+ # @param type [String] Data type
464
+ # @param value [String] Value to be deserialized
465
+ # @return [Object] Deserialized data
466
+ def self._deserialize(type, value)
467
+ case type.to_sym
468
+ when :Time
469
+ Time.parse(value)
470
+ when :Date
471
+ Date.parse(value)
472
+ when :String
473
+ value.to_s
474
+ when :Integer
475
+ value.to_i
476
+ when :Float
477
+ value.to_f
478
+ when :Boolean
479
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
480
+ true
481
+ else
482
+ false
483
+ end
484
+ when :Object
485
+ # generic object (usually a Hash), return directly
486
+ value
487
+ when /\AArray<(?<inner_type>.+)>\z/
488
+ inner_type = Regexp.last_match[:inner_type]
489
+ value.map { |v| _deserialize(inner_type, v) }
490
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
491
+ k_type = Regexp.last_match[:k_type]
492
+ v_type = Regexp.last_match[:v_type]
493
+ {}.tap do |hash|
494
+ value.each do |k, v|
495
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
496
+ end
497
+ end
498
+ else # model
499
+ klass = AftershipAPI::Model.const_get(type)
500
+ klass.build_from_hash(value)
501
+ end
502
+ end
503
+
504
+ # Returns the string representation of the object
505
+ # @return [String] String presentation of the object
506
+ def to_s
507
+ to_hash.to_s
508
+ end
509
+
510
+ # to_body is an alias to to_hash (backward compatibility)
511
+ # @return [Hash] Returns the object in the form of hash
512
+ def to_body
513
+ to_hash
514
+ end
515
+
516
+ # Returns the object in the form of hash
517
+ # @return [Hash] Returns the object in the form of hash
518
+ def to_hash
519
+ hash = {}
520
+ self.class.attribute_map.each_pair do |attr, param|
521
+ value = self.send(attr)
522
+ next if value.nil?
523
+
524
+ hash[param] = _to_hash(value)
525
+ end
526
+ hash
527
+ end
528
+
529
+ # Outputs non-array value in the form of hash
530
+ # For object, use to_hash. Otherwise, just return the value
531
+ # @param value [Object] Any valid value
532
+ # @return [Hash] Returns the value in the form of hash
533
+ def _to_hash(value)
534
+ if value.is_a?(Array)
535
+ value.compact.map { |v| _to_hash(v) }
536
+ elsif value.is_a?(Hash)
537
+ {}.tap do |hash|
538
+ value.each { |k, v| hash[k] = _to_hash(v) }
539
+ end
540
+ elsif value.respond_to? :to_hash
541
+ value.to_hash
542
+ else
543
+ value
544
+ end
545
+ end
546
+
547
+ def to_json(*a)
548
+ to_hash.to_json(*a)
549
+ end
550
+ end
551
+ end