aftership-tracking-sdk 7.0.0 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/README.md +68 -83
  4. data/lib/aftership-tracking-sdk/api/courier.rb +8 -8
  5. data/lib/aftership-tracking-sdk/api/estimated_delivery_date.rb +4 -4
  6. data/lib/aftership-tracking-sdk/api/tracking.rb +50 -416
  7. data/lib/aftership-tracking-sdk/api_client.rb +2 -2
  8. data/lib/aftership-tracking-sdk/configuration.rb +108 -108
  9. data/lib/aftership-tracking-sdk/models/additional_fields_v1.rb +1 -1
  10. data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_create_tracking_response.rb +183 -0
  11. data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_delete_tracking_by_id_response.rb +183 -0
  12. data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_get_tracking_by_id_response.rb +183 -0
  13. data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_mark_tracking_completed_by_id_response.rb +183 -0
  14. data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_retrack_tracking_by_id_response.rb +183 -0
  15. data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_tracking.rb +2 -0
  16. data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_update_tracking_by_id_response.rb +183 -0
  17. data/lib/aftership-tracking-sdk/models/carbon_emissions_create_tracking_response.rb +163 -0
  18. data/lib/aftership-tracking-sdk/models/carbon_emissions_delete_tracking_by_id_response.rb +163 -0
  19. data/lib/aftership-tracking-sdk/models/carbon_emissions_get_tracking_by_id_response.rb +163 -0
  20. data/lib/aftership-tracking-sdk/models/carbon_emissions_mark_tracking_completed_by_id_response.rb +163 -0
  21. data/lib/aftership-tracking-sdk/models/carbon_emissions_retrack_tracking_by_id_response.rb +163 -0
  22. data/lib/aftership-tracking-sdk/models/carbon_emissions_tracking.rb +2 -0
  23. data/lib/aftership-tracking-sdk/models/carbon_emissions_update_tracking_by_id_response.rb +163 -0
  24. data/lib/aftership-tracking-sdk/models/checkpoint.rb +2 -0
  25. data/lib/aftership-tracking-sdk/models/coordinate_checkpoint.rb +2 -0
  26. data/lib/aftership-tracking-sdk/models/courier.rb +2 -0
  27. data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_create_tracking_response.rb +173 -0
  28. data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_delete_tracking_by_id_response.rb +173 -0
  29. data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_get_tracking_by_id_response.rb +173 -0
  30. data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_mark_tracking_completed_by_id_response.rb +173 -0
  31. data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_retrack_tracking_by_id_response.rb +173 -0
  32. data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_tracking.rb +173 -0
  33. data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_update_tracking_by_id_response.rb +173 -0
  34. data/lib/aftership-tracking-sdk/models/courier_response_v1.rb +2 -0
  35. data/lib/aftership-tracking-sdk/models/{tracking_create_tracking_request.rb → create_tracking_request.rb} +9 -7
  36. data/lib/aftership-tracking-sdk/models/create_tracking_response.rb +953 -0
  37. data/lib/aftership-tracking-sdk/models/{mark_tracking_completed_by_slug_tracking_number_request.rb → custom_estimated_delivery_date_create_tracking_response.rb} +41 -9
  38. data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_delete_tracking_by_id_response.rb +183 -0
  39. data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_get_tracking_by_id_response.rb +183 -0
  40. data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_mark_tracking_completed_by_id_response.rb +183 -0
  41. data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_retrack_tracking_by_id_response.rb +183 -0
  42. data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_tracking.rb +2 -0
  43. data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_update_tracking_by_id_response.rb +183 -0
  44. data/lib/aftership-tracking-sdk/models/data_courier_response_v1.rb +2 -0
  45. data/lib/aftership-tracking-sdk/models/data_tracking_response_get_multiple_v1.rb +8 -126
  46. data/lib/aftership-tracking-sdk/models/delete_tracking_by_id_response.rb +953 -0
  47. data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_request.rb +2 -0
  48. data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_response.rb +2 -0
  49. data/lib/aftership-tracking-sdk/models/{tracking_detect_courier_request.rb → detect_courier_request.rb} +5 -3
  50. data/lib/aftership-tracking-sdk/models/detect_courier_response.rb +2 -0
  51. data/lib/aftership-tracking-sdk/models/estimated_delivery_date_request.rb +2 -0
  52. data/lib/aftership-tracking-sdk/models/estimated_delivery_date_response.rb +12 -0
  53. data/lib/aftership-tracking-sdk/models/estimated_pickup_estimated_delivery_date_request.rb +2 -0
  54. data/lib/aftership-tracking-sdk/models/estimated_pickup_estimated_delivery_date_response.rb +2 -0
  55. data/lib/aftership-tracking-sdk/models/events_checkpoint.rb +2 -0
  56. data/lib/aftership-tracking-sdk/models/first_estimated_delivery_create_tracking_response.rb +193 -0
  57. data/lib/aftership-tracking-sdk/models/first_estimated_delivery_delete_tracking_by_id_response.rb +193 -0
  58. data/lib/aftership-tracking-sdk/models/first_estimated_delivery_get_tracking_by_id_response.rb +193 -0
  59. data/lib/aftership-tracking-sdk/models/first_estimated_delivery_mark_tracking_completed_by_id_response.rb +193 -0
  60. data/lib/aftership-tracking-sdk/models/first_estimated_delivery_retrack_tracking_by_id_response.rb +193 -0
  61. data/lib/aftership-tracking-sdk/models/first_estimated_delivery_tracking.rb +2 -0
  62. data/lib/aftership-tracking-sdk/models/first_estimated_delivery_update_tracking_by_id_response.rb +193 -0
  63. data/lib/aftership-tracking-sdk/models/get_all_couriers_response.rb +2 -0
  64. data/lib/aftership-tracking-sdk/models/get_tracking_by_id_response.rb +953 -0
  65. data/lib/aftership-tracking-sdk/models/get_trackings_response.rb +5 -3
  66. data/lib/aftership-tracking-sdk/models/get_user_couriers_response.rb +2 -0
  67. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_create_tracking_response.rb +193 -0
  68. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_delete_tracking_by_id_response.rb +193 -0
  69. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_get_tracking_by_id_response.rb +193 -0
  70. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_mark_tracking_completed_by_id_response.rb +193 -0
  71. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_retrack_tracking_by_id_response.rb +193 -0
  72. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_tracking.rb +2 -0
  73. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_update_tracking_by_id_response.rb +193 -0
  74. data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_request.rb +2 -0
  75. data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_response.rb +953 -0
  76. data/lib/aftership-tracking-sdk/models/meta_v1.rb +2 -0
  77. data/lib/aftership-tracking-sdk/models/{next_couriers_tracking_create_tracking_request.rb → next_couriers_create_tracking_request.rb} +4 -2
  78. data/lib/aftership-tracking-sdk/models/{get_checkpoint_by_tracking_id_response.rb → next_couriers_create_tracking_response.rb} +33 -51
  79. data/lib/aftership-tracking-sdk/models/next_couriers_delete_tracking_by_id_response.rb +193 -0
  80. data/lib/aftership-tracking-sdk/models/{get_checkpoint_by_slug_tracking_number_response.rb → next_couriers_get_tracking_by_id_response.rb} +33 -51
  81. data/lib/aftership-tracking-sdk/models/next_couriers_mark_tracking_completed_by_id_response.rb +193 -0
  82. data/lib/aftership-tracking-sdk/models/next_couriers_retrack_tracking_by_id_response.rb +193 -0
  83. data/lib/aftership-tracking-sdk/models/next_couriers_tracking.rb +22 -0
  84. data/lib/aftership-tracking-sdk/models/next_couriers_update_tracking_by_id_response.rb +193 -0
  85. data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_estimated_delivery_date_request.rb +2 -0
  86. data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_estimated_delivery_date_response.rb +2 -0
  87. data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_request.rb +2 -0
  88. data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_response.rb +2 -0
  89. data/lib/aftership-tracking-sdk/models/pagination.rb +14 -6
  90. data/lib/aftership-tracking-sdk/models/pagination_data_tracking_response_get_multiple_v1.rb +173 -0
  91. data/lib/aftership-tracking-sdk/models/{notification_request_v1.rb → pagination_get_trackings_response.rb} +28 -16
  92. data/lib/aftership-tracking-sdk/models/predict_batch_request.rb +2 -0
  93. data/lib/aftership-tracking-sdk/models/predict_batch_response.rb +2 -0
  94. data/lib/aftership-tracking-sdk/models/reason_events_checkpoint.rb +2 -0
  95. data/lib/aftership-tracking-sdk/models/retrack_tracking_by_id_response.rb +953 -0
  96. data/lib/aftership-tracking-sdk/models/{tracking_delete_response_v1.rb → shipment_weight_create_tracking_response.rb} +18 -16
  97. data/lib/aftership-tracking-sdk/models/{data_notification_response_v1.rb → shipment_weight_delete_tracking_by_id_response.rb} +21 -9
  98. data/lib/aftership-tracking-sdk/models/{notification.rb → shipment_weight_get_tracking_by_id_response.rb} +18 -16
  99. data/lib/aftership-tracking-sdk/models/shipment_weight_mark_tracking_completed_by_id_response.rb +163 -0
  100. data/lib/aftership-tracking-sdk/models/shipment_weight_retrack_tracking_by_id_response.rb +163 -0
  101. data/lib/aftership-tracking-sdk/models/{notification_response_v1.rb → shipment_weight_tracking.rb} +18 -16
  102. data/lib/aftership-tracking-sdk/models/shipment_weight_update_tracking_by_id_response.rb +163 -0
  103. data/lib/aftership-tracking-sdk/models/slug_group_v1.rb +1 -1
  104. data/lib/aftership-tracking-sdk/models/tag_v1.rb +1 -1
  105. data/lib/aftership-tracking-sdk/models/tracking.rb +56 -24
  106. data/lib/aftership-tracking-sdk/models/tracking_response_get_multiple_v1.rb +2 -0
  107. data/lib/aftership-tracking-sdk/models/tracking_response_v1.rb +5 -3
  108. data/lib/aftership-tracking-sdk/models/{tracking_update_tracking_by_id_request.rb → update_tracking_by_id_request.rb} +5 -3
  109. data/lib/aftership-tracking-sdk/models/update_tracking_by_id_response.rb +953 -0
  110. data/lib/aftership-tracking-sdk/models/weight_estimated_delivery_date_request.rb +2 -0
  111. data/lib/aftership-tracking-sdk/models/weight_estimated_delivery_date_response.rb +2 -0
  112. data/lib/aftership-tracking-sdk/version.rb +1 -1
  113. metadata +64 -22
  114. data/lib/aftership-tracking-sdk/api/last_checkpoint.rb +0 -143
  115. data/lib/aftership-tracking-sdk/api/notification.rb +0 -403
  116. data/lib/aftership-tracking-sdk/models/custom_fields_tracking_update_tracking_by_slug_tracking_number_request.rb +0 -139
  117. data/lib/aftership-tracking-sdk/models/data_tracking_delete_response_v1.rb +0 -151
  118. data/lib/aftership-tracking-sdk/models/data_tracking_response_v1.rb +0 -151
  119. data/lib/aftership-tracking-sdk/models/partial_delete_tracking.rb +0 -241
  120. data/lib/aftership-tracking-sdk/models/partial_update_tracking.rb +0 -251
  121. data/lib/aftership-tracking-sdk/models/tracking_update_tracking_by_slug_tracking_number_request.rb +0 -391
@@ -1,391 +0,0 @@
1
- # This code was auto generated by AfterShip SDK Generator.
2
- # Do not edit the class manually.
3
- module AftershipAPI::Model
4
- class TrackingUpdateTrackingBySlugTrackingNumberRequest
5
- # The phone number(s) to receive sms notifications. Supports up to 3 phone numbers.
6
- # smses?: String[];
7
- attr_accessor :smses
8
-
9
- # Email address(es) to receive email notifications. Supports up to 3 email addresses.
10
- # emails?: String[];
11
- attr_accessor :emails
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
- # Customer name of the tracking.
18
- # customer_name?: String;
19
- attr_accessor :customer_name
20
-
21
- # A globally-unique identifier for the order.
22
- # order_id?: String;
23
- attr_accessor :order_id
24
-
25
- # The URL for the order in your system or store.
26
- # order_id_path?: String;
27
- attr_accessor :order_id_path
28
-
29
- # Custom fields that accept an object with string field. In order to protect the privacy of your customers, do not include any
30
- # custom_fields?: CustomFieldsTrackingUpdateTrackingBySlugTrackingNumberRequest;
31
- attr_accessor :custom_fields
32
-
33
- # Text field for the note
34
- # note?: String;
35
- attr_accessor :note
36
-
37
- # 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.
38
- # language?: String;
39
- attr_accessor :language
40
-
41
- # 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.
42
- # order_promised_delivery_date?: String;
43
- attr_accessor :order_promised_delivery_date
44
-
45
- # Shipment delivery type- `pickup_at_store`- `pickup_at_courier`- `door_to_door`
46
- # delivery_type?: String;
47
- attr_accessor :delivery_type
48
-
49
- # Shipment pickup location for receiver
50
- # pickup_location?: String;
51
- attr_accessor :pickup_location
52
-
53
- # Shipment pickup note for receiver
54
- # pickup_note?: String;
55
- attr_accessor :pickup_note
56
-
57
- # Unique code of each courier. Provide a single courier.(https://admin.aftership.com/settings/couriers). Get a list of courier slug using
58
- # slug?: String;
59
- attr_accessor :slug
60
-
61
- # 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.
62
- # tracking_account_number?: String;
63
- attr_accessor :tracking_account_number
64
-
65
- # 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.
66
- # tracking_origin_country?: String;
67
- attr_accessor :tracking_origin_country
68
-
69
- # 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.
70
- # tracking_destination_country?: String;
71
- attr_accessor :tracking_destination_country
72
-
73
- # 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.
74
- # tracking_key?: String;
75
- attr_accessor :tracking_key
76
-
77
- # 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.
78
- # tracking_postal_code?: String;
79
- attr_accessor :tracking_postal_code
80
-
81
- # 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.
82
- # tracking_ship_date?: String;
83
- attr_accessor :tracking_ship_date
84
-
85
- # 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.
86
- # tracking_state?: String;
87
- attr_accessor :tracking_state
88
-
89
- # A unique, human-readable identifier for the order.
90
- # order_number?: String;
91
- attr_accessor :order_number
92
-
93
- # Order date in YYYY-MM-DDTHH:mm:ssZ format. e.g. 2021-07-26T11:23:51-05:00
94
- # order_date?: String;
95
- attr_accessor :order_date
96
-
97
- # 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 .
98
- # location_id?: String;
99
- attr_accessor :location_id
100
-
101
- # 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.
102
- # shipping_method?: String;
103
- attr_accessor :shipping_method
104
-
105
- # Initializes the object
106
- # @param [Hash] attributes Model attributes in the form of hash
107
- def initialize(attributes = {})
108
- if (!attributes.is_a?(Hash))
109
- fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::TrackingUpdateTrackingBySlugTrackingNumberRequest` initialize method"
110
- end
111
-
112
- attributes = attributes.each_with_object({}) { |(k, v), h|
113
- h[k.to_sym] = v
114
- }
115
-
116
- if attributes.key?(:'smses')
117
- self.smses = attributes[:'smses']
118
- end
119
-
120
- if attributes.key?(:'emails')
121
- self.emails = attributes[:'emails']
122
- end
123
-
124
- if attributes.key?(:'title')
125
- self.title = attributes[:'title']
126
- end
127
-
128
- if attributes.key?(:'customer_name')
129
- self.customer_name = attributes[:'customer_name']
130
- end
131
-
132
- if attributes.key?(:'order_id')
133
- self.order_id = attributes[:'order_id']
134
- end
135
-
136
- if attributes.key?(:'order_id_path')
137
- self.order_id_path = attributes[:'order_id_path']
138
- end
139
-
140
- if attributes.key?(:'custom_fields')
141
- self.custom_fields = attributes[:'custom_fields']
142
- end
143
-
144
- if attributes.key?(:'note')
145
- self.note = attributes[:'note']
146
- end
147
-
148
- if attributes.key?(:'language')
149
- self.language = attributes[:'language']
150
- end
151
-
152
- if attributes.key?(:'order_promised_delivery_date')
153
- self.order_promised_delivery_date = attributes[:'order_promised_delivery_date']
154
- end
155
-
156
- if attributes.key?(:'delivery_type')
157
- self.delivery_type = attributes[:'delivery_type']
158
- end
159
-
160
- if attributes.key?(:'pickup_location')
161
- self.pickup_location = attributes[:'pickup_location']
162
- end
163
-
164
- if attributes.key?(:'pickup_note')
165
- self.pickup_note = attributes[:'pickup_note']
166
- end
167
-
168
- if attributes.key?(:'slug')
169
- self.slug = attributes[:'slug']
170
- end
171
-
172
- if attributes.key?(:'tracking_account_number')
173
- self.tracking_account_number = attributes[:'tracking_account_number']
174
- end
175
-
176
- if attributes.key?(:'tracking_origin_country')
177
- self.tracking_origin_country = attributes[:'tracking_origin_country']
178
- end
179
-
180
- if attributes.key?(:'tracking_destination_country')
181
- self.tracking_destination_country = attributes[:'tracking_destination_country']
182
- end
183
-
184
- if attributes.key?(:'tracking_key')
185
- self.tracking_key = attributes[:'tracking_key']
186
- end
187
-
188
- if attributes.key?(:'tracking_postal_code')
189
- self.tracking_postal_code = attributes[:'tracking_postal_code']
190
- end
191
-
192
- if attributes.key?(:'tracking_ship_date')
193
- self.tracking_ship_date = attributes[:'tracking_ship_date']
194
- end
195
-
196
- if attributes.key?(:'tracking_state')
197
- self.tracking_state = attributes[:'tracking_state']
198
- end
199
-
200
- if attributes.key?(:'order_number')
201
- self.order_number = attributes[:'order_number']
202
- end
203
-
204
- if attributes.key?(:'order_date')
205
- self.order_date = attributes[:'order_date']
206
- end
207
-
208
- if attributes.key?(:'location_id')
209
- self.location_id = attributes[:'location_id']
210
- end
211
-
212
- if attributes.key?(:'shipping_method')
213
- self.shipping_method = attributes[:'shipping_method']
214
- end
215
- end
216
-
217
- # Attribute type mapping.
218
- def self.openapi_types
219
- {
220
- :'smses' => :'Array<String>',
221
- :'emails' => :'Array<String>',
222
- :'title' => :'String',
223
- :'customer_name' => :'String',
224
- :'order_id' => :'String',
225
- :'order_id_path' => :'String',
226
- :'custom_fields' => :'CustomFieldsTrackingUpdateTrackingBySlugTrackingNumberRequest',
227
- :'note' => :'String',
228
- :'language' => :'String',
229
- :'order_promised_delivery_date' => :'String',
230
- :'delivery_type' => :'String',
231
- :'pickup_location' => :'String',
232
- :'pickup_note' => :'String',
233
- :'slug' => :'String',
234
- :'tracking_account_number' => :'String',
235
- :'tracking_origin_country' => :'String',
236
- :'tracking_destination_country' => :'String',
237
- :'tracking_key' => :'String',
238
- :'tracking_postal_code' => :'String',
239
- :'tracking_ship_date' => :'String',
240
- :'tracking_state' => :'String',
241
- :'order_number' => :'String',
242
- :'order_date' => :'String',
243
- :'location_id' => :'String',
244
- :'shipping_method' => :'String',
245
- }
246
- end
247
-
248
- # Attribute mapping from ruby-style variable name to JSON key.
249
- def self.attribute_map
250
- {
251
- :'smses' => :'smses',
252
- :'emails' => :'emails',
253
- :'title' => :'title',
254
- :'customer_name' => :'customer_name',
255
- :'order_id' => :'order_id',
256
- :'order_id_path' => :'order_id_path',
257
- :'custom_fields' => :'custom_fields',
258
- :'note' => :'note',
259
- :'language' => :'language',
260
- :'order_promised_delivery_date' => :'order_promised_delivery_date',
261
- :'delivery_type' => :'delivery_type',
262
- :'pickup_location' => :'pickup_location',
263
- :'pickup_note' => :'pickup_note',
264
- :'slug' => :'slug',
265
- :'tracking_account_number' => :'tracking_account_number',
266
- :'tracking_origin_country' => :'tracking_origin_country',
267
- :'tracking_destination_country' => :'tracking_destination_country',
268
- :'tracking_key' => :'tracking_key',
269
- :'tracking_postal_code' => :'tracking_postal_code',
270
- :'tracking_ship_date' => :'tracking_ship_date',
271
- :'tracking_state' => :'tracking_state',
272
- :'order_number' => :'order_number',
273
- :'order_date' => :'order_date',
274
- :'location_id' => :'location_id',
275
- :'shipping_method' => :'shipping_method',
276
- }
277
- end
278
-
279
- # Builds the object from hash
280
- # @param attributes [Hash] Model attributes in the form of hash
281
- # @return [Object] Returns the model itself
282
- def self.build_from_hash(attributes)
283
- return nil unless attributes.is_a?(Hash)
284
- attributes = attributes.transform_keys(&:to_sym)
285
- transformed_hash = {}
286
- openapi_types.each_pair do |key, type|
287
- if attributes.key?(key) && attributes[key].nil?
288
- transformed_hash["#{key}"] = nil
289
- elsif type =~ /\AArray<(.*)>/i
290
- # check to ensure the input is an array given that the attribute
291
- # is documented as an array but the input is not
292
- if attributes[key].is_a?(Array)
293
- transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
294
- end
295
- elsif !attributes[key].nil?
296
- transformed_hash["#{key}"] = _deserialize(type, attributes[key])
297
- end
298
- end
299
- new(transformed_hash)
300
- end
301
-
302
- # Deserializes the data based on type
303
- # @param type [String] Data type
304
- # @param value [String] Value to be deserialized
305
- # @return [Object] Deserialized data
306
- def self._deserialize(type, value)
307
- case type.to_sym
308
- when :Time
309
- Time.parse(value)
310
- when :Date
311
- Date.parse(value)
312
- when :String
313
- value.to_s
314
- when :Integer
315
- value.to_i
316
- when :Float
317
- value.to_f
318
- when :Boolean
319
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
320
- true
321
- else
322
- false
323
- end
324
- when :Object
325
- # generic object (usually a Hash), return directly
326
- value
327
- when /\AArray<(?<inner_type>.+)>\z/
328
- inner_type = Regexp.last_match[:inner_type]
329
- value.map { |v| _deserialize(inner_type, v) }
330
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
331
- k_type = Regexp.last_match[:k_type]
332
- v_type = Regexp.last_match[:v_type]
333
- {}.tap do |hash|
334
- value.each do |k, v|
335
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
336
- end
337
- end
338
- else # model
339
- klass = AftershipAPI::Model.const_get(type)
340
- klass.build_from_hash(value)
341
- end
342
- end
343
-
344
- # Returns the string representation of the object
345
- # @return [String] String presentation of the object
346
- def to_s
347
- to_hash.to_s
348
- end
349
-
350
- # to_body is an alias to to_hash (backward compatibility)
351
- # @return [Hash] Returns the object in the form of hash
352
- def to_body
353
- to_hash
354
- end
355
-
356
- # Returns the object in the form of hash
357
- # @return [Hash] Returns the object in the form of hash
358
- def to_hash
359
- hash = {}
360
- self.class.attribute_map.each_pair do |attr, param|
361
- value = self.send(attr)
362
- next if value.nil?
363
-
364
- hash[param] = _to_hash(value)
365
- end
366
- hash
367
- end
368
-
369
- # Outputs non-array value in the form of hash
370
- # For object, use to_hash. Otherwise, just return the value
371
- # @param value [Object] Any valid value
372
- # @return [Hash] Returns the value in the form of hash
373
- def _to_hash(value)
374
- if value.is_a?(Array)
375
- value.compact.map { |v| _to_hash(v) }
376
- elsif value.is_a?(Hash)
377
- {}.tap do |hash|
378
- value.each { |k, v| hash[k] = _to_hash(v) }
379
- end
380
- elsif value.respond_to? :to_hash
381
- value.to_hash
382
- else
383
- value
384
- end
385
- end
386
-
387
- def to_json(*a)
388
- to_hash.to_json(*a)
389
- end
390
- end
391
- end