aftership-tracking-sdk 9.0.0 → 10.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +14 -13
  4. data/lib/aftership-tracking-sdk/api/courier.rb +3 -3
  5. data/lib/aftership-tracking-sdk/api/estimated_delivery_date.rb +55 -1
  6. data/lib/aftership-tracking-sdk/api/tracking.rb +16 -16
  7. data/lib/aftership-tracking-sdk/models/additional_fields_v1.rb +3 -3
  8. data/lib/aftership-tracking-sdk/models/checkpoint.rb +22 -12
  9. data/lib/aftership-tracking-sdk/models/courier.rb +7 -7
  10. data/lib/aftership-tracking-sdk/models/create_tracking_request.rb +47 -67
  11. data/lib/aftership-tracking-sdk/models/create_tracking_response.rb +63 -83
  12. data/lib/aftership-tracking-sdk/models/{next_couriers_tracking.rb → customers_create_tracking_request.rb} +37 -37
  13. data/lib/aftership-tracking-sdk/models/customers_create_tracking_response.rb +193 -0
  14. data/lib/aftership-tracking-sdk/models/customers_delete_tracking_by_id_response.rb +193 -0
  15. data/lib/aftership-tracking-sdk/models/customers_get_tracking_by_id_response.rb +193 -0
  16. data/lib/aftership-tracking-sdk/models/customers_mark_tracking_completed_by_id_response.rb +193 -0
  17. data/lib/aftership-tracking-sdk/models/customers_retrack_tracking_by_id_response.rb +193 -0
  18. data/lib/aftership-tracking-sdk/models/customers_tracking.rb +193 -0
  19. data/lib/aftership-tracking-sdk/models/customers_update_tracking_by_id_request.rb +193 -0
  20. data/lib/aftership-tracking-sdk/models/customers_update_tracking_by_id_response.rb +193 -0
  21. data/lib/aftership-tracking-sdk/models/delete_tracking_by_id_response.rb +63 -83
  22. data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_request.rb +6 -6
  23. data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_response.rb +6 -6
  24. data/lib/aftership-tracking-sdk/models/destination_address_predict_request.rb +193 -0
  25. data/lib/aftership-tracking-sdk/models/destination_address_predict_response.rb +193 -0
  26. data/lib/aftership-tracking-sdk/models/detect_courier_request.rb +24 -24
  27. data/lib/aftership-tracking-sdk/models/estimated_pickup_predict_request.rb +183 -0
  28. data/lib/aftership-tracking-sdk/models/estimated_pickup_predict_response.rb +193 -0
  29. data/lib/aftership-tracking-sdk/models/{next_couriers_delete_tracking_by_id_response.rb → first_mile_create_tracking_response.rb} +29 -29
  30. data/lib/aftership-tracking-sdk/models/{next_couriers_get_tracking_by_id_response.rb → first_mile_delete_tracking_by_id_response.rb} +29 -29
  31. data/lib/aftership-tracking-sdk/models/first_mile_get_tracking_by_id_response.rb +193 -0
  32. data/lib/aftership-tracking-sdk/models/first_mile_mark_tracking_completed_by_id_response.rb +193 -0
  33. data/lib/aftership-tracking-sdk/models/first_mile_retrack_tracking_by_id_response.rb +193 -0
  34. data/lib/aftership-tracking-sdk/models/{next_couriers_mark_tracking_completed_by_id_response.rb → first_mile_tracking.rb} +29 -29
  35. data/lib/aftership-tracking-sdk/models/first_mile_update_tracking_by_id_response.rb +193 -0
  36. data/lib/aftership-tracking-sdk/models/get_tracking_by_id_response.rb +63 -83
  37. data/lib/aftership-tracking-sdk/models/{next_couriers_create_tracking_request.rb → last_mile_create_tracking_request.rb} +13 -13
  38. data/lib/aftership-tracking-sdk/models/last_mile_create_tracking_response.rb +203 -0
  39. data/lib/aftership-tracking-sdk/models/last_mile_delete_tracking_by_id_response.rb +203 -0
  40. data/lib/aftership-tracking-sdk/models/last_mile_get_tracking_by_id_response.rb +203 -0
  41. data/lib/aftership-tracking-sdk/models/last_mile_mark_tracking_completed_by_id_response.rb +203 -0
  42. data/lib/aftership-tracking-sdk/models/last_mile_retrack_tracking_by_id_response.rb +203 -0
  43. data/lib/aftership-tracking-sdk/models/{next_couriers_create_tracking_response.rb → last_mile_tracking.rb} +33 -23
  44. data/lib/aftership-tracking-sdk/models/last_mile_update_tracking_by_id_response.rb +203 -0
  45. data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_response.rb +63 -83
  46. data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_predict_request.rb +163 -0
  47. data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_predict_response.rb +163 -0
  48. data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_request.rb +6 -6
  49. data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_response.rb +6 -6
  50. data/lib/aftership-tracking-sdk/models/origin_address_predict_request.rb +193 -0
  51. data/lib/aftership-tracking-sdk/models/origin_address_predict_response.rb +193 -0
  52. data/lib/aftership-tracking-sdk/models/predict_request.rb +223 -0
  53. data/lib/aftership-tracking-sdk/models/predict_response.rb +273 -0
  54. data/lib/aftership-tracking-sdk/models/retrack_tracking_by_id_response.rb +63 -83
  55. data/lib/aftership-tracking-sdk/models/tracking.rb +63 -83
  56. data/lib/aftership-tracking-sdk/models/update_tracking_by_id_request.rb +37 -57
  57. data/lib/aftership-tracking-sdk/models/update_tracking_by_id_response.rb +63 -83
  58. data/lib/aftership-tracking-sdk/models/weight_predict_request.rb +163 -0
  59. data/lib/aftership-tracking-sdk/models/weight_predict_response.rb +163 -0
  60. data/lib/aftership-tracking-sdk/version.rb +1 -1
  61. metadata +41 -13
  62. data/lib/aftership-tracking-sdk/models/next_couriers_retrack_tracking_by_id_response.rb +0 -193
  63. data/lib/aftership-tracking-sdk/models/next_couriers_update_tracking_by_id_response.rb +0 -193
@@ -0,0 +1,193 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class DestinationAddressPredictResponse
5
+
6
+ # The country/region of the destination location where the package will be delivered. Use 3 letters of ISO 3166-1 country code.
7
+ # country_region: String;
8
+ attr_accessor :country_region
9
+
10
+ # 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.
11
+ # state?: String;
12
+ attr_accessor :state
13
+
14
+ # City of the destination address where the package will be delivered.
15
+ # city?: String;
16
+ attr_accessor :city
17
+
18
+ # Postal code of the destination address.Either `destination_address.state` or `destination_address.postal_code` is required.
19
+ # postal_code?: String;
20
+ attr_accessor :postal_code
21
+
22
+ # Raw location of the destination address. A raw address will help AI to identify the accurate location of the destination address.
23
+ # raw_location?: String;
24
+ attr_accessor :raw_location
25
+
26
+ # Initializes the object
27
+ # @param [Hash] attributes Model attributes in the form of hash
28
+ def initialize(attributes = {})
29
+ if (!attributes.is_a?(Hash))
30
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::DestinationAddressPredictResponse` initialize method"
31
+ end
32
+
33
+ attributes = attributes.each_with_object({}) { |(k, v), h|
34
+ h[k.to_sym] = v
35
+ }
36
+
37
+ if attributes.key?(:'country_region')
38
+ self.country_region = attributes[:'country_region']
39
+ end
40
+
41
+ if attributes.key?(:'state')
42
+ self.state = attributes[:'state']
43
+ end
44
+
45
+ if attributes.key?(:'city')
46
+ self.city = attributes[:'city']
47
+ end
48
+
49
+ if attributes.key?(:'postal_code')
50
+ self.postal_code = attributes[:'postal_code']
51
+ end
52
+
53
+ if attributes.key?(:'raw_location')
54
+ self.raw_location = attributes[:'raw_location']
55
+ end
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'country_region' => :'String',
62
+ :'state' => :'String',
63
+ :'city' => :'String',
64
+ :'postal_code' => :'String',
65
+ :'raw_location' => :'String',
66
+ }
67
+ end
68
+
69
+ # Attribute mapping from ruby-style variable name to JSON key.
70
+ def self.attribute_map
71
+ {
72
+ :'country_region' => :'country_region',
73
+ :'state' => :'state',
74
+ :'city' => :'city',
75
+ :'postal_code' => :'postal_code',
76
+ :'raw_location' => :'raw_location',
77
+ }
78
+ end
79
+
80
+ # Builds the object from hash
81
+ # @param attributes [Hash] Model attributes in the form of hash
82
+ # @return [Object] Returns the model itself
83
+ def self.build_from_hash(attributes)
84
+ return nil unless attributes.is_a?(Hash)
85
+ attributes = attributes.transform_keys(&:to_sym)
86
+ transformed_hash = {}
87
+ openapi_types.each_pair do |key, type|
88
+ if attributes.key?(key) && attributes[key].nil?
89
+ transformed_hash["#{key}"] = nil
90
+ elsif type =~ /\AArray<(.*)>/i
91
+ # check to ensure the input is an array given that the attribute
92
+ # is documented as an array but the input is not
93
+ if attributes[key].is_a?(Array)
94
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
95
+ end
96
+ elsif !attributes[key].nil?
97
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
98
+ end
99
+ end
100
+ new(transformed_hash)
101
+ end
102
+
103
+ # Deserializes the data based on type
104
+ # @param type [String] Data type
105
+ # @param value [String] Value to be deserialized
106
+ # @return [Object] Deserialized data
107
+ def self._deserialize(type, value)
108
+ case type.to_sym
109
+ when :Time
110
+ Time.parse(value)
111
+ when :Date
112
+ Date.parse(value)
113
+ when :String
114
+ value.to_s
115
+ when :Integer
116
+ value.to_i
117
+ when :Float
118
+ value.to_f
119
+ when :Boolean
120
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
121
+ true
122
+ else
123
+ false
124
+ end
125
+ when :Object
126
+ # generic object (usually a Hash), return directly
127
+ value
128
+ when /\AArray<(?<inner_type>.+)>\z/
129
+ inner_type = Regexp.last_match[:inner_type]
130
+ value.map { |v| _deserialize(inner_type, v) }
131
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
132
+ k_type = Regexp.last_match[:k_type]
133
+ v_type = Regexp.last_match[:v_type]
134
+ {}.tap do |hash|
135
+ value.each do |k, v|
136
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
137
+ end
138
+ end
139
+ else # model
140
+ klass = AftershipAPI::Model.const_get(type)
141
+ klass.build_from_hash(value)
142
+ end
143
+ end
144
+
145
+ # Returns the string representation of the object
146
+ # @return [String] String presentation of the object
147
+ def to_s
148
+ to_hash.to_s
149
+ end
150
+
151
+ # to_body is an alias to to_hash (backward compatibility)
152
+ # @return [Hash] Returns the object in the form of hash
153
+ def to_body
154
+ to_hash
155
+ end
156
+
157
+ # Returns the object in the form of hash
158
+ # @return [Hash] Returns the object in the form of hash
159
+ def to_hash
160
+ hash = {}
161
+ self.class.attribute_map.each_pair do |attr, param|
162
+ value = self.send(attr)
163
+ next if value.nil?
164
+
165
+ hash[param] = _to_hash(value)
166
+ end
167
+ hash
168
+ end
169
+
170
+ # Outputs non-array value in the form of hash
171
+ # For object, use to_hash. Otherwise, just return the value
172
+ # @param value [Object] Any valid value
173
+ # @return [Hash] Returns the value in the form of hash
174
+ def _to_hash(value)
175
+ if value.is_a?(Array)
176
+ value.compact.map { |v| _to_hash(v) }
177
+ elsif value.is_a?(Hash)
178
+ {}.tap do |hash|
179
+ value.each { |k, v| hash[k] = _to_hash(v) }
180
+ end
181
+ elsif value.respond_to? :to_hash
182
+ value.to_hash
183
+ else
184
+ value
185
+ end
186
+ end
187
+
188
+ def to_json(*a)
189
+ to_hash.to_json(*a)
190
+ end
191
+ end
192
+ end
193
+
@@ -28,12 +28,12 @@ module AftershipAPI::Model
28
28
  attr_accessor :tracking_key
29
29
 
30
30
  # Origin Country/Region of the shipment for a specific courier. Required by some couriers.
31
- # tracking_origin_country?: String;
32
- attr_accessor :tracking_origin_country
31
+ # tracking_origin_country_region?: String;
32
+ attr_accessor :tracking_origin_country_region
33
33
 
34
34
  # Destination Country/Region of the shipment for a specific courier. Required by some couriers. Refer to for more details
35
- # tracking_destination_country?: String;
36
- attr_accessor :tracking_destination_country
35
+ # tracking_destination_country_region?: String;
36
+ attr_accessor :tracking_destination_country_region
37
37
 
38
38
  # State of the destination shipping address of the shipment. Required by some couriers.
39
39
  # tracking_state?: String;
@@ -44,12 +44,12 @@ module AftershipAPI::Model
44
44
  attr_accessor :slug_group
45
45
 
46
46
  # Enter .
47
- # origin_country_iso3?: String;
48
- attr_accessor :origin_country_iso3
47
+ # origin_country_region?: String;
48
+ attr_accessor :origin_country_region
49
49
 
50
50
  # Enter .
51
- # destination_country_iso3?: String;
52
- attr_accessor :destination_country_iso3
51
+ # destination_country_region?: String;
52
+ attr_accessor :destination_country_region
53
53
 
54
54
  # Initializes the object
55
55
  # @param [Hash] attributes Model attributes in the form of hash
@@ -86,12 +86,12 @@ module AftershipAPI::Model
86
86
  self.tracking_key = attributes[:'tracking_key']
87
87
  end
88
88
 
89
- if attributes.key?(:'tracking_origin_country')
90
- self.tracking_origin_country = attributes[:'tracking_origin_country']
89
+ if attributes.key?(:'tracking_origin_country_region')
90
+ self.tracking_origin_country_region = attributes[:'tracking_origin_country_region']
91
91
  end
92
92
 
93
- if attributes.key?(:'tracking_destination_country')
94
- self.tracking_destination_country = attributes[:'tracking_destination_country']
93
+ if attributes.key?(:'tracking_destination_country_region')
94
+ self.tracking_destination_country_region = attributes[:'tracking_destination_country_region']
95
95
  end
96
96
 
97
97
  if attributes.key?(:'tracking_state')
@@ -102,12 +102,12 @@ module AftershipAPI::Model
102
102
  self.slug_group = attributes[:'slug_group']
103
103
  end
104
104
 
105
- if attributes.key?(:'origin_country_iso3')
106
- self.origin_country_iso3 = attributes[:'origin_country_iso3']
105
+ if attributes.key?(:'origin_country_region')
106
+ self.origin_country_region = attributes[:'origin_country_region']
107
107
  end
108
108
 
109
- if attributes.key?(:'destination_country_iso3')
110
- self.destination_country_iso3 = attributes[:'destination_country_iso3']
109
+ if attributes.key?(:'destination_country_region')
110
+ self.destination_country_region = attributes[:'destination_country_region']
111
111
  end
112
112
  end
113
113
 
@@ -120,12 +120,12 @@ module AftershipAPI::Model
120
120
  :'tracking_ship_date' => :'String',
121
121
  :'tracking_account_number' => :'String',
122
122
  :'tracking_key' => :'String',
123
- :'tracking_origin_country' => :'String',
124
- :'tracking_destination_country' => :'String',
123
+ :'tracking_origin_country_region' => :'String',
124
+ :'tracking_destination_country_region' => :'String',
125
125
  :'tracking_state' => :'String',
126
126
  :'slug_group' => :'SlugGroupV1',
127
- :'origin_country_iso3' => :'String',
128
- :'destination_country_iso3' => :'String',
127
+ :'origin_country_region' => :'String',
128
+ :'destination_country_region' => :'String',
129
129
  }
130
130
  end
131
131
 
@@ -138,12 +138,12 @@ module AftershipAPI::Model
138
138
  :'tracking_ship_date' => :'tracking_ship_date',
139
139
  :'tracking_account_number' => :'tracking_account_number',
140
140
  :'tracking_key' => :'tracking_key',
141
- :'tracking_origin_country' => :'tracking_origin_country',
142
- :'tracking_destination_country' => :'tracking_destination_country',
141
+ :'tracking_origin_country_region' => :'tracking_origin_country_region',
142
+ :'tracking_destination_country_region' => :'tracking_destination_country_region',
143
143
  :'tracking_state' => :'tracking_state',
144
144
  :'slug_group' => :'slug_group',
145
- :'origin_country_iso3' => :'origin_country_iso3',
146
- :'destination_country_iso3' => :'destination_country_iso3',
145
+ :'origin_country_region' => :'origin_country_region',
146
+ :'destination_country_region' => :'destination_country_region',
147
147
  }
148
148
  end
149
149
 
@@ -0,0 +1,183 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class EstimatedPickupPredictRequest
5
+
6
+ # The local order time in the origin address time zone of the package.
7
+ # order_time: String;
8
+ attr_accessor :order_time
9
+
10
+ # Order cut off time in the origin address time zone. The default value set by AfterShip is 18:00:00.
11
+ # order_cutoff_time?: String;
12
+ attr_accessor :order_cutoff_time
13
+
14
+ # 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.
15
+ # business_days?: Integer[];
16
+ attr_accessor :business_days
17
+
18
+ #
19
+ # order_processing_time?: OrderProcessingTimeEstimatedPickupPredictRequest;
20
+ attr_accessor :order_processing_time
21
+
22
+ # Initializes the object
23
+ # @param [Hash] attributes Model attributes in the form of hash
24
+ def initialize(attributes = {})
25
+ if (!attributes.is_a?(Hash))
26
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::EstimatedPickupPredictRequest` initialize method"
27
+ end
28
+
29
+ attributes = attributes.each_with_object({}) { |(k, v), h|
30
+ h[k.to_sym] = v
31
+ }
32
+
33
+ if attributes.key?(:'order_time')
34
+ self.order_time = attributes[:'order_time']
35
+ end
36
+
37
+ if attributes.key?(:'order_cutoff_time')
38
+ self.order_cutoff_time = attributes[:'order_cutoff_time']
39
+ end
40
+
41
+ if attributes.key?(:'business_days')
42
+ self.business_days = attributes[:'business_days']
43
+ end
44
+
45
+ if attributes.key?(:'order_processing_time')
46
+ self.order_processing_time = attributes[:'order_processing_time']
47
+ end
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'order_time' => :'String',
54
+ :'order_cutoff_time' => :'String',
55
+ :'business_days' => :'Array<Integer>',
56
+ :'order_processing_time' => :'OrderProcessingTimeEstimatedPickupPredictRequest',
57
+ }
58
+ end
59
+
60
+ # Attribute mapping from ruby-style variable name to JSON key.
61
+ def self.attribute_map
62
+ {
63
+ :'order_time' => :'order_time',
64
+ :'order_cutoff_time' => :'order_cutoff_time',
65
+ :'business_days' => :'business_days',
66
+ :'order_processing_time' => :'order_processing_time',
67
+ }
68
+ end
69
+
70
+ # Builds the object from hash
71
+ # @param attributes [Hash] Model attributes in the form of hash
72
+ # @return [Object] Returns the model itself
73
+ def self.build_from_hash(attributes)
74
+ return nil unless attributes.is_a?(Hash)
75
+ attributes = attributes.transform_keys(&:to_sym)
76
+ transformed_hash = {}
77
+ openapi_types.each_pair do |key, type|
78
+ if attributes.key?(key) && attributes[key].nil?
79
+ transformed_hash["#{key}"] = nil
80
+ elsif type =~ /\AArray<(.*)>/i
81
+ # check to ensure the input is an array given that the attribute
82
+ # is documented as an array but the input is not
83
+ if attributes[key].is_a?(Array)
84
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
85
+ end
86
+ elsif !attributes[key].nil?
87
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
88
+ end
89
+ end
90
+ new(transformed_hash)
91
+ end
92
+
93
+ # Deserializes the data based on type
94
+ # @param type [String] Data type
95
+ # @param value [String] Value to be deserialized
96
+ # @return [Object] Deserialized data
97
+ def self._deserialize(type, value)
98
+ case type.to_sym
99
+ when :Time
100
+ Time.parse(value)
101
+ when :Date
102
+ Date.parse(value)
103
+ when :String
104
+ value.to_s
105
+ when :Integer
106
+ value.to_i
107
+ when :Float
108
+ value.to_f
109
+ when :Boolean
110
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
111
+ true
112
+ else
113
+ false
114
+ end
115
+ when :Object
116
+ # generic object (usually a Hash), return directly
117
+ value
118
+ when /\AArray<(?<inner_type>.+)>\z/
119
+ inner_type = Regexp.last_match[:inner_type]
120
+ value.map { |v| _deserialize(inner_type, v) }
121
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
122
+ k_type = Regexp.last_match[:k_type]
123
+ v_type = Regexp.last_match[:v_type]
124
+ {}.tap do |hash|
125
+ value.each do |k, v|
126
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
127
+ end
128
+ end
129
+ else # model
130
+ klass = AftershipAPI::Model.const_get(type)
131
+ klass.build_from_hash(value)
132
+ end
133
+ end
134
+
135
+ # Returns the string representation of the object
136
+ # @return [String] String presentation of the object
137
+ def to_s
138
+ to_hash.to_s
139
+ end
140
+
141
+ # to_body is an alias to to_hash (backward compatibility)
142
+ # @return [Hash] Returns the object in the form of hash
143
+ def to_body
144
+ to_hash
145
+ end
146
+
147
+ # Returns the object in the form of hash
148
+ # @return [Hash] Returns the object in the form of hash
149
+ def to_hash
150
+ hash = {}
151
+ self.class.attribute_map.each_pair do |attr, param|
152
+ value = self.send(attr)
153
+ next if value.nil?
154
+
155
+ hash[param] = _to_hash(value)
156
+ end
157
+ hash
158
+ end
159
+
160
+ # Outputs non-array value in the form of hash
161
+ # For object, use to_hash. Otherwise, just return the value
162
+ # @param value [Object] Any valid value
163
+ # @return [Hash] Returns the value in the form of hash
164
+ def _to_hash(value)
165
+ if value.is_a?(Array)
166
+ value.compact.map { |v| _to_hash(v) }
167
+ elsif value.is_a?(Hash)
168
+ {}.tap do |hash|
169
+ value.each { |k, v| hash[k] = _to_hash(v) }
170
+ end
171
+ elsif value.respond_to? :to_hash
172
+ value.to_hash
173
+ else
174
+ value
175
+ end
176
+ end
177
+
178
+ def to_json(*a)
179
+ to_hash.to_json(*a)
180
+ end
181
+ end
182
+ end
183
+
@@ -0,0 +1,193 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class EstimatedPickupPredictResponse
5
+
6
+ # The local order time in the origin address time zone of the package.
7
+ # order_time: String;
8
+ attr_accessor :order_time
9
+
10
+ # Order cut off time in the origin address time zone. The default value set by AfterShip is 18:00:00.
11
+ # order_cutoff_time?: String;
12
+ attr_accessor :order_cutoff_time
13
+
14
+ # 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.
15
+ # business_days?: Integer[];
16
+ attr_accessor :business_days
17
+
18
+ #
19
+ # order_processing_time?: OrderProcessingTimeEstimatedPickupPredictResponse;
20
+ attr_accessor :order_processing_time
21
+
22
+ # The local pickup time of the package.
23
+ # pickup_time?: String;
24
+ attr_accessor :pickup_time
25
+
26
+ # Initializes the object
27
+ # @param [Hash] attributes Model attributes in the form of hash
28
+ def initialize(attributes = {})
29
+ if (!attributes.is_a?(Hash))
30
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::EstimatedPickupPredictResponse` initialize method"
31
+ end
32
+
33
+ attributes = attributes.each_with_object({}) { |(k, v), h|
34
+ h[k.to_sym] = v
35
+ }
36
+
37
+ if attributes.key?(:'order_time')
38
+ self.order_time = attributes[:'order_time']
39
+ end
40
+
41
+ if attributes.key?(:'order_cutoff_time')
42
+ self.order_cutoff_time = attributes[:'order_cutoff_time']
43
+ end
44
+
45
+ if attributes.key?(:'business_days')
46
+ self.business_days = attributes[:'business_days']
47
+ end
48
+
49
+ if attributes.key?(:'order_processing_time')
50
+ self.order_processing_time = attributes[:'order_processing_time']
51
+ end
52
+
53
+ if attributes.key?(:'pickup_time')
54
+ self.pickup_time = attributes[:'pickup_time']
55
+ end
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'order_time' => :'String',
62
+ :'order_cutoff_time' => :'String',
63
+ :'business_days' => :'Array<Integer>',
64
+ :'order_processing_time' => :'OrderProcessingTimeEstimatedPickupPredictResponse',
65
+ :'pickup_time' => :'String',
66
+ }
67
+ end
68
+
69
+ # Attribute mapping from ruby-style variable name to JSON key.
70
+ def self.attribute_map
71
+ {
72
+ :'order_time' => :'order_time',
73
+ :'order_cutoff_time' => :'order_cutoff_time',
74
+ :'business_days' => :'business_days',
75
+ :'order_processing_time' => :'order_processing_time',
76
+ :'pickup_time' => :'pickup_time',
77
+ }
78
+ end
79
+
80
+ # Builds the object from hash
81
+ # @param attributes [Hash] Model attributes in the form of hash
82
+ # @return [Object] Returns the model itself
83
+ def self.build_from_hash(attributes)
84
+ return nil unless attributes.is_a?(Hash)
85
+ attributes = attributes.transform_keys(&:to_sym)
86
+ transformed_hash = {}
87
+ openapi_types.each_pair do |key, type|
88
+ if attributes.key?(key) && attributes[key].nil?
89
+ transformed_hash["#{key}"] = nil
90
+ elsif type =~ /\AArray<(.*)>/i
91
+ # check to ensure the input is an array given that the attribute
92
+ # is documented as an array but the input is not
93
+ if attributes[key].is_a?(Array)
94
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
95
+ end
96
+ elsif !attributes[key].nil?
97
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
98
+ end
99
+ end
100
+ new(transformed_hash)
101
+ end
102
+
103
+ # Deserializes the data based on type
104
+ # @param type [String] Data type
105
+ # @param value [String] Value to be deserialized
106
+ # @return [Object] Deserialized data
107
+ def self._deserialize(type, value)
108
+ case type.to_sym
109
+ when :Time
110
+ Time.parse(value)
111
+ when :Date
112
+ Date.parse(value)
113
+ when :String
114
+ value.to_s
115
+ when :Integer
116
+ value.to_i
117
+ when :Float
118
+ value.to_f
119
+ when :Boolean
120
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
121
+ true
122
+ else
123
+ false
124
+ end
125
+ when :Object
126
+ # generic object (usually a Hash), return directly
127
+ value
128
+ when /\AArray<(?<inner_type>.+)>\z/
129
+ inner_type = Regexp.last_match[:inner_type]
130
+ value.map { |v| _deserialize(inner_type, v) }
131
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
132
+ k_type = Regexp.last_match[:k_type]
133
+ v_type = Regexp.last_match[:v_type]
134
+ {}.tap do |hash|
135
+ value.each do |k, v|
136
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
137
+ end
138
+ end
139
+ else # model
140
+ klass = AftershipAPI::Model.const_get(type)
141
+ klass.build_from_hash(value)
142
+ end
143
+ end
144
+
145
+ # Returns the string representation of the object
146
+ # @return [String] String presentation of the object
147
+ def to_s
148
+ to_hash.to_s
149
+ end
150
+
151
+ # to_body is an alias to to_hash (backward compatibility)
152
+ # @return [Hash] Returns the object in the form of hash
153
+ def to_body
154
+ to_hash
155
+ end
156
+
157
+ # Returns the object in the form of hash
158
+ # @return [Hash] Returns the object in the form of hash
159
+ def to_hash
160
+ hash = {}
161
+ self.class.attribute_map.each_pair do |attr, param|
162
+ value = self.send(attr)
163
+ next if value.nil?
164
+
165
+ hash[param] = _to_hash(value)
166
+ end
167
+ hash
168
+ end
169
+
170
+ # Outputs non-array value in the form of hash
171
+ # For object, use to_hash. Otherwise, just return the value
172
+ # @param value [Object] Any valid value
173
+ # @return [Hash] Returns the value in the form of hash
174
+ def _to_hash(value)
175
+ if value.is_a?(Array)
176
+ value.compact.map { |v| _to_hash(v) }
177
+ elsif value.is_a?(Hash)
178
+ {}.tap do |hash|
179
+ value.each { |k, v| hash[k] = _to_hash(v) }
180
+ end
181
+ elsif value.respond_to? :to_hash
182
+ value.to_hash
183
+ else
184
+ value
185
+ end
186
+ end
187
+
188
+ def to_json(*a)
189
+ to_hash.to_json(*a)
190
+ end
191
+ end
192
+ end
193
+