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,921 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class Tracking
5
+ # Tracking ID.
6
+ # id?: String;
7
+ attr_accessor :id
8
+
9
+ # The date and time the shipment was imported or added to AfterShip. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0.
10
+ # created_at?: String;
11
+ attr_accessor :created_at
12
+
13
+ # The date and time the shipment was updated. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0.
14
+ # updated_at?: String;
15
+ attr_accessor :updated_at
16
+
17
+ # (Legacy) The date and time the shipment was updated. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0.
18
+ # last_updated_at?: String;
19
+ attr_accessor :last_updated_at
20
+
21
+ # Tracking number.
22
+ # tracking_number?: String;
23
+ attr_accessor :tracking_number
24
+
25
+ # Unique courier code. When importing a shipment with no courier slug and the tracking number can’t be recognized, the courier will be marked as `unrecognized`. Get courier codes .
26
+ # slug?: String;
27
+ attr_accessor :slug
28
+
29
+ # Whether or not AfterShip will continue tracking the shipments. Value is `false` when tag (status) is `Delivered`, `Expired`, or further updates for 30 days since last update.
30
+ # active?: Boolean;
31
+ attr_accessor :active
32
+
33
+ # Custom fields that accept an object with string field. In order to protect the privacy of your customers, do not include any in custom fields.
34
+ # custom_fields?: Object;
35
+ attr_accessor :custom_fields
36
+
37
+ # Customer name of the tracking.
38
+ # customer_name?: String;
39
+ attr_accessor :customer_name
40
+
41
+ # Total transit time in days.- For delivered shipments: Transit time (in days) = Delivered date - Pick-up date- For undelivered shipments: Transit time (in days) = Current date - Pick-up dateValue as `null` for the shipment without pick-up date.
42
+ # transit_time?: Integer;
43
+ attr_accessor :transit_time
44
+
45
+ # The for the origin country/region. E.g. USA for the United States.
46
+ # origin_country_iso3?: String;
47
+ attr_accessor :origin_country_iso3
48
+
49
+ # The state of the sender’s address.
50
+ # origin_state?: String;
51
+ attr_accessor :origin_state
52
+
53
+ # The city of the sender’s address.
54
+ # origin_city?: String;
55
+ attr_accessor :origin_city
56
+
57
+ # The postal code of the sender’s address.
58
+ # origin_postal_code?: String;
59
+ attr_accessor :origin_postal_code
60
+
61
+ # The sender address that the shipment is shipping from.
62
+ # origin_raw_location?: String;
63
+ attr_accessor :origin_raw_location
64
+
65
+ # The for the destination country/region. E.g. USA for the United States.
66
+ # destination_country_iso3?: String;
67
+ attr_accessor :destination_country_iso3
68
+
69
+ # The state of the recipient’s address.
70
+ # destination_state?: String;
71
+ attr_accessor :destination_state
72
+
73
+ # The city of the recipient’s address.
74
+ # destination_city?: String;
75
+ attr_accessor :destination_city
76
+
77
+ # The postal code of the recipient’s address.
78
+ # destination_postal_code?: String;
79
+ attr_accessor :destination_postal_code
80
+
81
+ # The shipping address that the shipment is shipping to.
82
+ # destination_raw_location?: String;
83
+ attr_accessor :destination_raw_location
84
+
85
+ # Destination country/region of the tracking detected from the courier. ISO Alpha-3 (three letters). Value will be `null` if the courier doesn't provide the destination country.
86
+ # courier_destination_country_iso3?: String;
87
+ attr_accessor :courier_destination_country_iso3
88
+
89
+ # Email address(es) to receive email notifications.
90
+ # emails?: String[];
91
+ attr_accessor :emails
92
+
93
+ # The estimated delivery date provided by the carrier. It uses the shipment recipient’s timezone and the format may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ
94
+ # expected_delivery?: String;
95
+ attr_accessor :expected_delivery
96
+
97
+ # Text field for the note.
98
+ # note?: String;
99
+ attr_accessor :note
100
+
101
+ # A globally-unique identifier for the order.
102
+ # order_id?: String;
103
+ attr_accessor :order_id
104
+
105
+ # The URL for the order in your system or store.
106
+ # order_id_path?: String;
107
+ attr_accessor :order_id_path
108
+
109
+ # The date and time the order was created in your system or store. It uses the format: `YYYY-MM-DDTHH:mm:ssZ` based on whichever timezone you provide.
110
+ # order_date?: String;
111
+ attr_accessor :order_date
112
+
113
+ # Number of packages under the tracking.
114
+ # shipment_package_count?: Float;
115
+ attr_accessor :shipment_package_count
116
+
117
+ # The date and time the shipment was picked up by the carrier. It uses the timezone where the pickup occured. The format may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ
118
+ # shipment_pickup_date?: String;
119
+ attr_accessor :shipment_pickup_date
120
+
121
+ # The date and time the shipment was delivered. It uses the shipment recipient’s timezone. The format may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ
122
+ # shipment_delivery_date?: String;
123
+ attr_accessor :shipment_delivery_date
124
+
125
+ # The carrier service type for the shipment.
126
+ # shipment_type?: String;
127
+ attr_accessor :shipment_type
128
+
129
+ # Shipment weight provied by carrier.
130
+ # shipment_weight?: Float;
131
+ attr_accessor :shipment_weight
132
+
133
+ # Weight unit provied by carrier.
134
+ # shipment_weight_unit?: String;
135
+ attr_accessor :shipment_weight_unit
136
+
137
+ # Signed by information for delivered shipment.
138
+ # signed_by?: String;
139
+ attr_accessor :signed_by
140
+
141
+ # The phone number(s) to receive sms notifications. Phone number should begin with `+` and `Area Code` before phone number. Comma separated for multiple values.
142
+ # smses?: String[];
143
+ attr_accessor :smses
144
+
145
+ # Source of how this tracking is added.
146
+ # source?: String;
147
+ attr_accessor :source
148
+
149
+ # Current status of tracking. (
150
+ # tag?: TagV1;
151
+ attr_accessor :tag
152
+
153
+ # Current subtag of tracking. (
154
+ # subtag?: String;
155
+ attr_accessor :subtag
156
+
157
+ # Normalized tracking message. (
158
+ # subtag_message?: String;
159
+ attr_accessor :subtag_message
160
+
161
+ # By default this field shows the `tracking_number`, but you can customize it as you wish with any info (e.g. the order number).
162
+ # title?: String;
163
+ attr_accessor :title
164
+
165
+ # Number of attempts AfterShip tracks at courier's system.
166
+ # tracked_count?: Float;
167
+ attr_accessor :tracked_count
168
+
169
+ # Indicates if the shipment is trackable till the final destination.Three possible values:- true- false- null
170
+ # last_mile_tracking_supported?: Boolean;
171
+ attr_accessor :last_mile_tracking_supported
172
+
173
+ # 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.
174
+ # language?: String;
175
+ attr_accessor :language
176
+
177
+ # Deprecated
178
+ # unique_token?: String;
179
+ attr_accessor :unique_token
180
+
181
+ # Array of checkpoint object describes the checkpoint information.
182
+ # checkpoints?: Checkpoint[];
183
+ attr_accessor :checkpoints
184
+
185
+ # Phone number(s) subscribed to receive sms notifications. Comma separated for multiple values
186
+ # subscribed_smses?: String[];
187
+ attr_accessor :subscribed_smses
188
+
189
+ # Email address(es) subscribed to receive email notifications. Comma separated for multiple values
190
+ # subscribed_emails?: String[];
191
+ attr_accessor :subscribed_emails
192
+
193
+ # Whether or not the shipment is returned to sender. Value is `true` when any of its checkpoints has subtag `Exception_010` (returning to sender) or `Exception_011` (returned to sender). Otherwise value is `false`.
194
+ # return_to_sender?: Boolean;
195
+ attr_accessor :return_to_sender
196
+
197
+ # The promised delivery date of the order. It uses the format `YYYY-MM-DD`. This has no timezone and uses whatever date you provide.
198
+ # order_promised_delivery_date?: String;
199
+ attr_accessor :order_promised_delivery_date
200
+
201
+ # Shipment delivery type- pickup_at_store- pickup_at_courier- door_to_door
202
+ # delivery_type?: String;
203
+ attr_accessor :delivery_type
204
+
205
+ # Shipment pickup location for receiver
206
+ # pickup_location?: String;
207
+ attr_accessor :pickup_location
208
+
209
+ # Shipment pickup note for receiver
210
+ # pickup_note?: String;
211
+ attr_accessor :pickup_note
212
+
213
+ # Official tracking URL of the courier (if any). The language parameter of this link relies on the destination country/region and the language associated with the shipment, if the data regarding the destination country/region and language of the shipment is not available, AfterShip will set the language parameter of the link to "US" by default.
214
+ # courier_tracking_link?: String;
215
+ attr_accessor :courier_tracking_link
216
+
217
+ # The date and time of the carrier’s first attempt to deliver the package to the recipient. It uses the shipment recipient’s timezone. The format may differ depending on how the carrier provides it:- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ
218
+ # first_attempted_at?: String;
219
+ attr_accessor :first_attempted_at
220
+
221
+ # Delivery instructions (delivery date or address) can be modified by visiting the link if supported by a carrier. The language parameter of this link relies on the destination country/region and the language associated with the shipment, if the data regarding the destination country/region and language of the shipment is not available, AfterShip will set the language parameter of the link to "US" by default.
222
+ # courier_redirect_link?: String;
223
+ attr_accessor :courier_redirect_link
224
+
225
+ # 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.
226
+ # tracking_account_number?: String;
227
+ attr_accessor :tracking_account_number
228
+
229
+ # 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.
230
+ # tracking_key?: String;
231
+ attr_accessor :tracking_key
232
+
233
+ # 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.
234
+ # tracking_ship_date?: String;
235
+ attr_accessor :tracking_ship_date
236
+
237
+ # Whether the tracking is delivered on time or not.
238
+ # on_time_status?: String;
239
+ attr_accessor :on_time_status
240
+
241
+ # The difference days of the on time.
242
+ # on_time_difference?: Float;
243
+ attr_accessor :on_time_difference
244
+
245
+ # The tags of the order.
246
+ # order_tags?: String[];
247
+ attr_accessor :order_tags
248
+
249
+ # The estimated delivery date of the shipment provided by AfterShip’s AI and shown to the recipients. It uses the format `YYYY-MM-DD` based on the shipment recipient’s timezone.
250
+ # aftership_estimated_delivery_date?: AftershipEstimatedDeliveryDateTracking;
251
+ attr_accessor :aftership_estimated_delivery_date
252
+
253
+ # Estimated delivery time of the shipment based on your . It uses the format `YYYY-MM-DD` based on the shipment recipient’s timezone.
254
+ # custom_estimated_delivery_date?: CustomEstimatedDeliveryDateTracking;
255
+ attr_accessor :custom_estimated_delivery_date
256
+
257
+ # A unique, human-readable identifier for the order.
258
+ # order_number?: String;
259
+ attr_accessor :order_number
260
+
261
+ # The shipment’s original estimated delivery date. It could be provided by the carrier, AfterShip AI, or based on your custom settings. The format of carrier EDDs may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ AfterShip AI and custom EDDs always use the format `YYYY-MM-DD`. All EDDs use the shipment recipient’s timezone.
262
+ # first_estimated_delivery?: FirstEstimatedDeliveryTracking;
263
+ attr_accessor :first_estimated_delivery
264
+
265
+ # The most recently calculated estimated delivery date. It could be provided by the carrier, AfterShip AI, or based on your custom settings. The format of carrier EDDs may differ depending on how the carrier provides it:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ AfterShip AI and custom EDDs always use the format `YYYY-MM-DD`. All EDDs use the shipment recipient’s timezone.
266
+ # latest_estimated_delivery?: LatestEstimatedDeliveryTracking;
267
+ attr_accessor :latest_estimated_delivery
268
+
269
+ # Used to add tags to your shipments to help categorize and filter them easily.
270
+ # shipment_tags?: String[];
271
+ attr_accessor :shipment_tags
272
+
273
+ # If you have multiple accounts connected for a single carrier on AfterShip, we have introduced the courier_connection_id field to allow you to specify the carrier account associated with each shipment. By providing this information, you enable us to accurately track and monitor your shipments based on the correct carrier account.(</br>In the event that you do not specify the courier_connection_id, we will handle your shipment using the connection that was created earliest among your connected accounts.
274
+ # courier_connection_id?: String;
275
+ attr_accessor :courier_connection_id
276
+
277
+ # The next couriers get the second carrier information from user or AfterShip.
278
+ # next_couriers?: NextCouriersTracking[];
279
+ attr_accessor :next_couriers
280
+
281
+ # (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.
282
+ # tracking_origin_country?: String;
283
+ attr_accessor :tracking_origin_country
284
+
285
+ # (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.
286
+ # tracking_destination_country?: String;
287
+ attr_accessor :tracking_destination_country
288
+
289
+ # (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.
290
+ # tracking_postal_code?: String;
291
+ attr_accessor :tracking_postal_code
292
+
293
+ # (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.
294
+ # tracking_state?: String;
295
+ attr_accessor :tracking_state
296
+
297
+ # The model contains the total amount of carbon emissions generated by the shipment. - AfterShip will provide this data only when it is available, and its availability is contingent upon the location and weight information that AfterShip can obtain.- The values will be accessible solely for shipments that have been successfully delivered. However, in the event of a shipping update after the delivery status has been achieved, the value may change.- It’s a paid service and only for Tracking Enterprise users, please contact your customer success manager if you want to know more.
298
+ # carbon_emissions?: CarbonEmissionsTracking;
299
+ attr_accessor :carbon_emissions
300
+
301
+ # 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 .
302
+ # location_id?: String;
303
+ attr_accessor :location_id
304
+
305
+ # 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.
306
+ # shipping_method?: String;
307
+ attr_accessor :shipping_method
308
+
309
+ # By dynamically tracking failed delivery attempts during shipment, this field allows you to pinpoint carriers accountable for the most failures. Analyzing the root cause of these failures enables you to improve carriers' delivery standard operating procedures (SOP), leading to an overall enhancement in delivery service quality.
310
+ # failed_delivery_attempts?: Integer;
311
+ attr_accessor :failed_delivery_attempts
312
+
313
+ # The signature_requirement field serves the purpose of validating the service option type, specifically proof of delivery. By collecting the recipient's signature upon delivery, it ensures the package reaches the intended recipient and prevents disputes related to non-delivery or lost packages.</br>
314
+ # signature_requirement?: String;
315
+ attr_accessor :signature_requirement
316
+
317
+ # Initializes the object
318
+ # @param [Hash] attributes Model attributes in the form of hash
319
+ def initialize(attributes = {})
320
+ if (!attributes.is_a?(Hash))
321
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::Tracking` initialize method"
322
+ end
323
+
324
+ attributes = attributes.each_with_object({}) { |(k, v), h|
325
+ h[k.to_sym] = v
326
+ }
327
+
328
+ if attributes.key?(:'id')
329
+ self.id = attributes[:'id']
330
+ end
331
+
332
+ if attributes.key?(:'created_at')
333
+ self.created_at = attributes[:'created_at']
334
+ end
335
+
336
+ if attributes.key?(:'updated_at')
337
+ self.updated_at = attributes[:'updated_at']
338
+ end
339
+
340
+ if attributes.key?(:'last_updated_at')
341
+ self.last_updated_at = attributes[:'last_updated_at']
342
+ end
343
+
344
+ if attributes.key?(:'tracking_number')
345
+ self.tracking_number = attributes[:'tracking_number']
346
+ end
347
+
348
+ if attributes.key?(:'slug')
349
+ self.slug = attributes[:'slug']
350
+ end
351
+
352
+ if attributes.key?(:'active')
353
+ self.active = attributes[:'active']
354
+ end
355
+
356
+ if attributes.key?(:'custom_fields')
357
+ self.custom_fields = attributes[:'custom_fields']
358
+ end
359
+
360
+ if attributes.key?(:'customer_name')
361
+ self.customer_name = attributes[:'customer_name']
362
+ end
363
+
364
+ if attributes.key?(:'transit_time')
365
+ self.transit_time = attributes[:'transit_time']
366
+ end
367
+
368
+ if attributes.key?(:'origin_country_iso3')
369
+ self.origin_country_iso3 = attributes[:'origin_country_iso3']
370
+ end
371
+
372
+ if attributes.key?(:'origin_state')
373
+ self.origin_state = attributes[:'origin_state']
374
+ end
375
+
376
+ if attributes.key?(:'origin_city')
377
+ self.origin_city = attributes[:'origin_city']
378
+ end
379
+
380
+ if attributes.key?(:'origin_postal_code')
381
+ self.origin_postal_code = attributes[:'origin_postal_code']
382
+ end
383
+
384
+ if attributes.key?(:'origin_raw_location')
385
+ self.origin_raw_location = attributes[:'origin_raw_location']
386
+ end
387
+
388
+ if attributes.key?(:'destination_country_iso3')
389
+ self.destination_country_iso3 = attributes[:'destination_country_iso3']
390
+ end
391
+
392
+ if attributes.key?(:'destination_state')
393
+ self.destination_state = attributes[:'destination_state']
394
+ end
395
+
396
+ if attributes.key?(:'destination_city')
397
+ self.destination_city = attributes[:'destination_city']
398
+ end
399
+
400
+ if attributes.key?(:'destination_postal_code')
401
+ self.destination_postal_code = attributes[:'destination_postal_code']
402
+ end
403
+
404
+ if attributes.key?(:'destination_raw_location')
405
+ self.destination_raw_location = attributes[:'destination_raw_location']
406
+ end
407
+
408
+ if attributes.key?(:'courier_destination_country_iso3')
409
+ self.courier_destination_country_iso3 = attributes[:'courier_destination_country_iso3']
410
+ end
411
+
412
+ if attributes.key?(:'emails')
413
+ self.emails = attributes[:'emails']
414
+ end
415
+
416
+ if attributes.key?(:'expected_delivery')
417
+ self.expected_delivery = attributes[:'expected_delivery']
418
+ end
419
+
420
+ if attributes.key?(:'note')
421
+ self.note = attributes[:'note']
422
+ end
423
+
424
+ if attributes.key?(:'order_id')
425
+ self.order_id = attributes[:'order_id']
426
+ end
427
+
428
+ if attributes.key?(:'order_id_path')
429
+ self.order_id_path = attributes[:'order_id_path']
430
+ end
431
+
432
+ if attributes.key?(:'order_date')
433
+ self.order_date = attributes[:'order_date']
434
+ end
435
+
436
+ if attributes.key?(:'shipment_package_count')
437
+ self.shipment_package_count = attributes[:'shipment_package_count']
438
+ end
439
+
440
+ if attributes.key?(:'shipment_pickup_date')
441
+ self.shipment_pickup_date = attributes[:'shipment_pickup_date']
442
+ end
443
+
444
+ if attributes.key?(:'shipment_delivery_date')
445
+ self.shipment_delivery_date = attributes[:'shipment_delivery_date']
446
+ end
447
+
448
+ if attributes.key?(:'shipment_type')
449
+ self.shipment_type = attributes[:'shipment_type']
450
+ end
451
+
452
+ if attributes.key?(:'shipment_weight')
453
+ self.shipment_weight = attributes[:'shipment_weight']
454
+ end
455
+
456
+ if attributes.key?(:'shipment_weight_unit')
457
+ self.shipment_weight_unit = attributes[:'shipment_weight_unit']
458
+ end
459
+
460
+ if attributes.key?(:'signed_by')
461
+ self.signed_by = attributes[:'signed_by']
462
+ end
463
+
464
+ if attributes.key?(:'smses')
465
+ self.smses = attributes[:'smses']
466
+ end
467
+
468
+ if attributes.key?(:'source')
469
+ self.source = attributes[:'source']
470
+ end
471
+
472
+ if attributes.key?(:'tag')
473
+ self.tag = attributes[:'tag']
474
+ end
475
+
476
+ if attributes.key?(:'subtag')
477
+ self.subtag = attributes[:'subtag']
478
+ end
479
+
480
+ if attributes.key?(:'subtag_message')
481
+ self.subtag_message = attributes[:'subtag_message']
482
+ end
483
+
484
+ if attributes.key?(:'title')
485
+ self.title = attributes[:'title']
486
+ end
487
+
488
+ if attributes.key?(:'tracked_count')
489
+ self.tracked_count = attributes[:'tracked_count']
490
+ end
491
+
492
+ if attributes.key?(:'last_mile_tracking_supported')
493
+ self.last_mile_tracking_supported = attributes[:'last_mile_tracking_supported']
494
+ end
495
+
496
+ if attributes.key?(:'language')
497
+ self.language = attributes[:'language']
498
+ end
499
+
500
+ if attributes.key?(:'unique_token')
501
+ self.unique_token = attributes[:'unique_token']
502
+ end
503
+
504
+ if attributes.key?(:'checkpoints')
505
+ self.checkpoints = attributes[:'checkpoints']
506
+ end
507
+
508
+ if attributes.key?(:'subscribed_smses')
509
+ self.subscribed_smses = attributes[:'subscribed_smses']
510
+ end
511
+
512
+ if attributes.key?(:'subscribed_emails')
513
+ self.subscribed_emails = attributes[:'subscribed_emails']
514
+ end
515
+
516
+ if attributes.key?(:'return_to_sender')
517
+ self.return_to_sender = attributes[:'return_to_sender']
518
+ end
519
+
520
+ if attributes.key?(:'order_promised_delivery_date')
521
+ self.order_promised_delivery_date = attributes[:'order_promised_delivery_date']
522
+ end
523
+
524
+ if attributes.key?(:'delivery_type')
525
+ self.delivery_type = attributes[:'delivery_type']
526
+ end
527
+
528
+ if attributes.key?(:'pickup_location')
529
+ self.pickup_location = attributes[:'pickup_location']
530
+ end
531
+
532
+ if attributes.key?(:'pickup_note')
533
+ self.pickup_note = attributes[:'pickup_note']
534
+ end
535
+
536
+ if attributes.key?(:'courier_tracking_link')
537
+ self.courier_tracking_link = attributes[:'courier_tracking_link']
538
+ end
539
+
540
+ if attributes.key?(:'first_attempted_at')
541
+ self.first_attempted_at = attributes[:'first_attempted_at']
542
+ end
543
+
544
+ if attributes.key?(:'courier_redirect_link')
545
+ self.courier_redirect_link = attributes[:'courier_redirect_link']
546
+ end
547
+
548
+ if attributes.key?(:'tracking_account_number')
549
+ self.tracking_account_number = attributes[:'tracking_account_number']
550
+ end
551
+
552
+ if attributes.key?(:'tracking_key')
553
+ self.tracking_key = attributes[:'tracking_key']
554
+ end
555
+
556
+ if attributes.key?(:'tracking_ship_date')
557
+ self.tracking_ship_date = attributes[:'tracking_ship_date']
558
+ end
559
+
560
+ if attributes.key?(:'on_time_status')
561
+ self.on_time_status = attributes[:'on_time_status']
562
+ end
563
+
564
+ if attributes.key?(:'on_time_difference')
565
+ self.on_time_difference = attributes[:'on_time_difference']
566
+ end
567
+
568
+ if attributes.key?(:'order_tags')
569
+ self.order_tags = attributes[:'order_tags']
570
+ end
571
+
572
+ if attributes.key?(:'aftership_estimated_delivery_date')
573
+ self.aftership_estimated_delivery_date = attributes[:'aftership_estimated_delivery_date']
574
+ end
575
+
576
+ if attributes.key?(:'custom_estimated_delivery_date')
577
+ self.custom_estimated_delivery_date = attributes[:'custom_estimated_delivery_date']
578
+ end
579
+
580
+ if attributes.key?(:'order_number')
581
+ self.order_number = attributes[:'order_number']
582
+ end
583
+
584
+ if attributes.key?(:'first_estimated_delivery')
585
+ self.first_estimated_delivery = attributes[:'first_estimated_delivery']
586
+ end
587
+
588
+ if attributes.key?(:'latest_estimated_delivery')
589
+ self.latest_estimated_delivery = attributes[:'latest_estimated_delivery']
590
+ end
591
+
592
+ if attributes.key?(:'shipment_tags')
593
+ self.shipment_tags = attributes[:'shipment_tags']
594
+ end
595
+
596
+ if attributes.key?(:'courier_connection_id')
597
+ self.courier_connection_id = attributes[:'courier_connection_id']
598
+ end
599
+
600
+ if attributes.key?(:'next_couriers')
601
+ self.next_couriers = attributes[:'next_couriers']
602
+ end
603
+
604
+ if attributes.key?(:'tracking_origin_country')
605
+ self.tracking_origin_country = attributes[:'tracking_origin_country']
606
+ end
607
+
608
+ if attributes.key?(:'tracking_destination_country')
609
+ self.tracking_destination_country = attributes[:'tracking_destination_country']
610
+ end
611
+
612
+ if attributes.key?(:'tracking_postal_code')
613
+ self.tracking_postal_code = attributes[:'tracking_postal_code']
614
+ end
615
+
616
+ if attributes.key?(:'tracking_state')
617
+ self.tracking_state = attributes[:'tracking_state']
618
+ end
619
+
620
+ if attributes.key?(:'carbon_emissions')
621
+ self.carbon_emissions = attributes[:'carbon_emissions']
622
+ end
623
+
624
+ if attributes.key?(:'location_id')
625
+ self.location_id = attributes[:'location_id']
626
+ end
627
+
628
+ if attributes.key?(:'shipping_method')
629
+ self.shipping_method = attributes[:'shipping_method']
630
+ end
631
+
632
+ if attributes.key?(:'failed_delivery_attempts')
633
+ self.failed_delivery_attempts = attributes[:'failed_delivery_attempts']
634
+ end
635
+
636
+ if attributes.key?(:'signature_requirement')
637
+ self.signature_requirement = attributes[:'signature_requirement']
638
+ end
639
+ end
640
+
641
+ # Attribute type mapping.
642
+ def self.openapi_types
643
+ {
644
+ :'id' => :'String',
645
+ :'created_at' => :'String',
646
+ :'updated_at' => :'String',
647
+ :'last_updated_at' => :'String',
648
+ :'tracking_number' => :'String',
649
+ :'slug' => :'String',
650
+ :'active' => :'Boolean',
651
+ :'custom_fields' => :'Object',
652
+ :'customer_name' => :'String',
653
+ :'transit_time' => :'Integer',
654
+ :'origin_country_iso3' => :'String',
655
+ :'origin_state' => :'String',
656
+ :'origin_city' => :'String',
657
+ :'origin_postal_code' => :'String',
658
+ :'origin_raw_location' => :'String',
659
+ :'destination_country_iso3' => :'String',
660
+ :'destination_state' => :'String',
661
+ :'destination_city' => :'String',
662
+ :'destination_postal_code' => :'String',
663
+ :'destination_raw_location' => :'String',
664
+ :'courier_destination_country_iso3' => :'String',
665
+ :'emails' => :'Array<String>',
666
+ :'expected_delivery' => :'String',
667
+ :'note' => :'String',
668
+ :'order_id' => :'String',
669
+ :'order_id_path' => :'String',
670
+ :'order_date' => :'String',
671
+ :'shipment_package_count' => :'Float',
672
+ :'shipment_pickup_date' => :'String',
673
+ :'shipment_delivery_date' => :'String',
674
+ :'shipment_type' => :'String',
675
+ :'shipment_weight' => :'Float',
676
+ :'shipment_weight_unit' => :'String',
677
+ :'signed_by' => :'String',
678
+ :'smses' => :'Array<String>',
679
+ :'source' => :'String',
680
+ :'tag' => :'TagV1',
681
+ :'subtag' => :'String',
682
+ :'subtag_message' => :'String',
683
+ :'title' => :'String',
684
+ :'tracked_count' => :'Float',
685
+ :'last_mile_tracking_supported' => :'Boolean',
686
+ :'language' => :'String',
687
+ :'unique_token' => :'String',
688
+ :'checkpoints' => :'Array<Checkpoint>',
689
+ :'subscribed_smses' => :'Array<String>',
690
+ :'subscribed_emails' => :'Array<String>',
691
+ :'return_to_sender' => :'Boolean',
692
+ :'order_promised_delivery_date' => :'String',
693
+ :'delivery_type' => :'String',
694
+ :'pickup_location' => :'String',
695
+ :'pickup_note' => :'String',
696
+ :'courier_tracking_link' => :'String',
697
+ :'first_attempted_at' => :'String',
698
+ :'courier_redirect_link' => :'String',
699
+ :'tracking_account_number' => :'String',
700
+ :'tracking_key' => :'String',
701
+ :'tracking_ship_date' => :'String',
702
+ :'on_time_status' => :'String',
703
+ :'on_time_difference' => :'Float',
704
+ :'order_tags' => :'Array<String>',
705
+ :'aftership_estimated_delivery_date' => :'AftershipEstimatedDeliveryDateTracking',
706
+ :'custom_estimated_delivery_date' => :'CustomEstimatedDeliveryDateTracking',
707
+ :'order_number' => :'String',
708
+ :'first_estimated_delivery' => :'FirstEstimatedDeliveryTracking',
709
+ :'latest_estimated_delivery' => :'LatestEstimatedDeliveryTracking',
710
+ :'shipment_tags' => :'Array<String>',
711
+ :'courier_connection_id' => :'String',
712
+ :'next_couriers' => :'Array<NextCouriersTracking>',
713
+ :'tracking_origin_country' => :'String',
714
+ :'tracking_destination_country' => :'String',
715
+ :'tracking_postal_code' => :'String',
716
+ :'tracking_state' => :'String',
717
+ :'carbon_emissions' => :'CarbonEmissionsTracking',
718
+ :'location_id' => :'String',
719
+ :'shipping_method' => :'String',
720
+ :'failed_delivery_attempts' => :'Integer',
721
+ :'signature_requirement' => :'String',
722
+ }
723
+ end
724
+
725
+ # Attribute mapping from ruby-style variable name to JSON key.
726
+ def self.attribute_map
727
+ {
728
+ :'id' => :'id',
729
+ :'created_at' => :'created_at',
730
+ :'updated_at' => :'updated_at',
731
+ :'last_updated_at' => :'last_updated_at',
732
+ :'tracking_number' => :'tracking_number',
733
+ :'slug' => :'slug',
734
+ :'active' => :'active',
735
+ :'custom_fields' => :'custom_fields',
736
+ :'customer_name' => :'customer_name',
737
+ :'transit_time' => :'transit_time',
738
+ :'origin_country_iso3' => :'origin_country_iso3',
739
+ :'origin_state' => :'origin_state',
740
+ :'origin_city' => :'origin_city',
741
+ :'origin_postal_code' => :'origin_postal_code',
742
+ :'origin_raw_location' => :'origin_raw_location',
743
+ :'destination_country_iso3' => :'destination_country_iso3',
744
+ :'destination_state' => :'destination_state',
745
+ :'destination_city' => :'destination_city',
746
+ :'destination_postal_code' => :'destination_postal_code',
747
+ :'destination_raw_location' => :'destination_raw_location',
748
+ :'courier_destination_country_iso3' => :'courier_destination_country_iso3',
749
+ :'emails' => :'emails',
750
+ :'expected_delivery' => :'expected_delivery',
751
+ :'note' => :'note',
752
+ :'order_id' => :'order_id',
753
+ :'order_id_path' => :'order_id_path',
754
+ :'order_date' => :'order_date',
755
+ :'shipment_package_count' => :'shipment_package_count',
756
+ :'shipment_pickup_date' => :'shipment_pickup_date',
757
+ :'shipment_delivery_date' => :'shipment_delivery_date',
758
+ :'shipment_type' => :'shipment_type',
759
+ :'shipment_weight' => :'shipment_weight',
760
+ :'shipment_weight_unit' => :'shipment_weight_unit',
761
+ :'signed_by' => :'signed_by',
762
+ :'smses' => :'smses',
763
+ :'source' => :'source',
764
+ :'tag' => :'tag',
765
+ :'subtag' => :'subtag',
766
+ :'subtag_message' => :'subtag_message',
767
+ :'title' => :'title',
768
+ :'tracked_count' => :'tracked_count',
769
+ :'last_mile_tracking_supported' => :'last_mile_tracking_supported',
770
+ :'language' => :'language',
771
+ :'unique_token' => :'unique_token',
772
+ :'checkpoints' => :'checkpoints',
773
+ :'subscribed_smses' => :'subscribed_smses',
774
+ :'subscribed_emails' => :'subscribed_emails',
775
+ :'return_to_sender' => :'return_to_sender',
776
+ :'order_promised_delivery_date' => :'order_promised_delivery_date',
777
+ :'delivery_type' => :'delivery_type',
778
+ :'pickup_location' => :'pickup_location',
779
+ :'pickup_note' => :'pickup_note',
780
+ :'courier_tracking_link' => :'courier_tracking_link',
781
+ :'first_attempted_at' => :'first_attempted_at',
782
+ :'courier_redirect_link' => :'courier_redirect_link',
783
+ :'tracking_account_number' => :'tracking_account_number',
784
+ :'tracking_key' => :'tracking_key',
785
+ :'tracking_ship_date' => :'tracking_ship_date',
786
+ :'on_time_status' => :'on_time_status',
787
+ :'on_time_difference' => :'on_time_difference',
788
+ :'order_tags' => :'order_tags',
789
+ :'aftership_estimated_delivery_date' => :'aftership_estimated_delivery_date',
790
+ :'custom_estimated_delivery_date' => :'custom_estimated_delivery_date',
791
+ :'order_number' => :'order_number',
792
+ :'first_estimated_delivery' => :'first_estimated_delivery',
793
+ :'latest_estimated_delivery' => :'latest_estimated_delivery',
794
+ :'shipment_tags' => :'shipment_tags',
795
+ :'courier_connection_id' => :'courier_connection_id',
796
+ :'next_couriers' => :'next_couriers',
797
+ :'tracking_origin_country' => :'tracking_origin_country',
798
+ :'tracking_destination_country' => :'tracking_destination_country',
799
+ :'tracking_postal_code' => :'tracking_postal_code',
800
+ :'tracking_state' => :'tracking_state',
801
+ :'carbon_emissions' => :'carbon_emissions',
802
+ :'location_id' => :'location_id',
803
+ :'shipping_method' => :'shipping_method',
804
+ :'failed_delivery_attempts' => :'failed_delivery_attempts',
805
+ :'signature_requirement' => :'signature_requirement',
806
+ }
807
+ end
808
+
809
+ # Builds the object from hash
810
+ # @param attributes [Hash] Model attributes in the form of hash
811
+ # @return [Object] Returns the model itself
812
+ def self.build_from_hash(attributes)
813
+ return nil unless attributes.is_a?(Hash)
814
+ attributes = attributes.transform_keys(&:to_sym)
815
+ transformed_hash = {}
816
+ openapi_types.each_pair do |key, type|
817
+ if attributes.key?(key) && attributes[key].nil?
818
+ transformed_hash["#{key}"] = nil
819
+ elsif type =~ /\AArray<(.*)>/i
820
+ # check to ensure the input is an array given that the attribute
821
+ # is documented as an array but the input is not
822
+ if attributes[key].is_a?(Array)
823
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
824
+ end
825
+ elsif !attributes[key].nil?
826
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
827
+ end
828
+ end
829
+ new(transformed_hash)
830
+ end
831
+
832
+ # Deserializes the data based on type
833
+ # @param type [String] Data type
834
+ # @param value [String] Value to be deserialized
835
+ # @return [Object] Deserialized data
836
+ def self._deserialize(type, value)
837
+ case type.to_sym
838
+ when :Time
839
+ Time.parse(value)
840
+ when :Date
841
+ Date.parse(value)
842
+ when :String
843
+ value.to_s
844
+ when :Integer
845
+ value.to_i
846
+ when :Float
847
+ value.to_f
848
+ when :Boolean
849
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
850
+ true
851
+ else
852
+ false
853
+ end
854
+ when :Object
855
+ # generic object (usually a Hash), return directly
856
+ value
857
+ when /\AArray<(?<inner_type>.+)>\z/
858
+ inner_type = Regexp.last_match[:inner_type]
859
+ value.map { |v| _deserialize(inner_type, v) }
860
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
861
+ k_type = Regexp.last_match[:k_type]
862
+ v_type = Regexp.last_match[:v_type]
863
+ {}.tap do |hash|
864
+ value.each do |k, v|
865
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
866
+ end
867
+ end
868
+ else # model
869
+ klass = AftershipAPI::Model.const_get(type)
870
+ klass.build_from_hash(value)
871
+ end
872
+ end
873
+
874
+ # Returns the string representation of the object
875
+ # @return [String] String presentation of the object
876
+ def to_s
877
+ to_hash.to_s
878
+ end
879
+
880
+ # to_body is an alias to to_hash (backward compatibility)
881
+ # @return [Hash] Returns the object in the form of hash
882
+ def to_body
883
+ to_hash
884
+ end
885
+
886
+ # Returns the object in the form of hash
887
+ # @return [Hash] Returns the object in the form of hash
888
+ def to_hash
889
+ hash = {}
890
+ self.class.attribute_map.each_pair do |attr, param|
891
+ value = self.send(attr)
892
+ next if value.nil?
893
+
894
+ hash[param] = _to_hash(value)
895
+ end
896
+ hash
897
+ end
898
+
899
+ # Outputs non-array value in the form of hash
900
+ # For object, use to_hash. Otherwise, just return the value
901
+ # @param value [Object] Any valid value
902
+ # @return [Hash] Returns the value in the form of hash
903
+ def _to_hash(value)
904
+ if value.is_a?(Array)
905
+ value.compact.map { |v| _to_hash(v) }
906
+ elsif value.is_a?(Hash)
907
+ {}.tap do |hash|
908
+ value.each { |k, v| hash[k] = _to_hash(v) }
909
+ end
910
+ elsif value.respond_to? :to_hash
911
+ value.to_hash
912
+ else
913
+ value
914
+ end
915
+ end
916
+
917
+ def to_json(*a)
918
+ to_hash.to_json(*a)
919
+ end
920
+ end
921
+ end