aftership-tracking-sdk 9.0.0 → 11.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 (97) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +16 -19
  4. data/lib/aftership-tracking-sdk/api/courier.rb +16 -60
  5. data/lib/aftership-tracking-sdk/api/courier_connection.rb +283 -0
  6. data/lib/aftership-tracking-sdk/api/estimated_delivery_date.rb +55 -1
  7. data/lib/aftership-tracking-sdk/api/tracking.rb +17 -17
  8. data/lib/aftership-tracking-sdk/models/{additional_fields_v1.rb → additional_fields.rb} +9 -9
  9. data/lib/aftership-tracking-sdk/models/checkpoint.rb +24 -14
  10. data/lib/aftership-tracking-sdk/models/courier.rb +17 -7
  11. data/lib/aftership-tracking-sdk/models/courier_connection.rb +193 -0
  12. data/lib/aftership-tracking-sdk/models/courier_connection_response_for_get_courier_connections.rb +163 -0
  13. data/lib/aftership-tracking-sdk/models/{courier_response_v1.rb → courier_response.rb} +6 -6
  14. data/lib/aftership-tracking-sdk/models/create_tracking_request.rb +55 -105
  15. data/lib/aftership-tracking-sdk/models/create_tracking_response.rb +53 -113
  16. data/lib/aftership-tracking-sdk/models/credential_field.rb +173 -0
  17. data/lib/aftership-tracking-sdk/models/{get_user_couriers_response.rb → credentials_courier.rb} +9 -19
  18. data/lib/aftership-tracking-sdk/models/customers_create_tracking_request.rb +193 -0
  19. data/lib/aftership-tracking-sdk/models/customers_create_tracking_response.rb +193 -0
  20. data/lib/aftership-tracking-sdk/models/customers_delete_tracking_by_id_response.rb +193 -0
  21. data/lib/aftership-tracking-sdk/models/customers_get_tracking_by_id_response.rb +193 -0
  22. data/lib/aftership-tracking-sdk/models/customers_mark_tracking_completed_by_id_response.rb +193 -0
  23. data/lib/aftership-tracking-sdk/models/customers_retrack_tracking_by_id_response.rb +193 -0
  24. data/lib/aftership-tracking-sdk/models/customers_tracking.rb +193 -0
  25. data/lib/aftership-tracking-sdk/models/customers_update_tracking_by_id_request.rb +193 -0
  26. data/lib/aftership-tracking-sdk/models/customers_update_tracking_by_id_response.rb +193 -0
  27. data/lib/aftership-tracking-sdk/models/data_courier_connection_response_for_get_courier_connections.rb +163 -0
  28. data/lib/aftership-tracking-sdk/models/{data_courier_response_v1.rb → data_courier_response.rb} +2 -2
  29. data/lib/aftership-tracking-sdk/models/{data_tracking_response_get_multiple_v1.rb → data_tracking_response_for_get_trackings.rb} +4 -4
  30. data/lib/aftership-tracking-sdk/models/delete_courier_connections_by_id_response.rb +193 -0
  31. data/lib/aftership-tracking-sdk/models/delete_tracking_by_id_response.rb +53 -113
  32. data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_request.rb +6 -6
  33. data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_response.rb +6 -6
  34. data/lib/aftership-tracking-sdk/models/destination_address_predict_request.rb +193 -0
  35. data/lib/aftership-tracking-sdk/models/destination_address_predict_response.rb +193 -0
  36. data/lib/aftership-tracking-sdk/models/detect_courier_request.rb +26 -46
  37. data/lib/aftership-tracking-sdk/models/estimated_pickup_predict_request.rb +183 -0
  38. data/lib/aftership-tracking-sdk/models/estimated_pickup_predict_response.rb +193 -0
  39. data/lib/aftership-tracking-sdk/models/{next_couriers_delete_tracking_by_id_response.rb → first_mile_create_tracking_response.rb} +29 -29
  40. data/lib/aftership-tracking-sdk/models/first_mile_delete_tracking_by_id_response.rb +193 -0
  41. data/lib/aftership-tracking-sdk/models/first_mile_get_tracking_by_id_response.rb +193 -0
  42. data/lib/aftership-tracking-sdk/models/first_mile_mark_tracking_completed_by_id_response.rb +193 -0
  43. data/lib/aftership-tracking-sdk/models/first_mile_retrack_tracking_by_id_response.rb +193 -0
  44. data/lib/aftership-tracking-sdk/models/{next_couriers_get_tracking_by_id_response.rb → first_mile_tracking.rb} +29 -29
  45. data/lib/aftership-tracking-sdk/models/first_mile_update_tracking_by_id_response.rb +193 -0
  46. data/lib/aftership-tracking-sdk/models/get_courier_connections_by_id_response.rb +193 -0
  47. data/lib/aftership-tracking-sdk/models/get_courier_connections_response.rb +163 -0
  48. data/lib/aftership-tracking-sdk/models/{get_all_couriers_response.rb → get_couriers_response.rb} +2 -2
  49. data/lib/aftership-tracking-sdk/models/get_tracking_by_id_response.rb +53 -113
  50. data/lib/aftership-tracking-sdk/models/{next_couriers_create_tracking_request.rb → last_mile_create_tracking_request.rb} +13 -13
  51. data/lib/aftership-tracking-sdk/models/last_mile_create_tracking_response.rb +203 -0
  52. data/lib/aftership-tracking-sdk/models/{next_couriers_create_tracking_response.rb → last_mile_delete_tracking_by_id_response.rb} +33 -23
  53. data/lib/aftership-tracking-sdk/models/last_mile_get_tracking_by_id_response.rb +203 -0
  54. data/lib/aftership-tracking-sdk/models/last_mile_mark_tracking_completed_by_id_response.rb +203 -0
  55. data/lib/aftership-tracking-sdk/models/last_mile_retrack_tracking_by_id_response.rb +203 -0
  56. data/lib/aftership-tracking-sdk/models/{next_couriers_mark_tracking_completed_by_id_response.rb → last_mile_tracking.rb} +33 -23
  57. data/lib/aftership-tracking-sdk/models/last_mile_update_tracking_by_id_response.rb +203 -0
  58. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_create_tracking_response.rb +10 -0
  59. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_delete_tracking_by_id_response.rb +10 -0
  60. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_get_tracking_by_id_response.rb +10 -0
  61. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_mark_tracking_completed_by_id_response.rb +10 -0
  62. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_retrack_tracking_by_id_response.rb +10 -0
  63. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_tracking.rb +10 -0
  64. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_update_tracking_by_id_response.rb +10 -0
  65. data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_request.rb +10 -0
  66. data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_response.rb +53 -113
  67. data/lib/aftership-tracking-sdk/models/{meta_v1.rb → meta.rb} +2 -2
  68. data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_predict_request.rb +163 -0
  69. data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_predict_response.rb +163 -0
  70. data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_request.rb +6 -6
  71. data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_response.rb +6 -6
  72. data/lib/aftership-tracking-sdk/models/origin_address_predict_request.rb +193 -0
  73. data/lib/aftership-tracking-sdk/models/origin_address_predict_response.rb +193 -0
  74. data/lib/aftership-tracking-sdk/models/pagination_data_courier_connection_response_for_get_courier_connections.rb +173 -0
  75. data/lib/aftership-tracking-sdk/models/{pagination_data_tracking_response_get_multiple_v1.rb → pagination_data_tracking_response_for_get_trackings.rb} +2 -2
  76. data/lib/aftership-tracking-sdk/models/pagination_get_courier_connections_response.rb +173 -0
  77. data/lib/aftership-tracking-sdk/models/post_courier_connections_request.rb +163 -0
  78. data/lib/aftership-tracking-sdk/models/post_courier_connections_response.rb +193 -0
  79. data/lib/aftership-tracking-sdk/models/predict_request.rb +223 -0
  80. data/lib/aftership-tracking-sdk/models/predict_response.rb +273 -0
  81. data/lib/aftership-tracking-sdk/models/put_courier_connections_by_id_request.rb +153 -0
  82. data/lib/aftership-tracking-sdk/models/put_courier_connections_by_id_response.rb +193 -0
  83. data/lib/aftership-tracking-sdk/models/retrack_tracking_by_id_response.rb +53 -113
  84. data/lib/aftership-tracking-sdk/models/{slug_group_v1.rb → slug_group.rb} +3 -3
  85. data/lib/aftership-tracking-sdk/models/{tag_v1.rb → tag.rb} +3 -3
  86. data/lib/aftership-tracking-sdk/models/tracking.rb +53 -113
  87. data/lib/aftership-tracking-sdk/models/{tracking_response_v1.rb → tracking_response.rb} +4 -4
  88. data/lib/aftership-tracking-sdk/models/{tracking_response_get_multiple_v1.rb → tracking_response_for_get_trackings.rb} +6 -6
  89. data/lib/aftership-tracking-sdk/models/update_tracking_by_id_request.rb +23 -83
  90. data/lib/aftership-tracking-sdk/models/update_tracking_by_id_response.rb +53 -113
  91. data/lib/aftership-tracking-sdk/models/weight_predict_request.rb +163 -0
  92. data/lib/aftership-tracking-sdk/models/weight_predict_response.rb +163 -0
  93. data/lib/aftership-tracking-sdk/version.rb +1 -1
  94. metadata +67 -25
  95. data/lib/aftership-tracking-sdk/models/next_couriers_retrack_tracking_by_id_response.rb +0 -193
  96. data/lib/aftership-tracking-sdk/models/next_couriers_tracking.rb +0 -193
  97. data/lib/aftership-tracking-sdk/models/next_couriers_update_tracking_by_id_response.rb +0 -193
@@ -0,0 +1,273 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class PredictResponse
5
+
6
+ # A string that acts as a unique identifier for the estimated delivery date value generated by AfterShip Predict API
7
+ # id: String;
8
+ attr_accessor :id
9
+
10
+ # AfterShip's unique code of courier. Please refer to https://track.aftership.com/couriers/download.
11
+ # slug: String;
12
+ attr_accessor :slug
13
+
14
+ # AfterShip’s unique code represents carrier’s shipping and delivery options. Refer to .
15
+ # service_type_name?: String;
16
+ attr_accessor :service_type_name
17
+
18
+ # The location from where the package is picked up by the carrier to be delivered to the final destination.
19
+ # origin_address: OriginAddressPredictResponse;
20
+ attr_accessor :origin_address
21
+
22
+ # The final destination of the customer where the delivery will be made.
23
+ # destination_address: DestinationAddressPredictResponse;
24
+ attr_accessor :destination_address
25
+
26
+ # AfterShip uses this object to calculate the total weight of the order.
27
+ # weight?: WeightPredictResponse;
28
+ attr_accessor :weight
29
+
30
+ # The number of packages.
31
+ # package_count?: Integer;
32
+ attr_accessor :package_count
33
+
34
+ # The local pickup time in the origin address time zone of the package.Either `pickup_time` or `estimated_pickup` is required.
35
+ # pickup_time?: String;
36
+ attr_accessor :pickup_time
37
+
38
+ # The local pickup time of the package.Either `pickup_time` or `estimated_pickup` is required.
39
+ # estimated_pickup?: EstimatedPickupPredictResponse;
40
+ attr_accessor :estimated_pickup
41
+
42
+ # The estimated arrival date of the shipment, provided by AfterShip.
43
+ # estimated_delivery_date?: String;
44
+ attr_accessor :estimated_delivery_date
45
+
46
+ # Indicates the confidence level and associated reason for an AI EDD prediction request. For a comprehensive list of confidence codes, refer to .
47
+ # confidence_code?: Float;
48
+ attr_accessor :confidence_code
49
+
50
+ # The earliest estimated delivery date of the shipment, provided by AfterShip.
51
+ # estimated_delivery_date_min?: String;
52
+ attr_accessor :estimated_delivery_date_min
53
+
54
+ # The latest estimated delivery date of the shipment, provided by AfterShip.
55
+ # estimated_delivery_date_max?: String;
56
+ attr_accessor :estimated_delivery_date_max
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ if (!attributes.is_a?(Hash))
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::PredictResponse` initialize method"
63
+ end
64
+
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'id')
70
+ self.id = attributes[:'id']
71
+ end
72
+
73
+ if attributes.key?(:'slug')
74
+ self.slug = attributes[:'slug']
75
+ end
76
+
77
+ if attributes.key?(:'service_type_name')
78
+ self.service_type_name = attributes[:'service_type_name']
79
+ end
80
+
81
+ if attributes.key?(:'origin_address')
82
+ self.origin_address = attributes[:'origin_address']
83
+ end
84
+
85
+ if attributes.key?(:'destination_address')
86
+ self.destination_address = attributes[:'destination_address']
87
+ end
88
+
89
+ if attributes.key?(:'weight')
90
+ self.weight = attributes[:'weight']
91
+ end
92
+
93
+ if attributes.key?(:'package_count')
94
+ self.package_count = attributes[:'package_count']
95
+ end
96
+
97
+ if attributes.key?(:'pickup_time')
98
+ self.pickup_time = attributes[:'pickup_time']
99
+ end
100
+
101
+ if attributes.key?(:'estimated_pickup')
102
+ self.estimated_pickup = attributes[:'estimated_pickup']
103
+ end
104
+
105
+ if attributes.key?(:'estimated_delivery_date')
106
+ self.estimated_delivery_date = attributes[:'estimated_delivery_date']
107
+ end
108
+
109
+ if attributes.key?(:'confidence_code')
110
+ self.confidence_code = attributes[:'confidence_code']
111
+ end
112
+
113
+ if attributes.key?(:'estimated_delivery_date_min')
114
+ self.estimated_delivery_date_min = attributes[:'estimated_delivery_date_min']
115
+ end
116
+
117
+ if attributes.key?(:'estimated_delivery_date_max')
118
+ self.estimated_delivery_date_max = attributes[:'estimated_delivery_date_max']
119
+ end
120
+ end
121
+
122
+ # Attribute type mapping.
123
+ def self.openapi_types
124
+ {
125
+ :'id' => :'String',
126
+ :'slug' => :'String',
127
+ :'service_type_name' => :'String',
128
+ :'origin_address' => :'OriginAddressPredictResponse',
129
+ :'destination_address' => :'DestinationAddressPredictResponse',
130
+ :'weight' => :'WeightPredictResponse',
131
+ :'package_count' => :'Integer',
132
+ :'pickup_time' => :'String',
133
+ :'estimated_pickup' => :'EstimatedPickupPredictResponse',
134
+ :'estimated_delivery_date' => :'String',
135
+ :'confidence_code' => :'Float',
136
+ :'estimated_delivery_date_min' => :'String',
137
+ :'estimated_delivery_date_max' => :'String',
138
+ }
139
+ end
140
+
141
+ # Attribute mapping from ruby-style variable name to JSON key.
142
+ def self.attribute_map
143
+ {
144
+ :'id' => :'id',
145
+ :'slug' => :'slug',
146
+ :'service_type_name' => :'service_type_name',
147
+ :'origin_address' => :'origin_address',
148
+ :'destination_address' => :'destination_address',
149
+ :'weight' => :'weight',
150
+ :'package_count' => :'package_count',
151
+ :'pickup_time' => :'pickup_time',
152
+ :'estimated_pickup' => :'estimated_pickup',
153
+ :'estimated_delivery_date' => :'estimated_delivery_date',
154
+ :'confidence_code' => :'confidence_code',
155
+ :'estimated_delivery_date_min' => :'estimated_delivery_date_min',
156
+ :'estimated_delivery_date_max' => :'estimated_delivery_date_max',
157
+ }
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param attributes [Hash] Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def self.build_from_hash(attributes)
164
+ return nil unless attributes.is_a?(Hash)
165
+ attributes = attributes.transform_keys(&:to_sym)
166
+ transformed_hash = {}
167
+ openapi_types.each_pair do |key, type|
168
+ if attributes.key?(key) && attributes[key].nil?
169
+ transformed_hash["#{key}"] = nil
170
+ elsif type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[key].is_a?(Array)
174
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
175
+ end
176
+ elsif !attributes[key].nil?
177
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
178
+ end
179
+ end
180
+ new(transformed_hash)
181
+ end
182
+
183
+ # Deserializes the data based on type
184
+ # @param type [String] Data type
185
+ # @param value [String] Value to be deserialized
186
+ # @return [Object] Deserialized data
187
+ def self._deserialize(type, value)
188
+ case type.to_sym
189
+ when :Time
190
+ Time.parse(value)
191
+ when :Date
192
+ Date.parse(value)
193
+ when :String
194
+ value.to_s
195
+ when :Integer
196
+ value.to_i
197
+ when :Float
198
+ value.to_f
199
+ when :Boolean
200
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
201
+ true
202
+ else
203
+ false
204
+ end
205
+ when :Object
206
+ # generic object (usually a Hash), return directly
207
+ value
208
+ when /\AArray<(?<inner_type>.+)>\z/
209
+ inner_type = Regexp.last_match[:inner_type]
210
+ value.map { |v| _deserialize(inner_type, v) }
211
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
212
+ k_type = Regexp.last_match[:k_type]
213
+ v_type = Regexp.last_match[:v_type]
214
+ {}.tap do |hash|
215
+ value.each do |k, v|
216
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
217
+ end
218
+ end
219
+ else # model
220
+ klass = AftershipAPI::Model.const_get(type)
221
+ klass.build_from_hash(value)
222
+ end
223
+ end
224
+
225
+ # Returns the string representation of the object
226
+ # @return [String] String presentation of the object
227
+ def to_s
228
+ to_hash.to_s
229
+ end
230
+
231
+ # to_body is an alias to to_hash (backward compatibility)
232
+ # @return [Hash] Returns the object in the form of hash
233
+ def to_body
234
+ to_hash
235
+ end
236
+
237
+ # Returns the object in the form of hash
238
+ # @return [Hash] Returns the object in the form of hash
239
+ def to_hash
240
+ hash = {}
241
+ self.class.attribute_map.each_pair do |attr, param|
242
+ value = self.send(attr)
243
+ next if value.nil?
244
+
245
+ hash[param] = _to_hash(value)
246
+ end
247
+ hash
248
+ end
249
+
250
+ # Outputs non-array value in the form of hash
251
+ # For object, use to_hash. Otherwise, just return the value
252
+ # @param value [Object] Any valid value
253
+ # @return [Hash] Returns the value in the form of hash
254
+ def _to_hash(value)
255
+ if value.is_a?(Array)
256
+ value.compact.map { |v| _to_hash(v) }
257
+ elsif value.is_a?(Hash)
258
+ {}.tap do |hash|
259
+ value.each { |k, v| hash[k] = _to_hash(v) }
260
+ end
261
+ elsif value.respond_to? :to_hash
262
+ value.to_hash
263
+ else
264
+ value
265
+ end
266
+ end
267
+
268
+ def to_json(*a)
269
+ to_hash.to_json(*a)
270
+ end
271
+ end
272
+ end
273
+
@@ -0,0 +1,153 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class PutCourierConnectionsByIdRequest
5
+
6
+ # It refers to the authentication details required for each specific carrier details required for each specific carrier (such as API keys, username, password, etc.) that the user must provide to establish a carrier connection. The content varies by carrier.
7
+ # credentials: Object;
8
+ attr_accessor :credentials
9
+
10
+ # Initializes the object
11
+ # @param [Hash] attributes Model attributes in the form of hash
12
+ def initialize(attributes = {})
13
+ if (!attributes.is_a?(Hash))
14
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::PutCourierConnectionsByIdRequest` initialize method"
15
+ end
16
+
17
+ attributes = attributes.each_with_object({}) { |(k, v), h|
18
+ h[k.to_sym] = v
19
+ }
20
+
21
+ if attributes.key?(:'credentials')
22
+ self.credentials = attributes[:'credentials']
23
+ end
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'credentials' => :'Object',
30
+ }
31
+ end
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'credentials' => :'credentials',
37
+ }
38
+ end
39
+
40
+ # Builds the object from hash
41
+ # @param attributes [Hash] Model attributes in the form of hash
42
+ # @return [Object] Returns the model itself
43
+ def self.build_from_hash(attributes)
44
+ return nil unless attributes.is_a?(Hash)
45
+ attributes = attributes.transform_keys(&:to_sym)
46
+ transformed_hash = {}
47
+ openapi_types.each_pair do |key, type|
48
+ if attributes.key?(key) && attributes[key].nil?
49
+ transformed_hash["#{key}"] = nil
50
+ elsif type =~ /\AArray<(.*)>/i
51
+ # check to ensure the input is an array given that the attribute
52
+ # is documented as an array but the input is not
53
+ if attributes[key].is_a?(Array)
54
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
55
+ end
56
+ elsif !attributes[key].nil?
57
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
58
+ end
59
+ end
60
+ new(transformed_hash)
61
+ end
62
+
63
+ # Deserializes the data based on type
64
+ # @param type [String] Data type
65
+ # @param value [String] Value to be deserialized
66
+ # @return [Object] Deserialized data
67
+ def self._deserialize(type, value)
68
+ case type.to_sym
69
+ when :Time
70
+ Time.parse(value)
71
+ when :Date
72
+ Date.parse(value)
73
+ when :String
74
+ value.to_s
75
+ when :Integer
76
+ value.to_i
77
+ when :Float
78
+ value.to_f
79
+ when :Boolean
80
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
81
+ true
82
+ else
83
+ false
84
+ end
85
+ when :Object
86
+ # generic object (usually a Hash), return directly
87
+ value
88
+ when /\AArray<(?<inner_type>.+)>\z/
89
+ inner_type = Regexp.last_match[:inner_type]
90
+ value.map { |v| _deserialize(inner_type, v) }
91
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
92
+ k_type = Regexp.last_match[:k_type]
93
+ v_type = Regexp.last_match[:v_type]
94
+ {}.tap do |hash|
95
+ value.each do |k, v|
96
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
97
+ end
98
+ end
99
+ else # model
100
+ klass = AftershipAPI::Model.const_get(type)
101
+ klass.build_from_hash(value)
102
+ end
103
+ end
104
+
105
+ # Returns the string representation of the object
106
+ # @return [String] String presentation of the object
107
+ def to_s
108
+ to_hash.to_s
109
+ end
110
+
111
+ # to_body is an alias to to_hash (backward compatibility)
112
+ # @return [Hash] Returns the object in the form of hash
113
+ def to_body
114
+ to_hash
115
+ end
116
+
117
+ # Returns the object in the form of hash
118
+ # @return [Hash] Returns the object in the form of hash
119
+ def to_hash
120
+ hash = {}
121
+ self.class.attribute_map.each_pair do |attr, param|
122
+ value = self.send(attr)
123
+ next if value.nil?
124
+
125
+ hash[param] = _to_hash(value)
126
+ end
127
+ hash
128
+ end
129
+
130
+ # Outputs non-array value in the form of hash
131
+ # For object, use to_hash. Otherwise, just return the value
132
+ # @param value [Object] Any valid value
133
+ # @return [Hash] Returns the value in the form of hash
134
+ def _to_hash(value)
135
+ if value.is_a?(Array)
136
+ value.compact.map { |v| _to_hash(v) }
137
+ elsif value.is_a?(Hash)
138
+ {}.tap do |hash|
139
+ value.each { |k, v| hash[k] = _to_hash(v) }
140
+ end
141
+ elsif value.respond_to? :to_hash
142
+ value.to_hash
143
+ else
144
+ value
145
+ end
146
+ end
147
+
148
+ def to_json(*a)
149
+ to_hash.to_json(*a)
150
+ end
151
+ end
152
+ end
153
+
@@ -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 PutCourierConnectionsByIdResponse
5
+
6
+ # The courier connection ID is a special set of numbers generated by AfterShip to define each user-created connection.
7
+ # id?: String;
8
+ attr_accessor :id
9
+
10
+ # Unique courier code. Get courier codes .
11
+ # courier_slug?: String;
12
+ attr_accessor :courier_slug
13
+
14
+ # It refers to the authentication details required for each specific carrier details required for each specific carrier (such as API keys, username, password, etc.) that the user must provide to establish a carrier connection. The content varies by carrier.
15
+ # credentials?: Object;
16
+ attr_accessor :credentials
17
+
18
+ # The date and time the courier connection was created. It uses the format YYYY-MM-DDTHH:mm:ssZ for the timezone GMT +0.
19
+ # created_at?: String;
20
+ attr_accessor :created_at
21
+
22
+ # The date and time the courier connection was updated. It uses the format YYYY-MM-DDTHH:mm:ssZ for the timezone GMT +0.
23
+ # updated_at?: String;
24
+ attr_accessor :updated_at
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::PutCourierConnectionsByIdResponse` 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?(:'id')
38
+ self.id = attributes[:'id']
39
+ end
40
+
41
+ if attributes.key?(:'courier_slug')
42
+ self.courier_slug = attributes[:'courier_slug']
43
+ end
44
+
45
+ if attributes.key?(:'credentials')
46
+ self.credentials = attributes[:'credentials']
47
+ end
48
+
49
+ if attributes.key?(:'created_at')
50
+ self.created_at = attributes[:'created_at']
51
+ end
52
+
53
+ if attributes.key?(:'updated_at')
54
+ self.updated_at = attributes[:'updated_at']
55
+ end
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'id' => :'String',
62
+ :'courier_slug' => :'String',
63
+ :'credentials' => :'Object',
64
+ :'created_at' => :'String',
65
+ :'updated_at' => :'String',
66
+ }
67
+ end
68
+
69
+ # Attribute mapping from ruby-style variable name to JSON key.
70
+ def self.attribute_map
71
+ {
72
+ :'id' => :'id',
73
+ :'courier_slug' => :'courier_slug',
74
+ :'credentials' => :'credentials',
75
+ :'created_at' => :'created_at',
76
+ :'updated_at' => :'updated_at',
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
+