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.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +16 -19
- data/lib/aftership-tracking-sdk/api/courier.rb +16 -60
- data/lib/aftership-tracking-sdk/api/courier_connection.rb +283 -0
- data/lib/aftership-tracking-sdk/api/estimated_delivery_date.rb +55 -1
- data/lib/aftership-tracking-sdk/api/tracking.rb +17 -17
- data/lib/aftership-tracking-sdk/models/{additional_fields_v1.rb → additional_fields.rb} +9 -9
- data/lib/aftership-tracking-sdk/models/checkpoint.rb +24 -14
- data/lib/aftership-tracking-sdk/models/courier.rb +17 -7
- data/lib/aftership-tracking-sdk/models/courier_connection.rb +193 -0
- data/lib/aftership-tracking-sdk/models/courier_connection_response_for_get_courier_connections.rb +163 -0
- data/lib/aftership-tracking-sdk/models/{courier_response_v1.rb → courier_response.rb} +6 -6
- data/lib/aftership-tracking-sdk/models/create_tracking_request.rb +55 -105
- data/lib/aftership-tracking-sdk/models/create_tracking_response.rb +53 -113
- data/lib/aftership-tracking-sdk/models/credential_field.rb +173 -0
- data/lib/aftership-tracking-sdk/models/{get_user_couriers_response.rb → credentials_courier.rb} +9 -19
- data/lib/aftership-tracking-sdk/models/customers_create_tracking_request.rb +193 -0
- data/lib/aftership-tracking-sdk/models/customers_create_tracking_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/customers_delete_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/customers_get_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/customers_mark_tracking_completed_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/customers_retrack_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/customers_tracking.rb +193 -0
- data/lib/aftership-tracking-sdk/models/customers_update_tracking_by_id_request.rb +193 -0
- data/lib/aftership-tracking-sdk/models/customers_update_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/data_courier_connection_response_for_get_courier_connections.rb +163 -0
- data/lib/aftership-tracking-sdk/models/{data_courier_response_v1.rb → data_courier_response.rb} +2 -2
- data/lib/aftership-tracking-sdk/models/{data_tracking_response_get_multiple_v1.rb → data_tracking_response_for_get_trackings.rb} +4 -4
- data/lib/aftership-tracking-sdk/models/delete_courier_connections_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/delete_tracking_by_id_response.rb +53 -113
- data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_request.rb +6 -6
- data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_response.rb +6 -6
- data/lib/aftership-tracking-sdk/models/destination_address_predict_request.rb +193 -0
- data/lib/aftership-tracking-sdk/models/destination_address_predict_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/detect_courier_request.rb +26 -46
- data/lib/aftership-tracking-sdk/models/estimated_pickup_predict_request.rb +183 -0
- data/lib/aftership-tracking-sdk/models/estimated_pickup_predict_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/{next_couriers_delete_tracking_by_id_response.rb → first_mile_create_tracking_response.rb} +29 -29
- data/lib/aftership-tracking-sdk/models/first_mile_delete_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/first_mile_get_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/first_mile_mark_tracking_completed_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/first_mile_retrack_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/{next_couriers_get_tracking_by_id_response.rb → first_mile_tracking.rb} +29 -29
- data/lib/aftership-tracking-sdk/models/first_mile_update_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/get_courier_connections_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/get_courier_connections_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/{get_all_couriers_response.rb → get_couriers_response.rb} +2 -2
- data/lib/aftership-tracking-sdk/models/get_tracking_by_id_response.rb +53 -113
- data/lib/aftership-tracking-sdk/models/{next_couriers_create_tracking_request.rb → last_mile_create_tracking_request.rb} +13 -13
- data/lib/aftership-tracking-sdk/models/last_mile_create_tracking_response.rb +203 -0
- data/lib/aftership-tracking-sdk/models/{next_couriers_create_tracking_response.rb → last_mile_delete_tracking_by_id_response.rb} +33 -23
- data/lib/aftership-tracking-sdk/models/last_mile_get_tracking_by_id_response.rb +203 -0
- data/lib/aftership-tracking-sdk/models/last_mile_mark_tracking_completed_by_id_response.rb +203 -0
- data/lib/aftership-tracking-sdk/models/last_mile_retrack_tracking_by_id_response.rb +203 -0
- data/lib/aftership-tracking-sdk/models/{next_couriers_mark_tracking_completed_by_id_response.rb → last_mile_tracking.rb} +33 -23
- data/lib/aftership-tracking-sdk/models/last_mile_update_tracking_by_id_response.rb +203 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_create_tracking_response.rb +10 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_delete_tracking_by_id_response.rb +10 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_get_tracking_by_id_response.rb +10 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_mark_tracking_completed_by_id_response.rb +10 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_retrack_tracking_by_id_response.rb +10 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_tracking.rb +10 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_update_tracking_by_id_response.rb +10 -0
- data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_request.rb +10 -0
- data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_response.rb +53 -113
- data/lib/aftership-tracking-sdk/models/{meta_v1.rb → meta.rb} +2 -2
- data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_predict_request.rb +163 -0
- data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_predict_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_request.rb +6 -6
- data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_response.rb +6 -6
- data/lib/aftership-tracking-sdk/models/origin_address_predict_request.rb +193 -0
- data/lib/aftership-tracking-sdk/models/origin_address_predict_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/pagination_data_courier_connection_response_for_get_courier_connections.rb +173 -0
- data/lib/aftership-tracking-sdk/models/{pagination_data_tracking_response_get_multiple_v1.rb → pagination_data_tracking_response_for_get_trackings.rb} +2 -2
- data/lib/aftership-tracking-sdk/models/pagination_get_courier_connections_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/post_courier_connections_request.rb +163 -0
- data/lib/aftership-tracking-sdk/models/post_courier_connections_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/predict_request.rb +223 -0
- data/lib/aftership-tracking-sdk/models/predict_response.rb +273 -0
- data/lib/aftership-tracking-sdk/models/put_courier_connections_by_id_request.rb +153 -0
- data/lib/aftership-tracking-sdk/models/put_courier_connections_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/retrack_tracking_by_id_response.rb +53 -113
- data/lib/aftership-tracking-sdk/models/{slug_group_v1.rb → slug_group.rb} +3 -3
- data/lib/aftership-tracking-sdk/models/{tag_v1.rb → tag.rb} +3 -3
- data/lib/aftership-tracking-sdk/models/tracking.rb +53 -113
- data/lib/aftership-tracking-sdk/models/{tracking_response_v1.rb → tracking_response.rb} +4 -4
- data/lib/aftership-tracking-sdk/models/{tracking_response_get_multiple_v1.rb → tracking_response_for_get_trackings.rb} +6 -6
- data/lib/aftership-tracking-sdk/models/update_tracking_by_id_request.rb +23 -83
- data/lib/aftership-tracking-sdk/models/update_tracking_by_id_response.rb +53 -113
- data/lib/aftership-tracking-sdk/models/weight_predict_request.rb +163 -0
- data/lib/aftership-tracking-sdk/models/weight_predict_response.rb +163 -0
- data/lib/aftership-tracking-sdk/version.rb +1 -1
- metadata +67 -25
- data/lib/aftership-tracking-sdk/models/next_couriers_retrack_tracking_by_id_response.rb +0 -193
- data/lib/aftership-tracking-sdk/models/next_couriers_tracking.rb +0 -193
- 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 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
|
+
|
@@ -1,79 +1,79 @@
|
|
1
1
|
# This code was auto generated by AfterShip SDK Generator.
|
2
2
|
# Do not edit the class manually.
|
3
3
|
module AftershipAPI::Model
|
4
|
-
class
|
4
|
+
class FirstMileCreateTrackingResponse
|
5
5
|
|
6
|
-
#
|
7
|
-
#
|
8
|
-
attr_accessor :slug
|
9
|
-
|
10
|
-
# Tracking number.
|
11
|
-
# tracking_number: String;
|
6
|
+
# The tracking number of the first-mile carrier.
|
7
|
+
# tracking_number?: String;
|
12
8
|
attr_accessor :tracking_number
|
13
9
|
|
14
|
-
#
|
15
|
-
#
|
16
|
-
attr_accessor :
|
10
|
+
# The unique code of the carrier responsible for the first-mile of the shipment. Find all the courier slugs .
|
11
|
+
# slug?: String;
|
12
|
+
attr_accessor :slug
|
17
13
|
|
18
|
-
# The
|
19
|
-
#
|
20
|
-
attr_accessor :
|
14
|
+
# The transit time for the first-mile of a shipment in days. This field is calculated based on whether the handed_over_to_last_mile_carrier or received_by_last_mile_carrier event is detected by AfterShip. The handover event date is used to calculate the first-mile transit time.- First mile transit time (in days) = Handover date - Pickup date
|
15
|
+
# transit_time?: Integer;
|
16
|
+
attr_accessor :transit_time
|
21
17
|
|
22
|
-
# The field provides the link for modifying delivery instructions (such as delivery date and shipping address) if supported by the
|
18
|
+
# The field provides the link for modifying delivery instructions (such as delivery date and shipping address), if supported by the first-mile carrier. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US".
|
23
19
|
# courier_redirect_link?: String;
|
24
20
|
attr_accessor :courier_redirect_link
|
25
21
|
|
22
|
+
# The field contains the official tracking URL of the first-mile carrier, if available. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US".
|
23
|
+
# courier_tracking_link?: String;
|
24
|
+
attr_accessor :courier_tracking_link
|
25
|
+
|
26
26
|
# Initializes the object
|
27
27
|
# @param [Hash] attributes Model attributes in the form of hash
|
28
28
|
def initialize(attributes = {})
|
29
29
|
if (!attributes.is_a?(Hash))
|
30
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::
|
30
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::FirstMileCreateTrackingResponse` initialize method"
|
31
31
|
end
|
32
32
|
|
33
33
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
34
34
|
h[k.to_sym] = v
|
35
35
|
}
|
36
36
|
|
37
|
-
if attributes.key?(:'slug')
|
38
|
-
self.slug = attributes[:'slug']
|
39
|
-
end
|
40
|
-
|
41
37
|
if attributes.key?(:'tracking_number')
|
42
38
|
self.tracking_number = attributes[:'tracking_number']
|
43
39
|
end
|
44
40
|
|
45
|
-
if attributes.key?(:'
|
46
|
-
self.
|
41
|
+
if attributes.key?(:'slug')
|
42
|
+
self.slug = attributes[:'slug']
|
47
43
|
end
|
48
44
|
|
49
|
-
if attributes.key?(:'
|
50
|
-
self.
|
45
|
+
if attributes.key?(:'transit_time')
|
46
|
+
self.transit_time = attributes[:'transit_time']
|
51
47
|
end
|
52
48
|
|
53
49
|
if attributes.key?(:'courier_redirect_link')
|
54
50
|
self.courier_redirect_link = attributes[:'courier_redirect_link']
|
55
51
|
end
|
52
|
+
|
53
|
+
if attributes.key?(:'courier_tracking_link')
|
54
|
+
self.courier_tracking_link = attributes[:'courier_tracking_link']
|
55
|
+
end
|
56
56
|
end
|
57
57
|
|
58
58
|
# Attribute type mapping.
|
59
59
|
def self.openapi_types
|
60
60
|
{
|
61
|
-
:'slug' => :'String',
|
62
61
|
:'tracking_number' => :'String',
|
63
|
-
:'
|
64
|
-
:'
|
62
|
+
:'slug' => :'String',
|
63
|
+
:'transit_time' => :'Integer',
|
65
64
|
:'courier_redirect_link' => :'String',
|
65
|
+
:'courier_tracking_link' => :'String',
|
66
66
|
}
|
67
67
|
end
|
68
68
|
|
69
69
|
# Attribute mapping from ruby-style variable name to JSON key.
|
70
70
|
def self.attribute_map
|
71
71
|
{
|
72
|
-
:'slug' => :'slug',
|
73
72
|
:'tracking_number' => :'tracking_number',
|
74
|
-
:'
|
75
|
-
:'
|
73
|
+
:'slug' => :'slug',
|
74
|
+
:'transit_time' => :'transit_time',
|
76
75
|
:'courier_redirect_link' => :'courier_redirect_link',
|
76
|
+
:'courier_tracking_link' => :'courier_tracking_link',
|
77
77
|
}
|
78
78
|
end
|
79
79
|
|
@@ -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 FirstMileDeleteTrackingByIdResponse
|
5
|
+
|
6
|
+
# The tracking number of the first-mile carrier.
|
7
|
+
# tracking_number?: String;
|
8
|
+
attr_accessor :tracking_number
|
9
|
+
|
10
|
+
# The unique code of the carrier responsible for the first-mile of the shipment. Find all the courier slugs .
|
11
|
+
# slug?: String;
|
12
|
+
attr_accessor :slug
|
13
|
+
|
14
|
+
# The transit time for the first-mile of a shipment in days. This field is calculated based on whether the handed_over_to_last_mile_carrier or received_by_last_mile_carrier event is detected by AfterShip. The handover event date is used to calculate the first-mile transit time.- First mile transit time (in days) = Handover date - Pickup date
|
15
|
+
# transit_time?: Integer;
|
16
|
+
attr_accessor :transit_time
|
17
|
+
|
18
|
+
# The field provides the link for modifying delivery instructions (such as delivery date and shipping address), if supported by the first-mile carrier. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US".
|
19
|
+
# courier_redirect_link?: String;
|
20
|
+
attr_accessor :courier_redirect_link
|
21
|
+
|
22
|
+
# The field contains the official tracking URL of the first-mile carrier, if available. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US".
|
23
|
+
# courier_tracking_link?: String;
|
24
|
+
attr_accessor :courier_tracking_link
|
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::FirstMileDeleteTrackingByIdResponse` 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?(:'tracking_number')
|
38
|
+
self.tracking_number = attributes[:'tracking_number']
|
39
|
+
end
|
40
|
+
|
41
|
+
if attributes.key?(:'slug')
|
42
|
+
self.slug = attributes[:'slug']
|
43
|
+
end
|
44
|
+
|
45
|
+
if attributes.key?(:'transit_time')
|
46
|
+
self.transit_time = attributes[:'transit_time']
|
47
|
+
end
|
48
|
+
|
49
|
+
if attributes.key?(:'courier_redirect_link')
|
50
|
+
self.courier_redirect_link = attributes[:'courier_redirect_link']
|
51
|
+
end
|
52
|
+
|
53
|
+
if attributes.key?(:'courier_tracking_link')
|
54
|
+
self.courier_tracking_link = attributes[:'courier_tracking_link']
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Attribute type mapping.
|
59
|
+
def self.openapi_types
|
60
|
+
{
|
61
|
+
:'tracking_number' => :'String',
|
62
|
+
:'slug' => :'String',
|
63
|
+
:'transit_time' => :'Integer',
|
64
|
+
:'courier_redirect_link' => :'String',
|
65
|
+
:'courier_tracking_link' => :'String',
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
70
|
+
def self.attribute_map
|
71
|
+
{
|
72
|
+
:'tracking_number' => :'tracking_number',
|
73
|
+
:'slug' => :'slug',
|
74
|
+
:'transit_time' => :'transit_time',
|
75
|
+
:'courier_redirect_link' => :'courier_redirect_link',
|
76
|
+
:'courier_tracking_link' => :'courier_tracking_link',
|
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
|
+
|
@@ -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 FirstMileGetTrackingByIdResponse
|
5
|
+
|
6
|
+
# The tracking number of the first-mile carrier.
|
7
|
+
# tracking_number?: String;
|
8
|
+
attr_accessor :tracking_number
|
9
|
+
|
10
|
+
# The unique code of the carrier responsible for the first-mile of the shipment. Find all the courier slugs .
|
11
|
+
# slug?: String;
|
12
|
+
attr_accessor :slug
|
13
|
+
|
14
|
+
# The transit time for the first-mile of a shipment in days. This field is calculated based on whether the handed_over_to_last_mile_carrier or received_by_last_mile_carrier event is detected by AfterShip. The handover event date is used to calculate the first-mile transit time.- First mile transit time (in days) = Handover date - Pickup date
|
15
|
+
# transit_time?: Integer;
|
16
|
+
attr_accessor :transit_time
|
17
|
+
|
18
|
+
# The field provides the link for modifying delivery instructions (such as delivery date and shipping address), if supported by the first-mile carrier. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US".
|
19
|
+
# courier_redirect_link?: String;
|
20
|
+
attr_accessor :courier_redirect_link
|
21
|
+
|
22
|
+
# The field contains the official tracking URL of the first-mile carrier, if available. The language parameter of this link is determined by the destination country/region and the language associated with the shipment. If the destination country/region and language data is unavailable, AfterShip will default the language parameter to "US".
|
23
|
+
# courier_tracking_link?: String;
|
24
|
+
attr_accessor :courier_tracking_link
|
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::FirstMileGetTrackingByIdResponse` 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?(:'tracking_number')
|
38
|
+
self.tracking_number = attributes[:'tracking_number']
|
39
|
+
end
|
40
|
+
|
41
|
+
if attributes.key?(:'slug')
|
42
|
+
self.slug = attributes[:'slug']
|
43
|
+
end
|
44
|
+
|
45
|
+
if attributes.key?(:'transit_time')
|
46
|
+
self.transit_time = attributes[:'transit_time']
|
47
|
+
end
|
48
|
+
|
49
|
+
if attributes.key?(:'courier_redirect_link')
|
50
|
+
self.courier_redirect_link = attributes[:'courier_redirect_link']
|
51
|
+
end
|
52
|
+
|
53
|
+
if attributes.key?(:'courier_tracking_link')
|
54
|
+
self.courier_tracking_link = attributes[:'courier_tracking_link']
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Attribute type mapping.
|
59
|
+
def self.openapi_types
|
60
|
+
{
|
61
|
+
:'tracking_number' => :'String',
|
62
|
+
:'slug' => :'String',
|
63
|
+
:'transit_time' => :'Integer',
|
64
|
+
:'courier_redirect_link' => :'String',
|
65
|
+
:'courier_tracking_link' => :'String',
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
70
|
+
def self.attribute_map
|
71
|
+
{
|
72
|
+
:'tracking_number' => :'tracking_number',
|
73
|
+
:'slug' => :'slug',
|
74
|
+
:'transit_time' => :'transit_time',
|
75
|
+
:'courier_redirect_link' => :'courier_redirect_link',
|
76
|
+
:'courier_tracking_link' => :'courier_tracking_link',
|
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
|
+
|