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,221 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class EstimatedDeliveryDateRequest
5
+ # AfterShip's unique code of courier. Please refer to https://track.aftership.com/couriers/download.
6
+ # slug: String;
7
+ attr_accessor :slug
8
+
9
+ # AfterShip’s unique code represents carrier’s shipping and delivery options. Refer to .
10
+ # service_type_name?: String;
11
+ attr_accessor :service_type_name
12
+
13
+ # The location from where the package is picked up by the carrier to be delivered to the final destination.
14
+ # origin_address: OriginAddressEstimatedDeliveryDateRequest;
15
+ attr_accessor :origin_address
16
+
17
+ # The final destination of the customer where the delivery will be made.
18
+ # destination_address: DestinationAddressEstimatedDeliveryDateRequest;
19
+ attr_accessor :destination_address
20
+
21
+ # AfterShip uses this object to calculate the total weight of the order.
22
+ # weight?: WeightEstimatedDeliveryDateRequest;
23
+ attr_accessor :weight
24
+
25
+ # The number of packages.
26
+ # package_count?: Integer;
27
+ attr_accessor :package_count
28
+
29
+ # The local pickup time in the origin address time zone of the package.Either `pickup_time` or `estimated_pickup` is required.
30
+ # pickup_time?: String;
31
+ attr_accessor :pickup_time
32
+
33
+ # The local pickup time of the package.Either `pickup_time` or `estimated_pickup` is required.
34
+ # estimated_pickup?: EstimatedPickupEstimatedDeliveryDateRequest;
35
+ attr_accessor :estimated_pickup
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ if (!attributes.is_a?(Hash))
41
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::EstimatedDeliveryDateRequest` initialize method"
42
+ end
43
+
44
+ attributes = attributes.each_with_object({}) { |(k, v), h|
45
+ h[k.to_sym] = v
46
+ }
47
+
48
+ if attributes.key?(:'slug')
49
+ self.slug = attributes[:'slug']
50
+ end
51
+
52
+ if attributes.key?(:'service_type_name')
53
+ self.service_type_name = attributes[:'service_type_name']
54
+ end
55
+
56
+ if attributes.key?(:'origin_address')
57
+ self.origin_address = attributes[:'origin_address']
58
+ end
59
+
60
+ if attributes.key?(:'destination_address')
61
+ self.destination_address = attributes[:'destination_address']
62
+ end
63
+
64
+ if attributes.key?(:'weight')
65
+ self.weight = attributes[:'weight']
66
+ end
67
+
68
+ if attributes.key?(:'package_count')
69
+ self.package_count = attributes[:'package_count']
70
+ end
71
+
72
+ if attributes.key?(:'pickup_time')
73
+ self.pickup_time = attributes[:'pickup_time']
74
+ end
75
+
76
+ if attributes.key?(:'estimated_pickup')
77
+ self.estimated_pickup = attributes[:'estimated_pickup']
78
+ end
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.openapi_types
83
+ {
84
+ :'slug' => :'String',
85
+ :'service_type_name' => :'String',
86
+ :'origin_address' => :'OriginAddressEstimatedDeliveryDateRequest',
87
+ :'destination_address' => :'DestinationAddressEstimatedDeliveryDateRequest',
88
+ :'weight' => :'WeightEstimatedDeliveryDateRequest',
89
+ :'package_count' => :'Integer',
90
+ :'pickup_time' => :'String',
91
+ :'estimated_pickup' => :'EstimatedPickupEstimatedDeliveryDateRequest',
92
+ }
93
+ end
94
+
95
+ # Attribute mapping from ruby-style variable name to JSON key.
96
+ def self.attribute_map
97
+ {
98
+ :'slug' => :'slug',
99
+ :'service_type_name' => :'service_type_name',
100
+ :'origin_address' => :'origin_address',
101
+ :'destination_address' => :'destination_address',
102
+ :'weight' => :'weight',
103
+ :'package_count' => :'package_count',
104
+ :'pickup_time' => :'pickup_time',
105
+ :'estimated_pickup' => :'estimated_pickup',
106
+ }
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param attributes [Hash] Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ attributes = attributes.transform_keys(&:to_sym)
115
+ transformed_hash = {}
116
+ openapi_types.each_pair do |key, type|
117
+ if attributes.key?(key) && attributes[key].nil?
118
+ transformed_hash["#{key}"] = nil
119
+ elsif type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[key].is_a?(Array)
123
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
124
+ end
125
+ elsif !attributes[key].nil?
126
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
127
+ end
128
+ end
129
+ new(transformed_hash)
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param type [String] Data type
134
+ # @param value [String] Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def self._deserialize(type, value)
137
+ case type.to_sym
138
+ when :Time
139
+ Time.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :Boolean
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else # model
169
+ klass = AftershipAPI::Model.const_get(type)
170
+ klass.build_from_hash(value)
171
+ end
172
+ end
173
+
174
+ # Returns the string representation of the object
175
+ # @return [String] String presentation of the object
176
+ def to_s
177
+ to_hash.to_s
178
+ end
179
+
180
+ # to_body is an alias to to_hash (backward compatibility)
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_body
183
+ to_hash
184
+ end
185
+
186
+ # Returns the object in the form of hash
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_hash
189
+ hash = {}
190
+ self.class.attribute_map.each_pair do |attr, param|
191
+ value = self.send(attr)
192
+ next if value.nil?
193
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param value [Object] Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+
217
+ def to_json(*a)
218
+ to_hash.to_json(*a)
219
+ end
220
+ end
221
+ end
@@ -0,0 +1,261 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class EstimatedDeliveryDateResponse
5
+ # AfterShip's unique code of courier. Please refer to https://track.aftership.com/couriers/download.
6
+ # slug: String;
7
+ attr_accessor :slug
8
+
9
+ # AfterShip’s unique code represents carrier’s shipping and delivery options. Refer to .
10
+ # service_type_name?: String;
11
+ attr_accessor :service_type_name
12
+
13
+ # The location from where the package is picked up by the carrier to be delivered to the final destination.
14
+ # origin_address: OriginAddressEstimatedDeliveryDateResponse;
15
+ attr_accessor :origin_address
16
+
17
+ # The final destination of the customer where the delivery will be made.
18
+ # destination_address: DestinationAddressEstimatedDeliveryDateResponse;
19
+ attr_accessor :destination_address
20
+
21
+ # AfterShip uses this object to calculate the total weight of the order.
22
+ # weight?: WeightEstimatedDeliveryDateResponse;
23
+ attr_accessor :weight
24
+
25
+ # The number of packages.
26
+ # package_count?: Integer;
27
+ attr_accessor :package_count
28
+
29
+ # The local pickup time in the origin address time zone of the package.Either `pickup_time` or `estimated_pickup` is required.
30
+ # pickup_time?: String;
31
+ attr_accessor :pickup_time
32
+
33
+ # The local pickup time of the package.Either `pickup_time` or `estimated_pickup` is required.
34
+ # estimated_pickup?: EstimatedPickupEstimatedDeliveryDateResponse;
35
+ attr_accessor :estimated_pickup
36
+
37
+ # The estimated arrival date of the shipment, provided by AfterShip.
38
+ # estimated_delivery_date?: String;
39
+ attr_accessor :estimated_delivery_date
40
+
41
+ # Indicates the confidence level and associated reason for an AI EDD prediction request. For a comprehensive list of confidence codes, refer to .
42
+ # confidence_code?: Float;
43
+ attr_accessor :confidence_code
44
+
45
+ # The earliest estimated delivery date of the shipment, provided by AfterShip.
46
+ # estimated_delivery_date_min?: String;
47
+ attr_accessor :estimated_delivery_date_min
48
+
49
+ # The latest estimated delivery date of the shipment, provided by AfterShip.
50
+ # estimated_delivery_date_max?: String;
51
+ attr_accessor :estimated_delivery_date_max
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::EstimatedDeliveryDateResponse` initialize method"
58
+ end
59
+
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'slug')
65
+ self.slug = attributes[:'slug']
66
+ end
67
+
68
+ if attributes.key?(:'service_type_name')
69
+ self.service_type_name = attributes[:'service_type_name']
70
+ end
71
+
72
+ if attributes.key?(:'origin_address')
73
+ self.origin_address = attributes[:'origin_address']
74
+ end
75
+
76
+ if attributes.key?(:'destination_address')
77
+ self.destination_address = attributes[:'destination_address']
78
+ end
79
+
80
+ if attributes.key?(:'weight')
81
+ self.weight = attributes[:'weight']
82
+ end
83
+
84
+ if attributes.key?(:'package_count')
85
+ self.package_count = attributes[:'package_count']
86
+ end
87
+
88
+ if attributes.key?(:'pickup_time')
89
+ self.pickup_time = attributes[:'pickup_time']
90
+ end
91
+
92
+ if attributes.key?(:'estimated_pickup')
93
+ self.estimated_pickup = attributes[:'estimated_pickup']
94
+ end
95
+
96
+ if attributes.key?(:'estimated_delivery_date')
97
+ self.estimated_delivery_date = attributes[:'estimated_delivery_date']
98
+ end
99
+
100
+ if attributes.key?(:'confidence_code')
101
+ self.confidence_code = attributes[:'confidence_code']
102
+ end
103
+
104
+ if attributes.key?(:'estimated_delivery_date_min')
105
+ self.estimated_delivery_date_min = attributes[:'estimated_delivery_date_min']
106
+ end
107
+
108
+ if attributes.key?(:'estimated_delivery_date_max')
109
+ self.estimated_delivery_date_max = attributes[:'estimated_delivery_date_max']
110
+ end
111
+ end
112
+
113
+ # Attribute type mapping.
114
+ def self.openapi_types
115
+ {
116
+ :'slug' => :'String',
117
+ :'service_type_name' => :'String',
118
+ :'origin_address' => :'OriginAddressEstimatedDeliveryDateResponse',
119
+ :'destination_address' => :'DestinationAddressEstimatedDeliveryDateResponse',
120
+ :'weight' => :'WeightEstimatedDeliveryDateResponse',
121
+ :'package_count' => :'Integer',
122
+ :'pickup_time' => :'String',
123
+ :'estimated_pickup' => :'EstimatedPickupEstimatedDeliveryDateResponse',
124
+ :'estimated_delivery_date' => :'String',
125
+ :'confidence_code' => :'Float',
126
+ :'estimated_delivery_date_min' => :'String',
127
+ :'estimated_delivery_date_max' => :'String',
128
+ }
129
+ end
130
+
131
+ # Attribute mapping from ruby-style variable name to JSON key.
132
+ def self.attribute_map
133
+ {
134
+ :'slug' => :'slug',
135
+ :'service_type_name' => :'service_type_name',
136
+ :'origin_address' => :'origin_address',
137
+ :'destination_address' => :'destination_address',
138
+ :'weight' => :'weight',
139
+ :'package_count' => :'package_count',
140
+ :'pickup_time' => :'pickup_time',
141
+ :'estimated_pickup' => :'estimated_pickup',
142
+ :'estimated_delivery_date' => :'estimated_delivery_date',
143
+ :'confidence_code' => :'confidence_code',
144
+ :'estimated_delivery_date_min' => :'estimated_delivery_date_min',
145
+ :'estimated_delivery_date_max' => :'estimated_delivery_date_max',
146
+ }
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param attributes [Hash] Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def self.build_from_hash(attributes)
153
+ return nil unless attributes.is_a?(Hash)
154
+ attributes = attributes.transform_keys(&:to_sym)
155
+ transformed_hash = {}
156
+ openapi_types.each_pair do |key, type|
157
+ if attributes.key?(key) && attributes[key].nil?
158
+ transformed_hash["#{key}"] = nil
159
+ elsif type =~ /\AArray<(.*)>/i
160
+ # check to ensure the input is an array given that the attribute
161
+ # is documented as an array but the input is not
162
+ if attributes[key].is_a?(Array)
163
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
164
+ end
165
+ elsif !attributes[key].nil?
166
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
167
+ end
168
+ end
169
+ new(transformed_hash)
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param type [String] Data type
174
+ # @param value [String] Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def self._deserialize(type, value)
177
+ case type.to_sym
178
+ when :Time
179
+ Time.parse(value)
180
+ when :Date
181
+ Date.parse(value)
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :Boolean
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+ when :Object
195
+ # generic object (usually a Hash), return directly
196
+ value
197
+ when /\AArray<(?<inner_type>.+)>\z/
198
+ inner_type = Regexp.last_match[:inner_type]
199
+ value.map { |v| _deserialize(inner_type, v) }
200
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
+ k_type = Regexp.last_match[:k_type]
202
+ v_type = Regexp.last_match[:v_type]
203
+ {}.tap do |hash|
204
+ value.each do |k, v|
205
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
+ end
207
+ end
208
+ else # model
209
+ klass = AftershipAPI::Model.const_get(type)
210
+ klass.build_from_hash(value)
211
+ end
212
+ end
213
+
214
+ # Returns the string representation of the object
215
+ # @return [String] String presentation of the object
216
+ def to_s
217
+ to_hash.to_s
218
+ end
219
+
220
+ # to_body is an alias to to_hash (backward compatibility)
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_body
223
+ to_hash
224
+ end
225
+
226
+ # Returns the object in the form of hash
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_hash
229
+ hash = {}
230
+ self.class.attribute_map.each_pair do |attr, param|
231
+ value = self.send(attr)
232
+ next if value.nil?
233
+
234
+ hash[param] = _to_hash(value)
235
+ end
236
+ hash
237
+ end
238
+
239
+ # Outputs non-array value in the form of hash
240
+ # For object, use to_hash. Otherwise, just return the value
241
+ # @param value [Object] Any valid value
242
+ # @return [Hash] Returns the value in the form of hash
243
+ def _to_hash(value)
244
+ if value.is_a?(Array)
245
+ value.compact.map { |v| _to_hash(v) }
246
+ elsif value.is_a?(Hash)
247
+ {}.tap do |hash|
248
+ value.each { |k, v| hash[k] = _to_hash(v) }
249
+ end
250
+ elsif value.respond_to? :to_hash
251
+ value.to_hash
252
+ else
253
+ value
254
+ end
255
+ end
256
+
257
+ def to_json(*a)
258
+ to_hash.to_json(*a)
259
+ end
260
+ end
261
+ end
@@ -0,0 +1,181 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class EstimatedPickupEstimatedDeliveryDateRequest
5
+ # The local order time in the origin address time zone of the package.
6
+ # order_time: String;
7
+ attr_accessor :order_time
8
+
9
+ # Order cut off time in the origin address time zone. The default value set by AfterShip is 18:00:00.
10
+ # order_cutoff_time?: String;
11
+ attr_accessor :order_cutoff_time
12
+
13
+ # Operating days in a week. Number refers to the weekday.E.g., [1,2,3,4,5] means operating days are from Monday to Friday.AfterShip will set [1,2,3,4,5] as the default value.
14
+ # business_days?: Integer[];
15
+ attr_accessor :business_days
16
+
17
+ #
18
+ # order_processing_time?: OrderProcessingTimeEstimatedPickupEstimatedDeliveryDateRequest;
19
+ attr_accessor :order_processing_time
20
+
21
+ # Initializes the object
22
+ # @param [Hash] attributes Model attributes in the form of hash
23
+ def initialize(attributes = {})
24
+ if (!attributes.is_a?(Hash))
25
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::EstimatedPickupEstimatedDeliveryDateRequest` initialize method"
26
+ end
27
+
28
+ attributes = attributes.each_with_object({}) { |(k, v), h|
29
+ h[k.to_sym] = v
30
+ }
31
+
32
+ if attributes.key?(:'order_time')
33
+ self.order_time = attributes[:'order_time']
34
+ end
35
+
36
+ if attributes.key?(:'order_cutoff_time')
37
+ self.order_cutoff_time = attributes[:'order_cutoff_time']
38
+ end
39
+
40
+ if attributes.key?(:'business_days')
41
+ self.business_days = attributes[:'business_days']
42
+ end
43
+
44
+ if attributes.key?(:'order_processing_time')
45
+ self.order_processing_time = attributes[:'order_processing_time']
46
+ end
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'order_time' => :'String',
53
+ :'order_cutoff_time' => :'String',
54
+ :'business_days' => :'Array<Integer>',
55
+ :'order_processing_time' => :'OrderProcessingTimeEstimatedPickupEstimatedDeliveryDateRequest',
56
+ }
57
+ end
58
+
59
+ # Attribute mapping from ruby-style variable name to JSON key.
60
+ def self.attribute_map
61
+ {
62
+ :'order_time' => :'order_time',
63
+ :'order_cutoff_time' => :'order_cutoff_time',
64
+ :'business_days' => :'business_days',
65
+ :'order_processing_time' => :'order_processing_time',
66
+ }
67
+ end
68
+
69
+ # Builds the object from hash
70
+ # @param attributes [Hash] Model attributes in the form of hash
71
+ # @return [Object] Returns the model itself
72
+ def self.build_from_hash(attributes)
73
+ return nil unless attributes.is_a?(Hash)
74
+ attributes = attributes.transform_keys(&:to_sym)
75
+ transformed_hash = {}
76
+ openapi_types.each_pair do |key, type|
77
+ if attributes.key?(key) && attributes[key].nil?
78
+ transformed_hash["#{key}"] = nil
79
+ elsif type =~ /\AArray<(.*)>/i
80
+ # check to ensure the input is an array given that the attribute
81
+ # is documented as an array but the input is not
82
+ if attributes[key].is_a?(Array)
83
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
84
+ end
85
+ elsif !attributes[key].nil?
86
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
87
+ end
88
+ end
89
+ new(transformed_hash)
90
+ end
91
+
92
+ # Deserializes the data based on type
93
+ # @param type [String] Data type
94
+ # @param value [String] Value to be deserialized
95
+ # @return [Object] Deserialized data
96
+ def self._deserialize(type, value)
97
+ case type.to_sym
98
+ when :Time
99
+ Time.parse(value)
100
+ when :Date
101
+ Date.parse(value)
102
+ when :String
103
+ value.to_s
104
+ when :Integer
105
+ value.to_i
106
+ when :Float
107
+ value.to_f
108
+ when :Boolean
109
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
110
+ true
111
+ else
112
+ false
113
+ end
114
+ when :Object
115
+ # generic object (usually a Hash), return directly
116
+ value
117
+ when /\AArray<(?<inner_type>.+)>\z/
118
+ inner_type = Regexp.last_match[:inner_type]
119
+ value.map { |v| _deserialize(inner_type, v) }
120
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
121
+ k_type = Regexp.last_match[:k_type]
122
+ v_type = Regexp.last_match[:v_type]
123
+ {}.tap do |hash|
124
+ value.each do |k, v|
125
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
126
+ end
127
+ end
128
+ else # model
129
+ klass = AftershipAPI::Model.const_get(type)
130
+ klass.build_from_hash(value)
131
+ end
132
+ end
133
+
134
+ # Returns the string representation of the object
135
+ # @return [String] String presentation of the object
136
+ def to_s
137
+ to_hash.to_s
138
+ end
139
+
140
+ # to_body is an alias to to_hash (backward compatibility)
141
+ # @return [Hash] Returns the object in the form of hash
142
+ def to_body
143
+ to_hash
144
+ end
145
+
146
+ # Returns the object in the form of hash
147
+ # @return [Hash] Returns the object in the form of hash
148
+ def to_hash
149
+ hash = {}
150
+ self.class.attribute_map.each_pair do |attr, param|
151
+ value = self.send(attr)
152
+ next if value.nil?
153
+
154
+ hash[param] = _to_hash(value)
155
+ end
156
+ hash
157
+ end
158
+
159
+ # Outputs non-array value in the form of hash
160
+ # For object, use to_hash. Otherwise, just return the value
161
+ # @param value [Object] Any valid value
162
+ # @return [Hash] Returns the value in the form of hash
163
+ def _to_hash(value)
164
+ if value.is_a?(Array)
165
+ value.compact.map { |v| _to_hash(v) }
166
+ elsif value.is_a?(Hash)
167
+ {}.tap do |hash|
168
+ value.each { |k, v| hash[k] = _to_hash(v) }
169
+ end
170
+ elsif value.respond_to? :to_hash
171
+ value.to_hash
172
+ else
173
+ value
174
+ end
175
+ end
176
+
177
+ def to_json(*a)
178
+ to_hash.to_json(*a)
179
+ end
180
+ end
181
+ end