aftership-tracking-sdk 13.0.0 → 15.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 (34) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -3
  3. data/lib/aftership-tracking-sdk/api/courier.rb +2 -2
  4. data/lib/aftership-tracking-sdk/api/courier_connection.rb +5 -5
  5. data/lib/aftership-tracking-sdk/api/estimated_delivery_date.rb +2 -2
  6. data/lib/aftership-tracking-sdk/api/tracking.rb +7 -7
  7. data/lib/aftership-tracking-sdk/models/checkpoint.rb +16 -6
  8. data/lib/aftership-tracking-sdk/models/create_tracking_request.rb +23 -13
  9. data/lib/aftership-tracking-sdk/models/create_tracking_request_customers.rb +10 -0
  10. data/lib/aftership-tracking-sdk/models/create_tracking_request_last_mile.rb +1 -1
  11. data/lib/aftership-tracking-sdk/models/create_tracking_request_order_promised_delivery_date.rb +171 -0
  12. data/lib/aftership-tracking-sdk/models/create_tracking_request_shipment_direction.rb +26 -0
  13. data/lib/aftership-tracking-sdk/models/estimated_delivery_date_request.rb +2 -2
  14. data/lib/aftership-tracking-sdk/models/estimated_delivery_date_request_destination_address.rb +2 -2
  15. data/lib/aftership-tracking-sdk/models/estimated_delivery_date_request_origin_address.rb +2 -2
  16. data/lib/aftership-tracking-sdk/models/tracking.rb +63 -13
  17. data/lib/aftership-tracking-sdk/models/tracking_customers.rb +10 -0
  18. data/lib/aftership-tracking-sdk/models/tracking_forward_shipment.rb +151 -0
  19. data/lib/aftership-tracking-sdk/models/tracking_multi_piece_info.rb +161 -0
  20. data/lib/aftership-tracking-sdk/models/tracking_multi_piece_info_pieces.rb +181 -0
  21. data/lib/aftership-tracking-sdk/models/tracking_multi_piece_info_pieces_type.rb +26 -0
  22. data/lib/aftership-tracking-sdk/models/tracking_multi_piece_info_type.rb +26 -0
  23. data/lib/aftership-tracking-sdk/models/tracking_order_promised_delivery_date.rb +171 -0
  24. data/lib/aftership-tracking-sdk/models/tracking_proof_of_delivery.rb +161 -0
  25. data/lib/aftership-tracking-sdk/models/tracking_response.rb +1 -1
  26. data/lib/aftership-tracking-sdk/models/tracking_return_shipment.rb +171 -0
  27. data/lib/aftership-tracking-sdk/models/tracking_shipment_dimensions.rb +181 -0
  28. data/lib/aftership-tracking-sdk/models/tracking_shipment_direction.rb +27 -0
  29. data/lib/aftership-tracking-sdk/models/update_tracking_by_id_request.rb +13 -3
  30. data/lib/aftership-tracking-sdk/models/update_tracking_by_id_request_customers.rb +10 -0
  31. data/lib/aftership-tracking-sdk/models/update_tracking_by_id_request_order_promised_delivery_date.rb +171 -0
  32. data/lib/aftership-tracking-sdk/models/update_tracking_by_id_request_shipment_direction.rb +26 -0
  33. data/lib/aftership-tracking-sdk/version.rb +1 -1
  34. metadata +16 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 797c70d4a91c7d50a97997267ad8f6b6f55781ba87962d10e8932683b4f79ad2
4
- data.tar.gz: 20180484c5f2e18da713f51404fa4742718b5aebb51c92d5a207ca293e0f2eb3
3
+ metadata.gz: dbba5a57b94fdd58712b2a33c84075631a22e1900c5f0201c00927dd99c3b5e1
4
+ data.tar.gz: 518931d07ea93e956e9608fc265d85e53b1828df913249ec0f23a0fdf51386b2
5
5
  SHA512:
6
- metadata.gz: af4839a8968503bdd46f74a51f7644b515fec28f41159d4dd2edbf1c2297e3082049ddc510d64b6865b34dd506aef51672f821994a8365b649bb8b3986691765
7
- data.tar.gz: c3c754e064f3ffb5ade7d5215d135ce1af92a325ffd5e8947fbe189f1026f636a134fc3500f38ced6023649d7b1d63bb6f82284c02dfc062c8fb669102f38ea2
6
+ metadata.gz: 5e8d3545a88eb3c4329d40b5dc32d0f6a7f803bc4efe83a8e61b25c6387e601a07e72158f16bdc67a70f33254ca333b888de85f5f8a59d2436cc30293a1d7f6e
7
+ data.tar.gz: 543b9f144163ecc63565bee5657d427fc7f43f65d5c4a540c3d5344c5b86d7bcb1651595cc9425df2dc1f96ad9cabb1e1ee664e2f10f520c9d5e8a0731ad3b6d
data/README.md CHANGED
@@ -38,8 +38,8 @@ Before you begin to integrate:
38
38
 
39
39
  ### API and SDK Version
40
40
 
41
- - SDK Version:
42
- - API Version: 2025-07
41
+ - SDK Version: 15.0.0
42
+ - API Version: 2026-07
43
43
  ## Quick Start
44
44
 
45
45
  ### Installation
@@ -50,7 +50,7 @@ gem install aftership-tracking-sdk
50
50
  Or add a line to your Gemfile
51
51
 
52
52
  ```bash
53
- gem 'aftership-tracking-sdk', '~> 13.0.0'
53
+ gem 'aftership-tracking-sdk', '~> 15.0.0'
54
54
  ```
55
55
 
56
56
  ## Constructor
@@ -89,6 +89,27 @@ end
89
89
 
90
90
  See the [Rate Limit](https://www.aftership.com/docs/tracking/quickstart/rate-limit) to understand the AfterShip rate limit policy.
91
91
 
92
+ The API returns its current rate limit status in the headers of every response, and the SDK exposes these headers on both successful responses and rate-limited errors, so you can monitor your consumption proactively instead of waiting for `429` errors.
93
+
94
+ | Header | Description |
95
+ | ----------------------- | ---------------------------------------------------------- |
96
+ | `X-RateLimit-Limit` | The rate limit ceiling for the current endpoint per second |
97
+ | `X-RateLimit-Remaining` | The number of requests left for the 1-second window |
98
+ | `X-RateLimit-Reset` | The Unix timestamp when the rate limit will be reset |
99
+
100
+ Every successful response exposes a `response_header` hash (case-insensitive lookup) alongside `data`. Taking the Quick Start example above:
101
+
102
+ ```ruby
103
+ remaining = response.response_header['x-ratelimit-remaining'].to_i
104
+ reset_at = response.response_header['x-ratelimit-reset'].to_i
105
+
106
+ if remaining <= 1
107
+ # Throttle or defer lower-priority requests until reset_at
108
+ end
109
+ ```
110
+
111
+ When the rate limit is exceeded, the request fails with a `429` error that carries the same headers — see [Error Handling](#error-handling).
112
+
92
113
  ## Error Handling
93
114
 
94
115
  The SDK will return an error object when there is any error during the request, with the following specification:
@@ -23,7 +23,7 @@ module AftershipAPI
23
23
 
24
24
 
25
25
  # resource path
26
- local_var_path = "/tracking/2025-07/couriers"
26
+ local_var_path = "/tracking/2026-07/couriers"
27
27
  method = :'GET'
28
28
 
29
29
  # query parameters
@@ -72,7 +72,7 @@ module AftershipAPI
72
72
 
73
73
 
74
74
  # resource path
75
- local_var_path = "/tracking/2025-07/couriers/detect"
75
+ local_var_path = "/tracking/2026-07/couriers/detect"
76
76
  method = :'POST'
77
77
 
78
78
  # query parameters
@@ -24,7 +24,7 @@ module AftershipAPI
24
24
 
25
25
 
26
26
  # resource path
27
- local_var_path = "/tracking/2025-07/courier-connections"
27
+ local_var_path = "/tracking/2026-07/courier-connections"
28
28
  method = :'GET'
29
29
 
30
30
  # query parameters
@@ -74,7 +74,7 @@ module AftershipAPI
74
74
 
75
75
 
76
76
  # resource path
77
- local_var_path = "/tracking/2025-07/courier-connections"
77
+ local_var_path = "/tracking/2026-07/courier-connections"
78
78
  method = :'POST'
79
79
 
80
80
  # query parameters
@@ -122,7 +122,7 @@ module AftershipAPI
122
122
 
123
123
 
124
124
  # resource path
125
- local_var_path = "/tracking/2025-07/courier-connections/#{id}"
125
+ local_var_path = "/tracking/2026-07/courier-connections/#{id}"
126
126
  method = :'GET'
127
127
 
128
128
  # query parameters
@@ -173,7 +173,7 @@ module AftershipAPI
173
173
 
174
174
 
175
175
  # resource path
176
- local_var_path = "/tracking/2025-07/courier-connections/#{id}"
176
+ local_var_path = "/tracking/2026-07/courier-connections/#{id}"
177
177
  method = :'PATCH'
178
178
 
179
179
  # query parameters
@@ -221,7 +221,7 @@ module AftershipAPI
221
221
 
222
222
 
223
223
  # resource path
224
- local_var_path = "/tracking/2025-07/courier-connections/#{id}"
224
+ local_var_path = "/tracking/2026-07/courier-connections/#{id}"
225
225
  method = :'DELETE'
226
226
 
227
227
  # query parameters
@@ -24,7 +24,7 @@ module AftershipAPI
24
24
 
25
25
 
26
26
  # resource path
27
- local_var_path = "/tracking/2025-07/estimated-delivery-date/predict"
27
+ local_var_path = "/tracking/2026-07/estimated-delivery-date/predict"
28
28
  method = :'POST'
29
29
 
30
30
  # query parameters
@@ -71,7 +71,7 @@ module AftershipAPI
71
71
 
72
72
 
73
73
  # resource path
74
- local_var_path = "/tracking/2025-07/estimated-delivery-date/predict-batch"
74
+ local_var_path = "/tracking/2026-07/estimated-delivery-date/predict-batch"
75
75
  method = :'POST'
76
76
 
77
77
  # query parameters
@@ -39,7 +39,7 @@ module AftershipAPI
39
39
 
40
40
 
41
41
  # resource path
42
- local_var_path = "/tracking/2025-07/trackings"
42
+ local_var_path = "/tracking/2026-07/trackings"
43
43
  method = :'GET'
44
44
 
45
45
  # query parameters
@@ -104,7 +104,7 @@ module AftershipAPI
104
104
 
105
105
 
106
106
  # resource path
107
- local_var_path = "/tracking/2025-07/trackings"
107
+ local_var_path = "/tracking/2026-07/trackings"
108
108
  method = :'POST'
109
109
 
110
110
  # query parameters
@@ -154,7 +154,7 @@ module AftershipAPI
154
154
 
155
155
 
156
156
  # resource path
157
- local_var_path = "/tracking/2025-07/trackings/#{id}"
157
+ local_var_path = "/tracking/2026-07/trackings/#{id}"
158
158
  method = :'GET'
159
159
 
160
160
  # query parameters
@@ -207,7 +207,7 @@ module AftershipAPI
207
207
 
208
208
 
209
209
  # resource path
210
- local_var_path = "/tracking/2025-07/trackings/#{id}"
210
+ local_var_path = "/tracking/2026-07/trackings/#{id}"
211
211
  method = :'PUT'
212
212
 
213
213
  # query parameters
@@ -255,7 +255,7 @@ module AftershipAPI
255
255
 
256
256
 
257
257
  # resource path
258
- local_var_path = "/tracking/2025-07/trackings/#{id}"
258
+ local_var_path = "/tracking/2026-07/trackings/#{id}"
259
259
  method = :'DELETE'
260
260
 
261
261
  # query parameters
@@ -303,7 +303,7 @@ module AftershipAPI
303
303
 
304
304
 
305
305
  # resource path
306
- local_var_path = "/tracking/2025-07/trackings/#{id}/retrack"
306
+ local_var_path = "/tracking/2026-07/trackings/#{id}/retrack"
307
307
  method = :'POST'
308
308
 
309
309
  # query parameters
@@ -354,7 +354,7 @@ module AftershipAPI
354
354
 
355
355
 
356
356
  # resource path
357
- local_var_path = "/tracking/2025-07/trackings/#{id}/mark-as-completed"
357
+ local_var_path = "/tracking/2026-07/trackings/#{id}/mark-as-completed"
358
358
  method = :'POST'
359
359
 
360
360
  # query parameters
@@ -27,8 +27,8 @@ module AftershipAPI::Model
27
27
  attr_accessor :state
28
28
 
29
29
  # Postal code info provided by carrier
30
- # zip?: String;
31
- attr_accessor :zip
30
+ # postal_code?: String;
31
+ attr_accessor :postal_code
32
32
 
33
33
  # The latitude and longitude coordinates indicate the precise location of the shipments that are currently in transit.
34
34
  # coordinate?: CheckpointCoordinate;
@@ -70,6 +70,10 @@ module AftershipAPI::Model
70
70
  # source?: CheckpointSource;
71
71
  attr_accessor :source
72
72
 
73
+ # Unique hash identifier for each checkpoint event, could be used for deduplication.
74
+ # hash?: String;
75
+ attr_accessor :hash
76
+
73
77
  # Initializes the object
74
78
  # @param [Hash] attributes Model attributes in the form of hash
75
79
  def initialize(attributes = {})
@@ -105,8 +109,8 @@ module AftershipAPI::Model
105
109
  self.state = attributes[:'state']
106
110
  end
107
111
 
108
- if attributes.key?(:'zip')
109
- self.zip = attributes[:'zip']
112
+ if attributes.key?(:'postal_code')
113
+ self.postal_code = attributes[:'postal_code']
110
114
  end
111
115
 
112
116
  if attributes.key?(:'coordinate')
@@ -148,6 +152,10 @@ module AftershipAPI::Model
148
152
  if attributes.key?(:'source')
149
153
  self.source = attributes[:'source']
150
154
  end
155
+
156
+ if attributes.key?(:'hash')
157
+ self.hash = attributes[:'hash']
158
+ end
151
159
  end
152
160
 
153
161
  # Attribute type mapping.
@@ -159,7 +167,7 @@ module AftershipAPI::Model
159
167
  :'location' => :'String',
160
168
  :'city' => :'String',
161
169
  :'state' => :'String',
162
- :'zip' => :'String',
170
+ :'postal_code' => :'String',
163
171
  :'coordinate' => :'CheckpointCoordinate',
164
172
  :'country_region' => :'String',
165
173
  :'country_region_name' => :'String',
@@ -170,6 +178,7 @@ module AftershipAPI::Model
170
178
  :'raw_tag' => :'String',
171
179
  :'events' => :'Array<CheckpointEvents>',
172
180
  :'source' => :'CheckpointSource',
181
+ :'hash' => :'String',
173
182
  }
174
183
  end
175
184
 
@@ -182,7 +191,7 @@ module AftershipAPI::Model
182
191
  :'location' => :'location',
183
192
  :'city' => :'city',
184
193
  :'state' => :'state',
185
- :'zip' => :'zip',
194
+ :'postal_code' => :'postal_code',
186
195
  :'coordinate' => :'coordinate',
187
196
  :'country_region' => :'country_region',
188
197
  :'country_region_name' => :'country_region_name',
@@ -193,6 +202,7 @@ module AftershipAPI::Model
193
202
  :'raw_tag' => :'raw_tag',
194
203
  :'events' => :'events',
195
204
  :'source' => :'source',
205
+ :'hash' => :'hash',
196
206
  }
197
207
  end
198
208
 
@@ -34,18 +34,18 @@ module AftershipAPI::Model
34
34
  # language?: String;
35
35
  attr_accessor :language
36
36
 
37
- # The promised delivery date of the order. It uses the formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ
38
- # order_promised_delivery_date?: String;
37
+ # The promised delivery date of the order in shipment recipient’s timezone.
38
+ # order_promised_delivery_date?: CreateTrackingRequestOrderPromisedDeliveryDate;
39
39
  attr_accessor :order_promised_delivery_date
40
40
 
41
- # Shipment delivery type- pickup_at_store- pickup_at_courier- door_to_door
42
- # delivery_type?: CreateTrackingRequestDeliveryType;
43
- attr_accessor :delivery_type
44
-
45
41
  # Shipment pickup location for receiver
46
42
  # pickup_location?: String;
47
43
  attr_accessor :pickup_location
48
44
 
45
+ # Shipment delivery type- pickup_at_store- pickup_at_courier- door_to_door
46
+ # delivery_type?: CreateTrackingRequestDeliveryType;
47
+ attr_accessor :delivery_type
48
+
49
49
  # Shipment pickup note for receiver
50
50
  # pickup_note?: String;
51
51
  attr_accessor :pickup_note
@@ -146,6 +146,10 @@ module AftershipAPI::Model
146
146
  # customers?: CreateTrackingRequestCustomers[];
147
147
  attr_accessor :customers
148
148
 
149
+ # Indicates the business direction of the shipment in the e-commerce fulfillment lifecycle.Possible values:- `forward`: A forward (outbound-to-customer) shipment created for order fulfillment.- `return`: A return (customer-to-merchant) shipment created for after-sales return or exchange.When provided, this field gives AfterShip additional context about the shipment's intent, enabling more accurate status identification.
150
+ # shipment_direction?: CreateTrackingRequestShipmentDirection;
151
+ attr_accessor :shipment_direction
152
+
149
153
  # Initializes the object
150
154
  # @param [Hash] attributes Model attributes in the form of hash
151
155
  def initialize(attributes = {})
@@ -193,14 +197,14 @@ module AftershipAPI::Model
193
197
  self.order_promised_delivery_date = attributes[:'order_promised_delivery_date']
194
198
  end
195
199
 
196
- if attributes.key?(:'delivery_type')
197
- self.delivery_type = attributes[:'delivery_type']
198
- end
199
-
200
200
  if attributes.key?(:'pickup_location')
201
201
  self.pickup_location = attributes[:'pickup_location']
202
202
  end
203
203
 
204
+ if attributes.key?(:'delivery_type')
205
+ self.delivery_type = attributes[:'delivery_type']
206
+ end
207
+
204
208
  if attributes.key?(:'pickup_note')
205
209
  self.pickup_note = attributes[:'pickup_note']
206
210
  end
@@ -300,6 +304,10 @@ module AftershipAPI::Model
300
304
  if attributes.key?(:'customers')
301
305
  self.customers = attributes[:'customers']
302
306
  end
307
+
308
+ if attributes.key?(:'shipment_direction')
309
+ self.shipment_direction = attributes[:'shipment_direction']
310
+ end
303
311
  end
304
312
 
305
313
  # Attribute type mapping.
@@ -313,9 +321,9 @@ module AftershipAPI::Model
313
321
  :'custom_fields' => :'Object',
314
322
  :'order_id_path' => :'String',
315
323
  :'language' => :'String',
316
- :'order_promised_delivery_date' => :'String',
317
- :'delivery_type' => :'CreateTrackingRequestDeliveryType',
324
+ :'order_promised_delivery_date' => :'CreateTrackingRequestOrderPromisedDeliveryDate',
318
325
  :'pickup_location' => :'String',
326
+ :'delivery_type' => :'CreateTrackingRequestDeliveryType',
319
327
  :'pickup_note' => :'String',
320
328
  :'tracking_account_number' => :'String',
321
329
  :'tracking_key' => :'String',
@@ -341,6 +349,7 @@ module AftershipAPI::Model
341
349
  :'shipping_method' => :'String',
342
350
  :'last_mile' => :'CreateTrackingRequestLastMile',
343
351
  :'customers' => :'Array<CreateTrackingRequestCustomers>',
352
+ :'shipment_direction' => :'CreateTrackingRequestShipmentDirection',
344
353
  }
345
354
  end
346
355
 
@@ -356,8 +365,8 @@ module AftershipAPI::Model
356
365
  :'order_id_path' => :'order_id_path',
357
366
  :'language' => :'language',
358
367
  :'order_promised_delivery_date' => :'order_promised_delivery_date',
359
- :'delivery_type' => :'delivery_type',
360
368
  :'pickup_location' => :'pickup_location',
369
+ :'delivery_type' => :'delivery_type',
361
370
  :'pickup_note' => :'pickup_note',
362
371
  :'tracking_account_number' => :'tracking_account_number',
363
372
  :'tracking_key' => :'tracking_key',
@@ -383,6 +392,7 @@ module AftershipAPI::Model
383
392
  :'shipping_method' => :'shipping_method',
384
393
  :'last_mile' => :'last_mile',
385
394
  :'customers' => :'customers',
395
+ :'shipment_direction' => :'shipment_direction',
386
396
  }
387
397
  end
388
398
 
@@ -22,6 +22,10 @@ module AftershipAPI::Model
22
22
  # language?: String;
23
23
  attr_accessor :language
24
24
 
25
+ # The customer's identifier on the merchant or platform (for example, Shopify) side.
26
+ # id?: String;
27
+ attr_accessor :id
28
+
25
29
  # Initializes the object
26
30
  # @param [Hash] attributes Model attributes in the form of hash
27
31
  def initialize(attributes = {})
@@ -52,6 +56,10 @@ module AftershipAPI::Model
52
56
  if attributes.key?(:'language')
53
57
  self.language = attributes[:'language']
54
58
  end
59
+
60
+ if attributes.key?(:'id')
61
+ self.id = attributes[:'id']
62
+ end
55
63
  end
56
64
 
57
65
  # Attribute type mapping.
@@ -62,6 +70,7 @@ module AftershipAPI::Model
62
70
  :'phone_number' => :'String',
63
71
  :'email' => :'String',
64
72
  :'language' => :'String',
73
+ :'id' => :'String',
65
74
  }
66
75
  end
67
76
 
@@ -73,6 +82,7 @@ module AftershipAPI::Model
73
82
  :'phone_number' => :'phone_number',
74
83
  :'email' => :'email',
75
84
  :'language' => :'language',
85
+ :'id' => :'id',
76
86
  }
77
87
  end
78
88
 
@@ -7,7 +7,7 @@ module AftershipAPI::Model
7
7
  attr_accessor :tracking_number
8
8
 
9
9
  # The unique code of the carrier responsible for the last-mile of the shipment. Find all the courier slugs .
10
- # slug?: String;
10
+ # slug: String;
11
11
  attr_accessor :slug
12
12
 
13
13
  # Initializes the object
@@ -0,0 +1,171 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class CreateTrackingRequestOrderPromisedDeliveryDate
5
+ # The promised delivery date of the order.It uses the formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ
6
+ # promised_delivery_date?: String;
7
+ attr_accessor :promised_delivery_date
8
+
9
+ # Earliest promised delivery date of the order. It uses the formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ
10
+ # promised_delivery_date_min?: String;
11
+ attr_accessor :promised_delivery_date_min
12
+
13
+ # Latest promised delivery date of the order. It uses the formats:- YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ
14
+ # promised_delivery_date_max?: String;
15
+ attr_accessor :promised_delivery_date_max
16
+
17
+ # Initializes the object
18
+ # @param [Hash] attributes Model attributes in the form of hash
19
+ def initialize(attributes = {})
20
+ if (!attributes.is_a?(Hash))
21
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::CreateTrackingRequestOrderPromisedDeliveryDate` initialize method"
22
+ end
23
+
24
+ attributes = attributes.each_with_object({}) { |(k, v), h|
25
+ h[k.to_sym] = v
26
+ }
27
+
28
+ if attributes.key?(:'promised_delivery_date')
29
+ self.promised_delivery_date = attributes[:'promised_delivery_date']
30
+ end
31
+
32
+ if attributes.key?(:'promised_delivery_date_min')
33
+ self.promised_delivery_date_min = attributes[:'promised_delivery_date_min']
34
+ end
35
+
36
+ if attributes.key?(:'promised_delivery_date_max')
37
+ self.promised_delivery_date_max = attributes[:'promised_delivery_date_max']
38
+ end
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'promised_delivery_date' => :'String',
45
+ :'promised_delivery_date_min' => :'String',
46
+ :'promised_delivery_date_max' => :'String',
47
+ }
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'promised_delivery_date' => :'promised_delivery_date',
54
+ :'promised_delivery_date_min' => :'promised_delivery_date_min',
55
+ :'promised_delivery_date_max' => :'promised_delivery_date_max',
56
+ }
57
+ end
58
+
59
+ # Builds the object from hash
60
+ # @param attributes [Hash] Model attributes in the form of hash
61
+ # @return [Object] Returns the model itself
62
+ def self.build_from_hash(attributes)
63
+ return nil unless attributes.is_a?(Hash)
64
+ attributes = attributes.transform_keys(&:to_sym)
65
+ transformed_hash = {}
66
+ openapi_types.each_pair do |key, type|
67
+ if attributes.key?(key) && attributes[key].nil?
68
+ transformed_hash["#{key}"] = nil
69
+ elsif type =~ /\AArray<(.*)>/i
70
+ # check to ensure the input is an array given that the attribute
71
+ # is documented as an array but the input is not
72
+ if attributes[key].is_a?(Array)
73
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
74
+ end
75
+ elsif !attributes[key].nil?
76
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
77
+ end
78
+ end
79
+ new(transformed_hash)
80
+ end
81
+
82
+ # Deserializes the data based on type
83
+ # @param type [String] Data type
84
+ # @param value [String] Value to be deserialized
85
+ # @return [Object] Deserialized data
86
+ def self._deserialize(type, value)
87
+ case type.to_sym
88
+ when :Time
89
+ Time.parse(value)
90
+ when :Date
91
+ Date.parse(value)
92
+ when :String
93
+ value.to_s
94
+ when :Integer
95
+ value.to_i
96
+ when :Float
97
+ value.to_f
98
+ when :Boolean
99
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
100
+ true
101
+ else
102
+ false
103
+ end
104
+ when :Object
105
+ # generic object (usually a Hash), return directly
106
+ value
107
+ when /\AArray<(?<inner_type>.+)>\z/
108
+ inner_type = Regexp.last_match[:inner_type]
109
+ value.map { |v| _deserialize(inner_type, v) }
110
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
111
+ k_type = Regexp.last_match[:k_type]
112
+ v_type = Regexp.last_match[:v_type]
113
+ {}.tap do |hash|
114
+ value.each do |k, v|
115
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
116
+ end
117
+ end
118
+ else # model
119
+ klass = AftershipAPI::Model.const_get(type)
120
+ klass.build_from_hash(value)
121
+ end
122
+ end
123
+
124
+ # Returns the string representation of the object
125
+ # @return [String] String presentation of the object
126
+ def to_s
127
+ to_hash.to_s
128
+ end
129
+
130
+ # to_body is an alias to to_hash (backward compatibility)
131
+ # @return [Hash] Returns the object in the form of hash
132
+ def to_body
133
+ to_hash
134
+ end
135
+
136
+ # Returns the object in the form of hash
137
+ # @return [Hash] Returns the object in the form of hash
138
+ def to_hash
139
+ hash = {}
140
+ self.class.attribute_map.each_pair do |attr, param|
141
+ value = self.send(attr)
142
+ next if value.nil?
143
+
144
+ hash[param] = _to_hash(value)
145
+ end
146
+ hash
147
+ end
148
+
149
+ # Outputs non-array value in the form of hash
150
+ # For object, use to_hash. Otherwise, just return the value
151
+ # @param value [Object] Any valid value
152
+ # @return [Hash] Returns the value in the form of hash
153
+ def _to_hash(value)
154
+ if value.is_a?(Array)
155
+ value.compact.map { |v| _to_hash(v) }
156
+ elsif value.is_a?(Hash)
157
+ {}.tap do |hash|
158
+ value.each { |k, v| hash[k] = _to_hash(v) }
159
+ end
160
+ elsif value.respond_to? :to_hash
161
+ value.to_hash
162
+ else
163
+ value
164
+ end
165
+ end
166
+
167
+ def to_json(*a)
168
+ to_hash.to_json(*a)
169
+ end
170
+ end
171
+ end
@@ -0,0 +1,26 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class CreateTrackingRequestShipmentDirection
5
+ FORWARD = "forward".freeze
6
+ RETURN = "return".freeze
7
+ def self.all_vars
8
+ @all_vars ||= [FORWARD, RETURN,].freeze
9
+ end
10
+
11
+ # Builds the enum from string
12
+ # @param value [String] The enum value in the form of the string
13
+ # @return [String] The enum value
14
+ def self.build_from_hash(value)
15
+ new.build_from_hash(value)
16
+ end
17
+
18
+ # Builds the enum from string
19
+ # @param value [String] The enum value in the form of the string
20
+ # @return [String] The enum value
21
+ def build_from_hash(value)
22
+ return value if CreateTrackingRequestShipmentDirection.all_vars.include?(value)
23
+ raise "Invalid ENUM value #{value} for class #CreateTrackingRequestShipmentDirection"
24
+ end
25
+ end
26
+ end
@@ -26,11 +26,11 @@ module AftershipAPI::Model
26
26
  # package_count?: Integer;
27
27
  attr_accessor :package_count
28
28
 
29
- # The local pickup time in the origin address time zone of the package.Either `pickup_time` or `estimated_pickup` is required.
29
+ # The local pickup time in the origin address time zone of the package.</br><span style=color:#ff6b2b;padding:2px>**Either `pickup_time` or `estimated_pickup` is required.**</span>
30
30
  # pickup_time?: String;
31
31
  attr_accessor :pickup_time
32
32
 
33
- # The local pickup time of the package.Either `pickup_time` or `estimated_pickup` is required.
33
+ # The local pickup time of the package.</br><span style=color:#ff6b2b;padding:2px>**Either `pickup_time` or `estimated_pickup` is required.**</span>
34
34
  # estimated_pickup?: EstimatedDeliveryDateRequestEstimatedPickup;
35
35
  attr_accessor :estimated_pickup
36
36
 
@@ -6,7 +6,7 @@ module AftershipAPI::Model
6
6
  # country_region: String;
7
7
  attr_accessor :country_region
8
8
 
9
- # State, province, or the equivalent location of the destination address where the package will be delivered.Either `destination_address.state` or `destination_address.postal_code` is required.
9
+ # State, province, or the equivalent location of the destination address where the package will be delivered.</br><span style=color:#ff6b2b;padding:2px>**Either `destination_address.state` or `destination_address.postal_code` is required.**</span>
10
10
  # state?: String;
11
11
  attr_accessor :state
12
12
 
@@ -14,7 +14,7 @@ module AftershipAPI::Model
14
14
  # city?: String;
15
15
  attr_accessor :city
16
16
 
17
- # Postal code of the destination address.Either `destination_address.state` or `destination_address.postal_code` is required.
17
+ # Postal code of the destination address.</br><span style=color:#ff6b2b;padding:2px>**Either `destination_address.state` or `destination_address.postal_code` is required.**</span>
18
18
  # postal_code?: String;
19
19
  attr_accessor :postal_code
20
20