aftership-tracking-sdk 7.0.0 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +68 -83
- data/lib/aftership-tracking-sdk/api/courier.rb +8 -8
- data/lib/aftership-tracking-sdk/api/estimated_delivery_date.rb +4 -4
- data/lib/aftership-tracking-sdk/api/tracking.rb +50 -416
- data/lib/aftership-tracking-sdk/api_client.rb +2 -2
- data/lib/aftership-tracking-sdk/configuration.rb +108 -108
- data/lib/aftership-tracking-sdk/models/additional_fields_v1.rb +1 -1
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_create_tracking_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_delete_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_get_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_mark_tracking_completed_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_retrack_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_tracking.rb +2 -0
- data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_update_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_create_tracking_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_delete_tracking_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_get_tracking_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_mark_tracking_completed_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_retrack_tracking_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_tracking.rb +2 -0
- data/lib/aftership-tracking-sdk/models/carbon_emissions_update_tracking_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/checkpoint.rb +2 -0
- data/lib/aftership-tracking-sdk/models/coordinate_checkpoint.rb +2 -0
- data/lib/aftership-tracking-sdk/models/courier.rb +2 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_create_tracking_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_delete_tracking_by_id_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_get_tracking_by_id_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_mark_tracking_completed_by_id_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_retrack_tracking_by_id_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_tracking.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_estimated_delivery_date_update_tracking_by_id_response.rb +173 -0
- data/lib/aftership-tracking-sdk/models/courier_response_v1.rb +2 -0
- data/lib/aftership-tracking-sdk/models/{tracking_create_tracking_request.rb → create_tracking_request.rb} +9 -7
- data/lib/aftership-tracking-sdk/models/create_tracking_response.rb +953 -0
- data/lib/aftership-tracking-sdk/models/{mark_tracking_completed_by_slug_tracking_number_request.rb → custom_estimated_delivery_date_create_tracking_response.rb} +41 -9
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_delete_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_get_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_mark_tracking_completed_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_retrack_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_tracking.rb +2 -0
- data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_update_tracking_by_id_response.rb +183 -0
- data/lib/aftership-tracking-sdk/models/data_courier_response_v1.rb +2 -0
- data/lib/aftership-tracking-sdk/models/data_tracking_response_get_multiple_v1.rb +8 -126
- data/lib/aftership-tracking-sdk/models/delete_tracking_by_id_response.rb +953 -0
- data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/{tracking_detect_courier_request.rb → detect_courier_request.rb} +5 -3
- data/lib/aftership-tracking-sdk/models/detect_courier_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/estimated_delivery_date_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/estimated_delivery_date_response.rb +12 -0
- data/lib/aftership-tracking-sdk/models/estimated_pickup_estimated_delivery_date_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/estimated_pickup_estimated_delivery_date_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/events_checkpoint.rb +2 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_create_tracking_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_delete_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_get_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_mark_tracking_completed_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_retrack_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_tracking.rb +2 -0
- data/lib/aftership-tracking-sdk/models/first_estimated_delivery_update_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/get_all_couriers_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/get_tracking_by_id_response.rb +953 -0
- data/lib/aftership-tracking-sdk/models/get_trackings_response.rb +5 -3
- data/lib/aftership-tracking-sdk/models/get_user_couriers_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_create_tracking_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_delete_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_get_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_mark_tracking_completed_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_retrack_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_tracking.rb +2 -0
- data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_update_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_response.rb +953 -0
- data/lib/aftership-tracking-sdk/models/meta_v1.rb +2 -0
- data/lib/aftership-tracking-sdk/models/{next_couriers_tracking_create_tracking_request.rb → next_couriers_create_tracking_request.rb} +4 -2
- data/lib/aftership-tracking-sdk/models/{get_checkpoint_by_tracking_id_response.rb → next_couriers_create_tracking_response.rb} +33 -51
- data/lib/aftership-tracking-sdk/models/next_couriers_delete_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/{get_checkpoint_by_slug_tracking_number_response.rb → next_couriers_get_tracking_by_id_response.rb} +33 -51
- data/lib/aftership-tracking-sdk/models/next_couriers_mark_tracking_completed_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/next_couriers_retrack_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/next_couriers_tracking.rb +22 -0
- data/lib/aftership-tracking-sdk/models/next_couriers_update_tracking_by_id_response.rb +193 -0
- data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_estimated_delivery_date_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_estimated_delivery_date_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/pagination.rb +14 -6
- data/lib/aftership-tracking-sdk/models/pagination_data_tracking_response_get_multiple_v1.rb +173 -0
- data/lib/aftership-tracking-sdk/models/{notification_request_v1.rb → pagination_get_trackings_response.rb} +28 -16
- data/lib/aftership-tracking-sdk/models/predict_batch_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/predict_batch_response.rb +2 -0
- data/lib/aftership-tracking-sdk/models/reason_events_checkpoint.rb +2 -0
- data/lib/aftership-tracking-sdk/models/retrack_tracking_by_id_response.rb +953 -0
- data/lib/aftership-tracking-sdk/models/{tracking_delete_response_v1.rb → shipment_weight_create_tracking_response.rb} +18 -16
- data/lib/aftership-tracking-sdk/models/{data_notification_response_v1.rb → shipment_weight_delete_tracking_by_id_response.rb} +21 -9
- data/lib/aftership-tracking-sdk/models/{notification.rb → shipment_weight_get_tracking_by_id_response.rb} +18 -16
- data/lib/aftership-tracking-sdk/models/shipment_weight_mark_tracking_completed_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/shipment_weight_retrack_tracking_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/{notification_response_v1.rb → shipment_weight_tracking.rb} +18 -16
- data/lib/aftership-tracking-sdk/models/shipment_weight_update_tracking_by_id_response.rb +163 -0
- data/lib/aftership-tracking-sdk/models/slug_group_v1.rb +1 -1
- data/lib/aftership-tracking-sdk/models/tag_v1.rb +1 -1
- data/lib/aftership-tracking-sdk/models/tracking.rb +56 -24
- data/lib/aftership-tracking-sdk/models/tracking_response_get_multiple_v1.rb +2 -0
- data/lib/aftership-tracking-sdk/models/tracking_response_v1.rb +5 -3
- data/lib/aftership-tracking-sdk/models/{tracking_update_tracking_by_id_request.rb → update_tracking_by_id_request.rb} +5 -3
- data/lib/aftership-tracking-sdk/models/update_tracking_by_id_response.rb +953 -0
- data/lib/aftership-tracking-sdk/models/weight_estimated_delivery_date_request.rb +2 -0
- data/lib/aftership-tracking-sdk/models/weight_estimated_delivery_date_response.rb +2 -0
- data/lib/aftership-tracking-sdk/version.rb +1 -1
- metadata +64 -22
- data/lib/aftership-tracking-sdk/api/last_checkpoint.rb +0 -143
- data/lib/aftership-tracking-sdk/api/notification.rb +0 -403
- data/lib/aftership-tracking-sdk/models/custom_fields_tracking_update_tracking_by_slug_tracking_number_request.rb +0 -139
- data/lib/aftership-tracking-sdk/models/data_tracking_delete_response_v1.rb +0 -151
- data/lib/aftership-tracking-sdk/models/data_tracking_response_v1.rb +0 -151
- data/lib/aftership-tracking-sdk/models/partial_delete_tracking.rb +0 -241
- data/lib/aftership-tracking-sdk/models/partial_update_tracking.rb +0 -251
- data/lib/aftership-tracking-sdk/models/tracking_update_tracking_by_slug_tracking_number_request.rb +0 -391
@@ -1,151 +0,0 @@
|
|
1
|
-
# This code was auto generated by AfterShip SDK Generator.
|
2
|
-
# Do not edit the class manually.
|
3
|
-
module AftershipAPI::Model
|
4
|
-
class DataTrackingResponseV1
|
5
|
-
# Object describes the tracking information.<div style="display:none; height: 0"></div>
|
6
|
-
# tracking?: Tracking;
|
7
|
-
attr_accessor :tracking
|
8
|
-
|
9
|
-
# Initializes the object
|
10
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
11
|
-
def initialize(attributes = {})
|
12
|
-
if (!attributes.is_a?(Hash))
|
13
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::DataTrackingResponseV1` initialize method"
|
14
|
-
end
|
15
|
-
|
16
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
17
|
-
h[k.to_sym] = v
|
18
|
-
}
|
19
|
-
|
20
|
-
if attributes.key?(:'tracking')
|
21
|
-
self.tracking = attributes[:'tracking']
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
# Attribute type mapping.
|
26
|
-
def self.openapi_types
|
27
|
-
{
|
28
|
-
:'tracking' => :'Tracking',
|
29
|
-
}
|
30
|
-
end
|
31
|
-
|
32
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
33
|
-
def self.attribute_map
|
34
|
-
{
|
35
|
-
:'tracking' => :'tracking',
|
36
|
-
}
|
37
|
-
end
|
38
|
-
|
39
|
-
# Builds the object from hash
|
40
|
-
# @param attributes [Hash] Model attributes in the form of hash
|
41
|
-
# @return [Object] Returns the model itself
|
42
|
-
def self.build_from_hash(attributes)
|
43
|
-
return nil unless attributes.is_a?(Hash)
|
44
|
-
attributes = attributes.transform_keys(&:to_sym)
|
45
|
-
transformed_hash = {}
|
46
|
-
openapi_types.each_pair do |key, type|
|
47
|
-
if attributes.key?(key) && attributes[key].nil?
|
48
|
-
transformed_hash["#{key}"] = nil
|
49
|
-
elsif type =~ /\AArray<(.*)>/i
|
50
|
-
# check to ensure the input is an array given that the attribute
|
51
|
-
# is documented as an array but the input is not
|
52
|
-
if attributes[key].is_a?(Array)
|
53
|
-
transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
|
54
|
-
end
|
55
|
-
elsif !attributes[key].nil?
|
56
|
-
transformed_hash["#{key}"] = _deserialize(type, attributes[key])
|
57
|
-
end
|
58
|
-
end
|
59
|
-
new(transformed_hash)
|
60
|
-
end
|
61
|
-
|
62
|
-
# Deserializes the data based on type
|
63
|
-
# @param type [String] Data type
|
64
|
-
# @param value [String] Value to be deserialized
|
65
|
-
# @return [Object] Deserialized data
|
66
|
-
def self._deserialize(type, value)
|
67
|
-
case type.to_sym
|
68
|
-
when :Time
|
69
|
-
Time.parse(value)
|
70
|
-
when :Date
|
71
|
-
Date.parse(value)
|
72
|
-
when :String
|
73
|
-
value.to_s
|
74
|
-
when :Integer
|
75
|
-
value.to_i
|
76
|
-
when :Float
|
77
|
-
value.to_f
|
78
|
-
when :Boolean
|
79
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
80
|
-
true
|
81
|
-
else
|
82
|
-
false
|
83
|
-
end
|
84
|
-
when :Object
|
85
|
-
# generic object (usually a Hash), return directly
|
86
|
-
value
|
87
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
88
|
-
inner_type = Regexp.last_match[:inner_type]
|
89
|
-
value.map { |v| _deserialize(inner_type, v) }
|
90
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
91
|
-
k_type = Regexp.last_match[:k_type]
|
92
|
-
v_type = Regexp.last_match[:v_type]
|
93
|
-
{}.tap do |hash|
|
94
|
-
value.each do |k, v|
|
95
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
else # model
|
99
|
-
klass = AftershipAPI::Model.const_get(type)
|
100
|
-
klass.build_from_hash(value)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
# Returns the string representation of the object
|
105
|
-
# @return [String] String presentation of the object
|
106
|
-
def to_s
|
107
|
-
to_hash.to_s
|
108
|
-
end
|
109
|
-
|
110
|
-
# to_body is an alias to to_hash (backward compatibility)
|
111
|
-
# @return [Hash] Returns the object in the form of hash
|
112
|
-
def to_body
|
113
|
-
to_hash
|
114
|
-
end
|
115
|
-
|
116
|
-
# Returns the object in the form of hash
|
117
|
-
# @return [Hash] Returns the object in the form of hash
|
118
|
-
def to_hash
|
119
|
-
hash = {}
|
120
|
-
self.class.attribute_map.each_pair do |attr, param|
|
121
|
-
value = self.send(attr)
|
122
|
-
next if value.nil?
|
123
|
-
|
124
|
-
hash[param] = _to_hash(value)
|
125
|
-
end
|
126
|
-
hash
|
127
|
-
end
|
128
|
-
|
129
|
-
# Outputs non-array value in the form of hash
|
130
|
-
# For object, use to_hash. Otherwise, just return the value
|
131
|
-
# @param value [Object] Any valid value
|
132
|
-
# @return [Hash] Returns the value in the form of hash
|
133
|
-
def _to_hash(value)
|
134
|
-
if value.is_a?(Array)
|
135
|
-
value.compact.map { |v| _to_hash(v) }
|
136
|
-
elsif value.is_a?(Hash)
|
137
|
-
{}.tap do |hash|
|
138
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
139
|
-
end
|
140
|
-
elsif value.respond_to? :to_hash
|
141
|
-
value.to_hash
|
142
|
-
else
|
143
|
-
value
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
def to_json(*a)
|
148
|
-
to_hash.to_json(*a)
|
149
|
-
end
|
150
|
-
end
|
151
|
-
end
|
@@ -1,241 +0,0 @@
|
|
1
|
-
# This code was auto generated by AfterShip SDK Generator.
|
2
|
-
# Do not edit the class manually.
|
3
|
-
module AftershipAPI::Model
|
4
|
-
class PartialDeleteTracking
|
5
|
-
# Tracking id
|
6
|
-
# id?: String;
|
7
|
-
attr_accessor :id
|
8
|
-
|
9
|
-
# Tracking number
|
10
|
-
# tracking_number?: String;
|
11
|
-
attr_accessor :tracking_number
|
12
|
-
|
13
|
-
# Unique code of courier. Get the slugs from .
|
14
|
-
# slug?: String;
|
15
|
-
attr_accessor :slug
|
16
|
-
|
17
|
-
# Additional field required by some carriers to retrieve the tracking info. The shipper’s carrier account number. Refer to our article on for more details.
|
18
|
-
# tracking_account_number?: String;
|
19
|
-
attr_accessor :tracking_account_number
|
20
|
-
|
21
|
-
# Additional field required by some carriers to retrieve the tracking info. A type of tracking credential required by some carriers. Refer to our article on for more details.
|
22
|
-
# tracking_key?: String;
|
23
|
-
attr_accessor :tracking_key
|
24
|
-
|
25
|
-
# Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on for more details.
|
26
|
-
# tracking_ship_date?: String;
|
27
|
-
attr_accessor :tracking_ship_date
|
28
|
-
|
29
|
-
# (Legacy) Additional field required by some carriers to retrieve the tracking info. The origin country/region of the shipment. Refer to our article on for more details.
|
30
|
-
# tracking_origin_country?: String;
|
31
|
-
attr_accessor :tracking_origin_country
|
32
|
-
|
33
|
-
# (Legacy) Additional field required by some carriers to retrieve the tracking info. The destination country/region of the shipment. Refer to our article on for more details.
|
34
|
-
# tracking_destination_country?: String;
|
35
|
-
attr_accessor :tracking_destination_country
|
36
|
-
|
37
|
-
# (Legacy) Additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on for more details.
|
38
|
-
# tracking_postal_code?: String;
|
39
|
-
attr_accessor :tracking_postal_code
|
40
|
-
|
41
|
-
# (Legacy) Additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on for more details.
|
42
|
-
# tracking_state?: String;
|
43
|
-
attr_accessor :tracking_state
|
44
|
-
|
45
|
-
# Initializes the object
|
46
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
-
def initialize(attributes = {})
|
48
|
-
if (!attributes.is_a?(Hash))
|
49
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::PartialDeleteTracking` initialize method"
|
50
|
-
end
|
51
|
-
|
52
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
53
|
-
h[k.to_sym] = v
|
54
|
-
}
|
55
|
-
|
56
|
-
if attributes.key?(:'id')
|
57
|
-
self.id = attributes[:'id']
|
58
|
-
end
|
59
|
-
|
60
|
-
if attributes.key?(:'tracking_number')
|
61
|
-
self.tracking_number = attributes[:'tracking_number']
|
62
|
-
end
|
63
|
-
|
64
|
-
if attributes.key?(:'slug')
|
65
|
-
self.slug = attributes[:'slug']
|
66
|
-
end
|
67
|
-
|
68
|
-
if attributes.key?(:'tracking_account_number')
|
69
|
-
self.tracking_account_number = attributes[:'tracking_account_number']
|
70
|
-
end
|
71
|
-
|
72
|
-
if attributes.key?(:'tracking_key')
|
73
|
-
self.tracking_key = attributes[:'tracking_key']
|
74
|
-
end
|
75
|
-
|
76
|
-
if attributes.key?(:'tracking_ship_date')
|
77
|
-
self.tracking_ship_date = attributes[:'tracking_ship_date']
|
78
|
-
end
|
79
|
-
|
80
|
-
if attributes.key?(:'tracking_origin_country')
|
81
|
-
self.tracking_origin_country = attributes[:'tracking_origin_country']
|
82
|
-
end
|
83
|
-
|
84
|
-
if attributes.key?(:'tracking_destination_country')
|
85
|
-
self.tracking_destination_country = attributes[:'tracking_destination_country']
|
86
|
-
end
|
87
|
-
|
88
|
-
if attributes.key?(:'tracking_postal_code')
|
89
|
-
self.tracking_postal_code = attributes[:'tracking_postal_code']
|
90
|
-
end
|
91
|
-
|
92
|
-
if attributes.key?(:'tracking_state')
|
93
|
-
self.tracking_state = attributes[:'tracking_state']
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
# Attribute type mapping.
|
98
|
-
def self.openapi_types
|
99
|
-
{
|
100
|
-
:'id' => :'String',
|
101
|
-
:'tracking_number' => :'String',
|
102
|
-
:'slug' => :'String',
|
103
|
-
:'tracking_account_number' => :'String',
|
104
|
-
:'tracking_key' => :'String',
|
105
|
-
:'tracking_ship_date' => :'String',
|
106
|
-
:'tracking_origin_country' => :'String',
|
107
|
-
:'tracking_destination_country' => :'String',
|
108
|
-
:'tracking_postal_code' => :'String',
|
109
|
-
:'tracking_state' => :'String',
|
110
|
-
}
|
111
|
-
end
|
112
|
-
|
113
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
114
|
-
def self.attribute_map
|
115
|
-
{
|
116
|
-
:'id' => :'id',
|
117
|
-
:'tracking_number' => :'tracking_number',
|
118
|
-
:'slug' => :'slug',
|
119
|
-
:'tracking_account_number' => :'tracking_account_number',
|
120
|
-
:'tracking_key' => :'tracking_key',
|
121
|
-
:'tracking_ship_date' => :'tracking_ship_date',
|
122
|
-
:'tracking_origin_country' => :'tracking_origin_country',
|
123
|
-
:'tracking_destination_country' => :'tracking_destination_country',
|
124
|
-
:'tracking_postal_code' => :'tracking_postal_code',
|
125
|
-
:'tracking_state' => :'tracking_state',
|
126
|
-
}
|
127
|
-
end
|
128
|
-
|
129
|
-
# Builds the object from hash
|
130
|
-
# @param attributes [Hash] Model attributes in the form of hash
|
131
|
-
# @return [Object] Returns the model itself
|
132
|
-
def self.build_from_hash(attributes)
|
133
|
-
return nil unless attributes.is_a?(Hash)
|
134
|
-
attributes = attributes.transform_keys(&:to_sym)
|
135
|
-
transformed_hash = {}
|
136
|
-
openapi_types.each_pair do |key, type|
|
137
|
-
if attributes.key?(key) && attributes[key].nil?
|
138
|
-
transformed_hash["#{key}"] = nil
|
139
|
-
elsif type =~ /\AArray<(.*)>/i
|
140
|
-
# check to ensure the input is an array given that the attribute
|
141
|
-
# is documented as an array but the input is not
|
142
|
-
if attributes[key].is_a?(Array)
|
143
|
-
transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
|
144
|
-
end
|
145
|
-
elsif !attributes[key].nil?
|
146
|
-
transformed_hash["#{key}"] = _deserialize(type, attributes[key])
|
147
|
-
end
|
148
|
-
end
|
149
|
-
new(transformed_hash)
|
150
|
-
end
|
151
|
-
|
152
|
-
# Deserializes the data based on type
|
153
|
-
# @param type [String] Data type
|
154
|
-
# @param value [String] Value to be deserialized
|
155
|
-
# @return [Object] Deserialized data
|
156
|
-
def self._deserialize(type, value)
|
157
|
-
case type.to_sym
|
158
|
-
when :Time
|
159
|
-
Time.parse(value)
|
160
|
-
when :Date
|
161
|
-
Date.parse(value)
|
162
|
-
when :String
|
163
|
-
value.to_s
|
164
|
-
when :Integer
|
165
|
-
value.to_i
|
166
|
-
when :Float
|
167
|
-
value.to_f
|
168
|
-
when :Boolean
|
169
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
170
|
-
true
|
171
|
-
else
|
172
|
-
false
|
173
|
-
end
|
174
|
-
when :Object
|
175
|
-
# generic object (usually a Hash), return directly
|
176
|
-
value
|
177
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
178
|
-
inner_type = Regexp.last_match[:inner_type]
|
179
|
-
value.map { |v| _deserialize(inner_type, v) }
|
180
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
181
|
-
k_type = Regexp.last_match[:k_type]
|
182
|
-
v_type = Regexp.last_match[:v_type]
|
183
|
-
{}.tap do |hash|
|
184
|
-
value.each do |k, v|
|
185
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
186
|
-
end
|
187
|
-
end
|
188
|
-
else # model
|
189
|
-
klass = AftershipAPI::Model.const_get(type)
|
190
|
-
klass.build_from_hash(value)
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
# Returns the string representation of the object
|
195
|
-
# @return [String] String presentation of the object
|
196
|
-
def to_s
|
197
|
-
to_hash.to_s
|
198
|
-
end
|
199
|
-
|
200
|
-
# to_body is an alias to to_hash (backward compatibility)
|
201
|
-
# @return [Hash] Returns the object in the form of hash
|
202
|
-
def to_body
|
203
|
-
to_hash
|
204
|
-
end
|
205
|
-
|
206
|
-
# Returns the object in the form of hash
|
207
|
-
# @return [Hash] Returns the object in the form of hash
|
208
|
-
def to_hash
|
209
|
-
hash = {}
|
210
|
-
self.class.attribute_map.each_pair do |attr, param|
|
211
|
-
value = self.send(attr)
|
212
|
-
next if value.nil?
|
213
|
-
|
214
|
-
hash[param] = _to_hash(value)
|
215
|
-
end
|
216
|
-
hash
|
217
|
-
end
|
218
|
-
|
219
|
-
# Outputs non-array value in the form of hash
|
220
|
-
# For object, use to_hash. Otherwise, just return the value
|
221
|
-
# @param value [Object] Any valid value
|
222
|
-
# @return [Hash] Returns the value in the form of hash
|
223
|
-
def _to_hash(value)
|
224
|
-
if value.is_a?(Array)
|
225
|
-
value.compact.map { |v| _to_hash(v) }
|
226
|
-
elsif value.is_a?(Hash)
|
227
|
-
{}.tap do |hash|
|
228
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
229
|
-
end
|
230
|
-
elsif value.respond_to? :to_hash
|
231
|
-
value.to_hash
|
232
|
-
else
|
233
|
-
value
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
|
-
def to_json(*a)
|
238
|
-
to_hash.to_json(*a)
|
239
|
-
end
|
240
|
-
end
|
241
|
-
end
|
@@ -1,251 +0,0 @@
|
|
1
|
-
# This code was auto generated by AfterShip SDK Generator.
|
2
|
-
# Do not edit the class manually.
|
3
|
-
module AftershipAPI::Model
|
4
|
-
class PartialUpdateTracking
|
5
|
-
# A unique identifier generated by AfterShip for the tracking.
|
6
|
-
# id?: String;
|
7
|
-
attr_accessor :id
|
8
|
-
|
9
|
-
# Tracking number.
|
10
|
-
# tracking_number?: String;
|
11
|
-
attr_accessor :tracking_number
|
12
|
-
|
13
|
-
# Unique code of courier. Get the slugs from .
|
14
|
-
# slug?: String;
|
15
|
-
attr_accessor :slug
|
16
|
-
|
17
|
-
# Additional field required by some carriers to retrieve the tracking info. The shipper’s carrier account number. Refer to our article on for more details.
|
18
|
-
# tracking_account_number?: String;
|
19
|
-
attr_accessor :tracking_account_number
|
20
|
-
|
21
|
-
# Additional field required by some carriers to retrieve the tracking info. The origin country/region of the shipment. Refer to our article on for more details.
|
22
|
-
# tracking_origin_country?: String;
|
23
|
-
attr_accessor :tracking_origin_country
|
24
|
-
|
25
|
-
# Additional field required by some carriers to retrieve the tracking info. The destination country/region of the shipment. Refer to our article on for more details.
|
26
|
-
# tracking_destination_country?: String;
|
27
|
-
attr_accessor :tracking_destination_country
|
28
|
-
|
29
|
-
# Additional field required by some carriers to retrieve the tracking info. A type of tracking credential required by some carriers. Refer to our article on for more details.
|
30
|
-
# tracking_key?: String;
|
31
|
-
attr_accessor :tracking_key
|
32
|
-
|
33
|
-
# Additional field required by some carriers to retrieve the tracking info. The date the shipment was sent, using the format YYYYMMDD. Refer to our article on for more details.
|
34
|
-
# tracking_ship_date?: String;
|
35
|
-
attr_accessor :tracking_ship_date
|
36
|
-
|
37
|
-
# Additional field required by some carriers to retrieve the tracking info. The postal code of the recipient’s address. Refer to our article on for more details.
|
38
|
-
# tracking_postal_code?: String;
|
39
|
-
attr_accessor :tracking_postal_code
|
40
|
-
|
41
|
-
# Additional field required by some carriers to retrieve the tracking info. The state/province of the recipient’s address. Refer to our article on for more details.
|
42
|
-
# tracking_state?: String;
|
43
|
-
attr_accessor :tracking_state
|
44
|
-
|
45
|
-
# Whether or not AfterShip will continue tracking the shipments. Value is `false` when tag (status) is `Delivered`, `Expired`, or further updates for 30 days since last update.
|
46
|
-
# active?: Boolean;
|
47
|
-
attr_accessor :active
|
48
|
-
|
49
|
-
# Initializes the object
|
50
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
51
|
-
def initialize(attributes = {})
|
52
|
-
if (!attributes.is_a?(Hash))
|
53
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::PartialUpdateTracking` initialize method"
|
54
|
-
end
|
55
|
-
|
56
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
57
|
-
h[k.to_sym] = v
|
58
|
-
}
|
59
|
-
|
60
|
-
if attributes.key?(:'id')
|
61
|
-
self.id = attributes[:'id']
|
62
|
-
end
|
63
|
-
|
64
|
-
if attributes.key?(:'tracking_number')
|
65
|
-
self.tracking_number = attributes[:'tracking_number']
|
66
|
-
end
|
67
|
-
|
68
|
-
if attributes.key?(:'slug')
|
69
|
-
self.slug = attributes[:'slug']
|
70
|
-
end
|
71
|
-
|
72
|
-
if attributes.key?(:'tracking_account_number')
|
73
|
-
self.tracking_account_number = attributes[:'tracking_account_number']
|
74
|
-
end
|
75
|
-
|
76
|
-
if attributes.key?(:'tracking_origin_country')
|
77
|
-
self.tracking_origin_country = attributes[:'tracking_origin_country']
|
78
|
-
end
|
79
|
-
|
80
|
-
if attributes.key?(:'tracking_destination_country')
|
81
|
-
self.tracking_destination_country = attributes[:'tracking_destination_country']
|
82
|
-
end
|
83
|
-
|
84
|
-
if attributes.key?(:'tracking_key')
|
85
|
-
self.tracking_key = attributes[:'tracking_key']
|
86
|
-
end
|
87
|
-
|
88
|
-
if attributes.key?(:'tracking_ship_date')
|
89
|
-
self.tracking_ship_date = attributes[:'tracking_ship_date']
|
90
|
-
end
|
91
|
-
|
92
|
-
if attributes.key?(:'tracking_postal_code')
|
93
|
-
self.tracking_postal_code = attributes[:'tracking_postal_code']
|
94
|
-
end
|
95
|
-
|
96
|
-
if attributes.key?(:'tracking_state')
|
97
|
-
self.tracking_state = attributes[:'tracking_state']
|
98
|
-
end
|
99
|
-
|
100
|
-
if attributes.key?(:'active')
|
101
|
-
self.active = attributes[:'active']
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
# Attribute type mapping.
|
106
|
-
def self.openapi_types
|
107
|
-
{
|
108
|
-
:'id' => :'String',
|
109
|
-
:'tracking_number' => :'String',
|
110
|
-
:'slug' => :'String',
|
111
|
-
:'tracking_account_number' => :'String',
|
112
|
-
:'tracking_origin_country' => :'String',
|
113
|
-
:'tracking_destination_country' => :'String',
|
114
|
-
:'tracking_key' => :'String',
|
115
|
-
:'tracking_ship_date' => :'String',
|
116
|
-
:'tracking_postal_code' => :'String',
|
117
|
-
:'tracking_state' => :'String',
|
118
|
-
:'active' => :'Boolean',
|
119
|
-
}
|
120
|
-
end
|
121
|
-
|
122
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
123
|
-
def self.attribute_map
|
124
|
-
{
|
125
|
-
:'id' => :'id',
|
126
|
-
:'tracking_number' => :'tracking_number',
|
127
|
-
:'slug' => :'slug',
|
128
|
-
:'tracking_account_number' => :'tracking_account_number',
|
129
|
-
:'tracking_origin_country' => :'tracking_origin_country',
|
130
|
-
:'tracking_destination_country' => :'tracking_destination_country',
|
131
|
-
:'tracking_key' => :'tracking_key',
|
132
|
-
:'tracking_ship_date' => :'tracking_ship_date',
|
133
|
-
:'tracking_postal_code' => :'tracking_postal_code',
|
134
|
-
:'tracking_state' => :'tracking_state',
|
135
|
-
:'active' => :'active',
|
136
|
-
}
|
137
|
-
end
|
138
|
-
|
139
|
-
# Builds the object from hash
|
140
|
-
# @param attributes [Hash] Model attributes in the form of hash
|
141
|
-
# @return [Object] Returns the model itself
|
142
|
-
def self.build_from_hash(attributes)
|
143
|
-
return nil unless attributes.is_a?(Hash)
|
144
|
-
attributes = attributes.transform_keys(&:to_sym)
|
145
|
-
transformed_hash = {}
|
146
|
-
openapi_types.each_pair do |key, type|
|
147
|
-
if attributes.key?(key) && attributes[key].nil?
|
148
|
-
transformed_hash["#{key}"] = nil
|
149
|
-
elsif type =~ /\AArray<(.*)>/i
|
150
|
-
# check to ensure the input is an array given that the attribute
|
151
|
-
# is documented as an array but the input is not
|
152
|
-
if attributes[key].is_a?(Array)
|
153
|
-
transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
|
154
|
-
end
|
155
|
-
elsif !attributes[key].nil?
|
156
|
-
transformed_hash["#{key}"] = _deserialize(type, attributes[key])
|
157
|
-
end
|
158
|
-
end
|
159
|
-
new(transformed_hash)
|
160
|
-
end
|
161
|
-
|
162
|
-
# Deserializes the data based on type
|
163
|
-
# @param type [String] Data type
|
164
|
-
# @param value [String] Value to be deserialized
|
165
|
-
# @return [Object] Deserialized data
|
166
|
-
def self._deserialize(type, value)
|
167
|
-
case type.to_sym
|
168
|
-
when :Time
|
169
|
-
Time.parse(value)
|
170
|
-
when :Date
|
171
|
-
Date.parse(value)
|
172
|
-
when :String
|
173
|
-
value.to_s
|
174
|
-
when :Integer
|
175
|
-
value.to_i
|
176
|
-
when :Float
|
177
|
-
value.to_f
|
178
|
-
when :Boolean
|
179
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
180
|
-
true
|
181
|
-
else
|
182
|
-
false
|
183
|
-
end
|
184
|
-
when :Object
|
185
|
-
# generic object (usually a Hash), return directly
|
186
|
-
value
|
187
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
188
|
-
inner_type = Regexp.last_match[:inner_type]
|
189
|
-
value.map { |v| _deserialize(inner_type, v) }
|
190
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
191
|
-
k_type = Regexp.last_match[:k_type]
|
192
|
-
v_type = Regexp.last_match[:v_type]
|
193
|
-
{}.tap do |hash|
|
194
|
-
value.each do |k, v|
|
195
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
196
|
-
end
|
197
|
-
end
|
198
|
-
else # model
|
199
|
-
klass = AftershipAPI::Model.const_get(type)
|
200
|
-
klass.build_from_hash(value)
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
# Returns the string representation of the object
|
205
|
-
# @return [String] String presentation of the object
|
206
|
-
def to_s
|
207
|
-
to_hash.to_s
|
208
|
-
end
|
209
|
-
|
210
|
-
# to_body is an alias to to_hash (backward compatibility)
|
211
|
-
# @return [Hash] Returns the object in the form of hash
|
212
|
-
def to_body
|
213
|
-
to_hash
|
214
|
-
end
|
215
|
-
|
216
|
-
# Returns the object in the form of hash
|
217
|
-
# @return [Hash] Returns the object in the form of hash
|
218
|
-
def to_hash
|
219
|
-
hash = {}
|
220
|
-
self.class.attribute_map.each_pair do |attr, param|
|
221
|
-
value = self.send(attr)
|
222
|
-
next if value.nil?
|
223
|
-
|
224
|
-
hash[param] = _to_hash(value)
|
225
|
-
end
|
226
|
-
hash
|
227
|
-
end
|
228
|
-
|
229
|
-
# Outputs non-array value in the form of hash
|
230
|
-
# For object, use to_hash. Otherwise, just return the value
|
231
|
-
# @param value [Object] Any valid value
|
232
|
-
# @return [Hash] Returns the value in the form of hash
|
233
|
-
def _to_hash(value)
|
234
|
-
if value.is_a?(Array)
|
235
|
-
value.compact.map { |v| _to_hash(v) }
|
236
|
-
elsif value.is_a?(Hash)
|
237
|
-
{}.tap do |hash|
|
238
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
239
|
-
end
|
240
|
-
elsif value.respond_to? :to_hash
|
241
|
-
value.to_hash
|
242
|
-
else
|
243
|
-
value
|
244
|
-
end
|
245
|
-
end
|
246
|
-
|
247
|
-
def to_json(*a)
|
248
|
-
to_hash.to_json(*a)
|
249
|
-
end
|
250
|
-
end
|
251
|
-
end
|