aftership-tracking-sdk 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +11 -0
- data/LICENSE +21 -0
- data/README.md +285 -0
- data/aftership-tracking-sdk.gemspec +27 -0
- data/lib/aftership-tracking-sdk/api/courier.rb +163 -0
- data/lib/aftership-tracking-sdk/api/estimated_delivery_date.rb +67 -0
- data/lib/aftership-tracking-sdk/api/last_checkpoint.rb +143 -0
- data/lib/aftership-tracking-sdk/api/notification.rb +403 -0
- data/lib/aftership-tracking-sdk/api/tracking.rb +793 -0
- data/lib/aftership-tracking-sdk/api_client.rb +426 -0
- data/lib/aftership-tracking-sdk/configuration.rb +122 -0
- data/lib/aftership-tracking-sdk/error.rb +125 -0
- data/lib/aftership-tracking-sdk/models/additional_fields_v1.rb +32 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_tracking.rb +181 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_tracking.rb +161 -0
- data/lib/aftership-tracking-sdk/models/checkpoint.rb +301 -0
- data/lib/aftership-tracking-sdk/models/coordinate_checkpoint.rb +161 -0
- data/lib/aftership-tracking-sdk/models/courier.rb +241 -0
- data/lib/aftership-tracking-sdk/models/courier_response_v1.rb +161 -0
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_tracking.rb +181 -0
- data/lib/aftership-tracking-sdk/models/custom_fields_tracking_update_tracking_by_slug_tracking_number_request.rb +139 -0
- data/lib/aftership-tracking-sdk/models/data_courier_response_v1.rb +161 -0
- data/lib/aftership-tracking-sdk/models/data_notification_response_v1.rb +151 -0
- data/lib/aftership-tracking-sdk/models/data_tracking_delete_response_v1.rb +151 -0
- data/lib/aftership-tracking-sdk/models/data_tracking_response_get_multiple_v1.rb +281 -0
- data/lib/aftership-tracking-sdk/models/data_tracking_response_v1.rb +151 -0
- data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_request.rb +191 -0
- data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_response.rb +191 -0
- data/lib/aftership-tracking-sdk/models/detect_courier_response.rb +161 -0
- data/lib/aftership-tracking-sdk/models/estimated_delivery_date_request.rb +221 -0
- data/lib/aftership-tracking-sdk/models/estimated_delivery_date_response.rb +261 -0
- data/lib/aftership-tracking-sdk/models/estimated_pickup_estimated_delivery_date_request.rb +181 -0
- data/lib/aftership-tracking-sdk/models/estimated_pickup_estimated_delivery_date_response.rb +191 -0
- data/lib/aftership-tracking-sdk/models/events_checkpoint.rb +161 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_tracking.rb +191 -0
- data/lib/aftership-tracking-sdk/models/get_all_couriers_response.rb +161 -0
- data/lib/aftership-tracking-sdk/models/get_checkpoint_by_slug_tracking_number_response.rb +211 -0
- data/lib/aftership-tracking-sdk/models/get_checkpoint_by_tracking_id_response.rb +211 -0
- data/lib/aftership-tracking-sdk/models/get_trackings_response.rb +161 -0
- data/lib/aftership-tracking-sdk/models/get_user_couriers_response.rb +161 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_tracking.rb +191 -0
- data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_request.rb +151 -0
- data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_slug_tracking_number_request.rb +151 -0
- data/lib/aftership-tracking-sdk/models/meta_v1.rb +171 -0
- data/lib/aftership-tracking-sdk/models/next_couriers_tracking.rb +171 -0
- data/lib/aftership-tracking-sdk/models/next_couriers_tracking_create_tracking_request.rb +161 -0
- data/lib/aftership-tracking-sdk/models/notification.rb +161 -0
- data/lib/aftership-tracking-sdk/models/notification_request_v1.rb +161 -0
- data/lib/aftership-tracking-sdk/models/notification_response_v1.rb +161 -0
- data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_estimated_delivery_date_request.rb +161 -0
- data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_estimated_delivery_date_response.rb +161 -0
- data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_request.rb +191 -0
- data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_response.rb +191 -0
- data/lib/aftership-tracking-sdk/models/pagination.rb +156 -0
- data/lib/aftership-tracking-sdk/models/partial_delete_tracking.rb +241 -0
- data/lib/aftership-tracking-sdk/models/partial_update_tracking.rb +251 -0
- data/lib/aftership-tracking-sdk/models/predict_batch_request.rb +151 -0
- data/lib/aftership-tracking-sdk/models/predict_batch_response.rb +151 -0
- data/lib/aftership-tracking-sdk/models/reason_events_checkpoint.rb +151 -0
- data/lib/aftership-tracking-sdk/models/slug_group_v1.rb +37 -0
- data/lib/aftership-tracking-sdk/models/tag_v1.rb +34 -0
- data/lib/aftership-tracking-sdk/models/tracking.rb +921 -0
- data/lib/aftership-tracking-sdk/models/tracking_create_tracking_request.rb +551 -0
- data/lib/aftership-tracking-sdk/models/tracking_delete_response_v1.rb +161 -0
- data/lib/aftership-tracking-sdk/models/tracking_detect_courier_request.rb +261 -0
- data/lib/aftership-tracking-sdk/models/tracking_response_get_multiple_v1.rb +161 -0
- data/lib/aftership-tracking-sdk/models/tracking_response_v1.rb +161 -0
- data/lib/aftership-tracking-sdk/models/tracking_update_tracking_by_id_request.rb +501 -0
- data/lib/aftership-tracking-sdk/models/tracking_update_tracking_by_slug_tracking_number_request.rb +391 -0
- data/lib/aftership-tracking-sdk/models/weight_estimated_delivery_date_request.rb +161 -0
- data/lib/aftership-tracking-sdk/models/weight_estimated_delivery_date_response.rb +161 -0
- data/lib/aftership-tracking-sdk/sign_string.rb +77 -0
- data/lib/aftership-tracking-sdk/version.rb +5 -0
- data/lib/aftership-tracking-sdk.rb +47 -0
- metadata +157 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# This code was auto generated by AfterShip SDK Generator.
|
|
2
|
+
# Do not edit the class manually.
|
|
3
|
+
module AftershipAPI::Model
|
|
4
|
+
class AftershipEstimatedDeliveryDateTracking
|
|
5
|
+
# The estimated arrival date of the shipment.
|
|
6
|
+
# estimated_delivery_date?: String;
|
|
7
|
+
attr_accessor :estimated_delivery_date
|
|
8
|
+
|
|
9
|
+
# Indicates the confidence level and associated reason for an AI EDD prediction request. For a comprehensive list of confidence codes, refer to .
|
|
10
|
+
# confidence_code?: Float;
|
|
11
|
+
attr_accessor :confidence_code
|
|
12
|
+
|
|
13
|
+
# Earliest estimated delivery date of the shipment.
|
|
14
|
+
# estimated_delivery_date_min?: String;
|
|
15
|
+
attr_accessor :estimated_delivery_date_min
|
|
16
|
+
|
|
17
|
+
# Latest estimated delivery date of the shipment.
|
|
18
|
+
# estimated_delivery_date_max?: String;
|
|
19
|
+
attr_accessor :estimated_delivery_date_max
|
|
20
|
+
|
|
21
|
+
# Initializes the object
|
|
22
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
23
|
+
def initialize(attributes = {})
|
|
24
|
+
if (!attributes.is_a?(Hash))
|
|
25
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::AftershipEstimatedDeliveryDateTracking` initialize method"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
29
|
+
h[k.to_sym] = v
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if attributes.key?(:'estimated_delivery_date')
|
|
33
|
+
self.estimated_delivery_date = attributes[:'estimated_delivery_date']
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
if attributes.key?(:'confidence_code')
|
|
37
|
+
self.confidence_code = attributes[:'confidence_code']
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
if attributes.key?(:'estimated_delivery_date_min')
|
|
41
|
+
self.estimated_delivery_date_min = attributes[:'estimated_delivery_date_min']
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
if attributes.key?(:'estimated_delivery_date_max')
|
|
45
|
+
self.estimated_delivery_date_max = attributes[:'estimated_delivery_date_max']
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Attribute type mapping.
|
|
50
|
+
def self.openapi_types
|
|
51
|
+
{
|
|
52
|
+
:'estimated_delivery_date' => :'String',
|
|
53
|
+
:'confidence_code' => :'Float',
|
|
54
|
+
:'estimated_delivery_date_min' => :'String',
|
|
55
|
+
:'estimated_delivery_date_max' => :'String',
|
|
56
|
+
}
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
60
|
+
def self.attribute_map
|
|
61
|
+
{
|
|
62
|
+
:'estimated_delivery_date' => :'estimated_delivery_date',
|
|
63
|
+
:'confidence_code' => :'confidence_code',
|
|
64
|
+
:'estimated_delivery_date_min' => :'estimated_delivery_date_min',
|
|
65
|
+
:'estimated_delivery_date_max' => :'estimated_delivery_date_max',
|
|
66
|
+
}
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Builds the object from hash
|
|
70
|
+
# @param attributes [Hash] Model attributes in the form of hash
|
|
71
|
+
# @return [Object] Returns the model itself
|
|
72
|
+
def self.build_from_hash(attributes)
|
|
73
|
+
return nil unless attributes.is_a?(Hash)
|
|
74
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
75
|
+
transformed_hash = {}
|
|
76
|
+
openapi_types.each_pair do |key, type|
|
|
77
|
+
if attributes.key?(key) && attributes[key].nil?
|
|
78
|
+
transformed_hash["#{key}"] = nil
|
|
79
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
80
|
+
# check to ensure the input is an array given that the attribute
|
|
81
|
+
# is documented as an array but the input is not
|
|
82
|
+
if attributes[key].is_a?(Array)
|
|
83
|
+
transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
|
|
84
|
+
end
|
|
85
|
+
elsif !attributes[key].nil?
|
|
86
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[key])
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
new(transformed_hash)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Deserializes the data based on type
|
|
93
|
+
# @param type [String] Data type
|
|
94
|
+
# @param value [String] Value to be deserialized
|
|
95
|
+
# @return [Object] Deserialized data
|
|
96
|
+
def self._deserialize(type, value)
|
|
97
|
+
case type.to_sym
|
|
98
|
+
when :Time
|
|
99
|
+
Time.parse(value)
|
|
100
|
+
when :Date
|
|
101
|
+
Date.parse(value)
|
|
102
|
+
when :String
|
|
103
|
+
value.to_s
|
|
104
|
+
when :Integer
|
|
105
|
+
value.to_i
|
|
106
|
+
when :Float
|
|
107
|
+
value.to_f
|
|
108
|
+
when :Boolean
|
|
109
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
110
|
+
true
|
|
111
|
+
else
|
|
112
|
+
false
|
|
113
|
+
end
|
|
114
|
+
when :Object
|
|
115
|
+
# generic object (usually a Hash), return directly
|
|
116
|
+
value
|
|
117
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
118
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
119
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
120
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
121
|
+
k_type = Regexp.last_match[:k_type]
|
|
122
|
+
v_type = Regexp.last_match[:v_type]
|
|
123
|
+
{}.tap do |hash|
|
|
124
|
+
value.each do |k, v|
|
|
125
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
else # model
|
|
129
|
+
klass = AftershipAPI::Model.const_get(type)
|
|
130
|
+
klass.build_from_hash(value)
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Returns the string representation of the object
|
|
135
|
+
# @return [String] String presentation of the object
|
|
136
|
+
def to_s
|
|
137
|
+
to_hash.to_s
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
141
|
+
# @return [Hash] Returns the object in the form of hash
|
|
142
|
+
def to_body
|
|
143
|
+
to_hash
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Returns the object in the form of hash
|
|
147
|
+
# @return [Hash] Returns the object in the form of hash
|
|
148
|
+
def to_hash
|
|
149
|
+
hash = {}
|
|
150
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
151
|
+
value = self.send(attr)
|
|
152
|
+
next if value.nil?
|
|
153
|
+
|
|
154
|
+
hash[param] = _to_hash(value)
|
|
155
|
+
end
|
|
156
|
+
hash
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Outputs non-array value in the form of hash
|
|
160
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
161
|
+
# @param value [Object] Any valid value
|
|
162
|
+
# @return [Hash] Returns the value in the form of hash
|
|
163
|
+
def _to_hash(value)
|
|
164
|
+
if value.is_a?(Array)
|
|
165
|
+
value.compact.map { |v| _to_hash(v) }
|
|
166
|
+
elsif value.is_a?(Hash)
|
|
167
|
+
{}.tap do |hash|
|
|
168
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
169
|
+
end
|
|
170
|
+
elsif value.respond_to? :to_hash
|
|
171
|
+
value.to_hash
|
|
172
|
+
else
|
|
173
|
+
value
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def to_json(*a)
|
|
178
|
+
to_hash.to_json(*a)
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
end
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# This code was auto generated by AfterShip SDK Generator.
|
|
2
|
+
# Do not edit the class manually.
|
|
3
|
+
module AftershipAPI::Model
|
|
4
|
+
class CarbonEmissionsTracking
|
|
5
|
+
# The unit in which the value field is expressed. Allowed values: kg
|
|
6
|
+
# unit?: String;
|
|
7
|
+
attr_accessor :unit
|
|
8
|
+
|
|
9
|
+
# The total amount of carbon emissions
|
|
10
|
+
# value?: Float;
|
|
11
|
+
attr_accessor :value
|
|
12
|
+
|
|
13
|
+
# Initializes the object
|
|
14
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
15
|
+
def initialize(attributes = {})
|
|
16
|
+
if (!attributes.is_a?(Hash))
|
|
17
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::CarbonEmissionsTracking` initialize method"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
21
|
+
h[k.to_sym] = v
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if attributes.key?(:'unit')
|
|
25
|
+
self.unit = attributes[:'unit']
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
if attributes.key?(:'value')
|
|
29
|
+
self.value = attributes[:'value']
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Attribute type mapping.
|
|
34
|
+
def self.openapi_types
|
|
35
|
+
{
|
|
36
|
+
:'unit' => :'String',
|
|
37
|
+
:'value' => :'Float',
|
|
38
|
+
}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
42
|
+
def self.attribute_map
|
|
43
|
+
{
|
|
44
|
+
:'unit' => :'unit',
|
|
45
|
+
:'value' => :'value',
|
|
46
|
+
}
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Builds the object from hash
|
|
50
|
+
# @param attributes [Hash] Model attributes in the form of hash
|
|
51
|
+
# @return [Object] Returns the model itself
|
|
52
|
+
def self.build_from_hash(attributes)
|
|
53
|
+
return nil unless attributes.is_a?(Hash)
|
|
54
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
55
|
+
transformed_hash = {}
|
|
56
|
+
openapi_types.each_pair do |key, type|
|
|
57
|
+
if attributes.key?(key) && attributes[key].nil?
|
|
58
|
+
transformed_hash["#{key}"] = nil
|
|
59
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
60
|
+
# check to ensure the input is an array given that the attribute
|
|
61
|
+
# is documented as an array but the input is not
|
|
62
|
+
if attributes[key].is_a?(Array)
|
|
63
|
+
transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
|
|
64
|
+
end
|
|
65
|
+
elsif !attributes[key].nil?
|
|
66
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[key])
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
new(transformed_hash)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Deserializes the data based on type
|
|
73
|
+
# @param type [String] Data type
|
|
74
|
+
# @param value [String] Value to be deserialized
|
|
75
|
+
# @return [Object] Deserialized data
|
|
76
|
+
def self._deserialize(type, value)
|
|
77
|
+
case type.to_sym
|
|
78
|
+
when :Time
|
|
79
|
+
Time.parse(value)
|
|
80
|
+
when :Date
|
|
81
|
+
Date.parse(value)
|
|
82
|
+
when :String
|
|
83
|
+
value.to_s
|
|
84
|
+
when :Integer
|
|
85
|
+
value.to_i
|
|
86
|
+
when :Float
|
|
87
|
+
value.to_f
|
|
88
|
+
when :Boolean
|
|
89
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
90
|
+
true
|
|
91
|
+
else
|
|
92
|
+
false
|
|
93
|
+
end
|
|
94
|
+
when :Object
|
|
95
|
+
# generic object (usually a Hash), return directly
|
|
96
|
+
value
|
|
97
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
98
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
99
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
100
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
101
|
+
k_type = Regexp.last_match[:k_type]
|
|
102
|
+
v_type = Regexp.last_match[:v_type]
|
|
103
|
+
{}.tap do |hash|
|
|
104
|
+
value.each do |k, v|
|
|
105
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
else # model
|
|
109
|
+
klass = AftershipAPI::Model.const_get(type)
|
|
110
|
+
klass.build_from_hash(value)
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Returns the string representation of the object
|
|
115
|
+
# @return [String] String presentation of the object
|
|
116
|
+
def to_s
|
|
117
|
+
to_hash.to_s
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
121
|
+
# @return [Hash] Returns the object in the form of hash
|
|
122
|
+
def to_body
|
|
123
|
+
to_hash
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Returns the object in the form of hash
|
|
127
|
+
# @return [Hash] Returns the object in the form of hash
|
|
128
|
+
def to_hash
|
|
129
|
+
hash = {}
|
|
130
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
131
|
+
value = self.send(attr)
|
|
132
|
+
next if value.nil?
|
|
133
|
+
|
|
134
|
+
hash[param] = _to_hash(value)
|
|
135
|
+
end
|
|
136
|
+
hash
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Outputs non-array value in the form of hash
|
|
140
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
141
|
+
# @param value [Object] Any valid value
|
|
142
|
+
# @return [Hash] Returns the value in the form of hash
|
|
143
|
+
def _to_hash(value)
|
|
144
|
+
if value.is_a?(Array)
|
|
145
|
+
value.compact.map { |v| _to_hash(v) }
|
|
146
|
+
elsif value.is_a?(Hash)
|
|
147
|
+
{}.tap do |hash|
|
|
148
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
149
|
+
end
|
|
150
|
+
elsif value.respond_to? :to_hash
|
|
151
|
+
value.to_hash
|
|
152
|
+
else
|
|
153
|
+
value
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def to_json(*a)
|
|
158
|
+
to_hash.to_json(*a)
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
end
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
# This code was auto generated by AfterShip SDK Generator.
|
|
2
|
+
# Do not edit the class manually.
|
|
3
|
+
module AftershipAPI::Model
|
|
4
|
+
class Checkpoint
|
|
5
|
+
# The date and time of the checkpoint event was added to AfterShip. It uses the format `YYYY-MM-DDTHH:mm:ssZ` for the timezone GMT +0.
|
|
6
|
+
# created_at?: String;
|
|
7
|
+
attr_accessor :created_at
|
|
8
|
+
|
|
9
|
+
# The unique code of courier for this checkpoint. Get courier slug
|
|
10
|
+
# slug?: String;
|
|
11
|
+
attr_accessor :slug
|
|
12
|
+
|
|
13
|
+
# The date and time of the checkpoint event, provided by the carrier. It uses the timezone of the checkpoint. The format may differ depending on how the carrier provides it:- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ
|
|
14
|
+
# checkpoint_time?: String;
|
|
15
|
+
attr_accessor :checkpoint_time
|
|
16
|
+
|
|
17
|
+
# Location info provided by carrier
|
|
18
|
+
# location?: String;
|
|
19
|
+
attr_accessor :location
|
|
20
|
+
|
|
21
|
+
# City info provided by carrier
|
|
22
|
+
# city?: String;
|
|
23
|
+
attr_accessor :city
|
|
24
|
+
|
|
25
|
+
# State info provided by carrier
|
|
26
|
+
# state?: String;
|
|
27
|
+
attr_accessor :state
|
|
28
|
+
|
|
29
|
+
# Postal code info provided by carrier
|
|
30
|
+
# zip?: String;
|
|
31
|
+
attr_accessor :zip
|
|
32
|
+
|
|
33
|
+
# The latitude and longitude coordinates indicate the precise location of the shipments that are currently in transit.
|
|
34
|
+
# coordinate?: CoordinateCheckpoint;
|
|
35
|
+
attr_accessor :coordinate
|
|
36
|
+
|
|
37
|
+
# Country/Region ISO Alpha-3 (three letters) of the checkpoint
|
|
38
|
+
# country_iso3?: String;
|
|
39
|
+
attr_accessor :country_iso3
|
|
40
|
+
|
|
41
|
+
# Country/Region name of the checkpoint, may also contain other location info.
|
|
42
|
+
# country_name?: String;
|
|
43
|
+
attr_accessor :country_name
|
|
44
|
+
|
|
45
|
+
# Checkpoint message
|
|
46
|
+
# message?: String;
|
|
47
|
+
attr_accessor :message
|
|
48
|
+
|
|
49
|
+
# Current status of tracking. (
|
|
50
|
+
# tag?: TagV1;
|
|
51
|
+
attr_accessor :tag
|
|
52
|
+
|
|
53
|
+
# Current subtag of checkpoint. (
|
|
54
|
+
# subtag?: String;
|
|
55
|
+
attr_accessor :subtag
|
|
56
|
+
|
|
57
|
+
# Normalized checkpoint message. (
|
|
58
|
+
# subtag_message?: String;
|
|
59
|
+
attr_accessor :subtag_message
|
|
60
|
+
|
|
61
|
+
# Checkpoint raw status provided by courier
|
|
62
|
+
# raw_tag?: String;
|
|
63
|
+
attr_accessor :raw_tag
|
|
64
|
+
|
|
65
|
+
# The array provides details about specific event(s) that occurred to a shipment, such as "returned_to_sender". You can find the full list of events and reasons </span>- The events' value for the same checkpoint message is subject to change as we consistently strive to enhance the performance of this feature.
|
|
66
|
+
# events?: EventsCheckpoint[];
|
|
67
|
+
attr_accessor :events
|
|
68
|
+
|
|
69
|
+
# Initializes the object
|
|
70
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
71
|
+
def initialize(attributes = {})
|
|
72
|
+
if (!attributes.is_a?(Hash))
|
|
73
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::Checkpoint` initialize method"
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
77
|
+
h[k.to_sym] = v
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if attributes.key?(:'created_at')
|
|
81
|
+
self.created_at = attributes[:'created_at']
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
if attributes.key?(:'slug')
|
|
85
|
+
self.slug = attributes[:'slug']
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
if attributes.key?(:'checkpoint_time')
|
|
89
|
+
self.checkpoint_time = attributes[:'checkpoint_time']
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
if attributes.key?(:'location')
|
|
93
|
+
self.location = attributes[:'location']
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
if attributes.key?(:'city')
|
|
97
|
+
self.city = attributes[:'city']
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
if attributes.key?(:'state')
|
|
101
|
+
self.state = attributes[:'state']
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if attributes.key?(:'zip')
|
|
105
|
+
self.zip = attributes[:'zip']
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if attributes.key?(:'coordinate')
|
|
109
|
+
self.coordinate = attributes[:'coordinate']
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
if attributes.key?(:'country_iso3')
|
|
113
|
+
self.country_iso3 = attributes[:'country_iso3']
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
if attributes.key?(:'country_name')
|
|
117
|
+
self.country_name = attributes[:'country_name']
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
if attributes.key?(:'message')
|
|
121
|
+
self.message = attributes[:'message']
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
if attributes.key?(:'tag')
|
|
125
|
+
self.tag = attributes[:'tag']
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if attributes.key?(:'subtag')
|
|
129
|
+
self.subtag = attributes[:'subtag']
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
if attributes.key?(:'subtag_message')
|
|
133
|
+
self.subtag_message = attributes[:'subtag_message']
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
if attributes.key?(:'raw_tag')
|
|
137
|
+
self.raw_tag = attributes[:'raw_tag']
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
if attributes.key?(:'events')
|
|
141
|
+
self.events = attributes[:'events']
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Attribute type mapping.
|
|
146
|
+
def self.openapi_types
|
|
147
|
+
{
|
|
148
|
+
:'created_at' => :'String',
|
|
149
|
+
:'slug' => :'String',
|
|
150
|
+
:'checkpoint_time' => :'String',
|
|
151
|
+
:'location' => :'String',
|
|
152
|
+
:'city' => :'String',
|
|
153
|
+
:'state' => :'String',
|
|
154
|
+
:'zip' => :'String',
|
|
155
|
+
:'coordinate' => :'CoordinateCheckpoint',
|
|
156
|
+
:'country_iso3' => :'String',
|
|
157
|
+
:'country_name' => :'String',
|
|
158
|
+
:'message' => :'String',
|
|
159
|
+
:'tag' => :'TagV1',
|
|
160
|
+
:'subtag' => :'String',
|
|
161
|
+
:'subtag_message' => :'String',
|
|
162
|
+
:'raw_tag' => :'String',
|
|
163
|
+
:'events' => :'Array<EventsCheckpoint>',
|
|
164
|
+
}
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
168
|
+
def self.attribute_map
|
|
169
|
+
{
|
|
170
|
+
:'created_at' => :'created_at',
|
|
171
|
+
:'slug' => :'slug',
|
|
172
|
+
:'checkpoint_time' => :'checkpoint_time',
|
|
173
|
+
:'location' => :'location',
|
|
174
|
+
:'city' => :'city',
|
|
175
|
+
:'state' => :'state',
|
|
176
|
+
:'zip' => :'zip',
|
|
177
|
+
:'coordinate' => :'coordinate',
|
|
178
|
+
:'country_iso3' => :'country_iso3',
|
|
179
|
+
:'country_name' => :'country_name',
|
|
180
|
+
:'message' => :'message',
|
|
181
|
+
:'tag' => :'tag',
|
|
182
|
+
:'subtag' => :'subtag',
|
|
183
|
+
:'subtag_message' => :'subtag_message',
|
|
184
|
+
:'raw_tag' => :'raw_tag',
|
|
185
|
+
:'events' => :'events',
|
|
186
|
+
}
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Builds the object from hash
|
|
190
|
+
# @param attributes [Hash] Model attributes in the form of hash
|
|
191
|
+
# @return [Object] Returns the model itself
|
|
192
|
+
def self.build_from_hash(attributes)
|
|
193
|
+
return nil unless attributes.is_a?(Hash)
|
|
194
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
195
|
+
transformed_hash = {}
|
|
196
|
+
openapi_types.each_pair do |key, type|
|
|
197
|
+
if attributes.key?(key) && attributes[key].nil?
|
|
198
|
+
transformed_hash["#{key}"] = nil
|
|
199
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
200
|
+
# check to ensure the input is an array given that the attribute
|
|
201
|
+
# is documented as an array but the input is not
|
|
202
|
+
if attributes[key].is_a?(Array)
|
|
203
|
+
transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
|
|
204
|
+
end
|
|
205
|
+
elsif !attributes[key].nil?
|
|
206
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[key])
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
new(transformed_hash)
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Deserializes the data based on type
|
|
213
|
+
# @param type [String] Data type
|
|
214
|
+
# @param value [String] Value to be deserialized
|
|
215
|
+
# @return [Object] Deserialized data
|
|
216
|
+
def self._deserialize(type, value)
|
|
217
|
+
case type.to_sym
|
|
218
|
+
when :Time
|
|
219
|
+
Time.parse(value)
|
|
220
|
+
when :Date
|
|
221
|
+
Date.parse(value)
|
|
222
|
+
when :String
|
|
223
|
+
value.to_s
|
|
224
|
+
when :Integer
|
|
225
|
+
value.to_i
|
|
226
|
+
when :Float
|
|
227
|
+
value.to_f
|
|
228
|
+
when :Boolean
|
|
229
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
230
|
+
true
|
|
231
|
+
else
|
|
232
|
+
false
|
|
233
|
+
end
|
|
234
|
+
when :Object
|
|
235
|
+
# generic object (usually a Hash), return directly
|
|
236
|
+
value
|
|
237
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
238
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
239
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
240
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
241
|
+
k_type = Regexp.last_match[:k_type]
|
|
242
|
+
v_type = Regexp.last_match[:v_type]
|
|
243
|
+
{}.tap do |hash|
|
|
244
|
+
value.each do |k, v|
|
|
245
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
246
|
+
end
|
|
247
|
+
end
|
|
248
|
+
else # model
|
|
249
|
+
klass = AftershipAPI::Model.const_get(type)
|
|
250
|
+
klass.build_from_hash(value)
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
# Returns the string representation of the object
|
|
255
|
+
# @return [String] String presentation of the object
|
|
256
|
+
def to_s
|
|
257
|
+
to_hash.to_s
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
261
|
+
# @return [Hash] Returns the object in the form of hash
|
|
262
|
+
def to_body
|
|
263
|
+
to_hash
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# Returns the object in the form of hash
|
|
267
|
+
# @return [Hash] Returns the object in the form of hash
|
|
268
|
+
def to_hash
|
|
269
|
+
hash = {}
|
|
270
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
271
|
+
value = self.send(attr)
|
|
272
|
+
next if value.nil?
|
|
273
|
+
|
|
274
|
+
hash[param] = _to_hash(value)
|
|
275
|
+
end
|
|
276
|
+
hash
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
# Outputs non-array value in the form of hash
|
|
280
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
281
|
+
# @param value [Object] Any valid value
|
|
282
|
+
# @return [Hash] Returns the value in the form of hash
|
|
283
|
+
def _to_hash(value)
|
|
284
|
+
if value.is_a?(Array)
|
|
285
|
+
value.compact.map { |v| _to_hash(v) }
|
|
286
|
+
elsif value.is_a?(Hash)
|
|
287
|
+
{}.tap do |hash|
|
|
288
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
289
|
+
end
|
|
290
|
+
elsif value.respond_to? :to_hash
|
|
291
|
+
value.to_hash
|
|
292
|
+
else
|
|
293
|
+
value
|
|
294
|
+
end
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
def to_json(*a)
|
|
298
|
+
to_hash.to_json(*a)
|
|
299
|
+
end
|
|
300
|
+
end
|
|
301
|
+
end
|