aftership-tracking-sdk 14.0.0 → 15.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/README.md +24 -3
- data/lib/aftership-tracking-sdk/api/courier.rb +2 -2
- data/lib/aftership-tracking-sdk/api/courier_connection.rb +5 -5
- data/lib/aftership-tracking-sdk/api/estimated_delivery_date.rb +2 -2
- data/lib/aftership-tracking-sdk/api/tracking.rb +7 -7
- data/lib/aftership-tracking-sdk/models/checkpoint.rb +10 -0
- data/lib/aftership-tracking-sdk/models/create_tracking_request.rb +10 -0
- data/lib/aftership-tracking-sdk/models/create_tracking_request_customers.rb +10 -0
- data/lib/aftership-tracking-sdk/models/create_tracking_request_shipment_direction.rb +26 -0
- data/lib/aftership-tracking-sdk/models/estimated_delivery_date_request_destination_address.rb +2 -2
- data/lib/aftership-tracking-sdk/models/estimated_delivery_date_request_origin_address.rb +2 -2
- data/lib/aftership-tracking-sdk/models/tracking.rb +60 -0
- data/lib/aftership-tracking-sdk/models/tracking_customers.rb +10 -0
- data/lib/aftership-tracking-sdk/models/tracking_forward_shipment.rb +151 -0
- data/lib/aftership-tracking-sdk/models/tracking_multi_piece_info.rb +161 -0
- data/lib/aftership-tracking-sdk/models/tracking_multi_piece_info_pieces.rb +181 -0
- data/lib/aftership-tracking-sdk/models/tracking_multi_piece_info_pieces_type.rb +26 -0
- data/lib/aftership-tracking-sdk/models/tracking_multi_piece_info_type.rb +26 -0
- data/lib/aftership-tracking-sdk/models/tracking_proof_of_delivery.rb +161 -0
- data/lib/aftership-tracking-sdk/models/tracking_response.rb +1 -1
- data/lib/aftership-tracking-sdk/models/tracking_return_shipment.rb +171 -0
- data/lib/aftership-tracking-sdk/models/tracking_shipment_dimensions.rb +181 -0
- data/lib/aftership-tracking-sdk/models/tracking_shipment_direction.rb +27 -0
- data/lib/aftership-tracking-sdk/models/update_tracking_by_id_request.rb +10 -0
- data/lib/aftership-tracking-sdk/models/update_tracking_by_id_request_customers.rb +10 -0
- data/lib/aftership-tracking-sdk/models/update_tracking_by_id_request_shipment_direction.rb +26 -0
- data/lib/aftership-tracking-sdk/version.rb +1 -1
- metadata +13 -2
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# This code was auto generated by AfterShip SDK Generator.
|
|
2
|
+
# Do not edit the class manually.
|
|
3
|
+
module AftershipAPI::Model
|
|
4
|
+
class TrackingForwardShipment
|
|
5
|
+
# AfterShip system-assigned unique identifier of the linked outbound shipment.
|
|
6
|
+
# id?: String;
|
|
7
|
+
attr_accessor :id
|
|
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::TrackingForwardShipment` 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?(:'id')
|
|
21
|
+
self.id = attributes[:'id']
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Attribute type mapping.
|
|
26
|
+
def self.openapi_types
|
|
27
|
+
{
|
|
28
|
+
:'id' => :'String',
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
33
|
+
def self.attribute_map
|
|
34
|
+
{
|
|
35
|
+
:'id' => :'id',
|
|
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
|
|
@@ -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 TrackingMultiPieceInfo
|
|
5
|
+
# Indicates the role of the current tracking object within the multi-piece shipment.Possible values:- `master`: The main tracking number representing the entire shipment. It may not always exist.- `child`: A sub-tracking number belonging to one of the pieces in the shipment.
|
|
6
|
+
# type?: TrackingMultiPieceInfoType;
|
|
7
|
+
attr_accessor :type
|
|
8
|
+
|
|
9
|
+
# List of all pieces in the MPS, including the master and all child pieces.
|
|
10
|
+
# pieces?: TrackingMultiPieceInfoPieces[];
|
|
11
|
+
attr_accessor :pieces
|
|
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::TrackingMultiPieceInfo` 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?(:'type')
|
|
25
|
+
self.type = attributes[:'type']
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
if attributes.key?(:'pieces')
|
|
29
|
+
self.pieces = attributes[:'pieces']
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Attribute type mapping.
|
|
34
|
+
def self.openapi_types
|
|
35
|
+
{
|
|
36
|
+
:'type' => :'TrackingMultiPieceInfoType',
|
|
37
|
+
:'pieces' => :'Array<TrackingMultiPieceInfoPieces>',
|
|
38
|
+
}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
42
|
+
def self.attribute_map
|
|
43
|
+
{
|
|
44
|
+
:'type' => :'type',
|
|
45
|
+
:'pieces' => :'pieces',
|
|
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,181 @@
|
|
|
1
|
+
# This code was auto generated by AfterShip SDK Generator.
|
|
2
|
+
# Do not edit the class manually.
|
|
3
|
+
module AftershipAPI::Model
|
|
4
|
+
class TrackingMultiPieceInfoPieces
|
|
5
|
+
# AfterShip system-assigned unique identifier for the piece.
|
|
6
|
+
# tracking_id?: String;
|
|
7
|
+
attr_accessor :tracking_id
|
|
8
|
+
|
|
9
|
+
# Carrier-assigned tracking number for the piece.
|
|
10
|
+
# tracking_number?: String;
|
|
11
|
+
attr_accessor :tracking_number
|
|
12
|
+
|
|
13
|
+
# Type of the piece within the MPS: `master` or `child`.
|
|
14
|
+
# type?: TrackingMultiPieceInfoPiecesType;
|
|
15
|
+
attr_accessor :type
|
|
16
|
+
|
|
17
|
+
# Indicates whether the tracking number can be used to retrieve tracking updates on the carrier's side. If not, it means the carrier can only return a child tracking number, but cannot independently provide tracking updates for the sub-shipment. In this case, it is not recommended for you to import this tracking number into AfterShip for tracking.
|
|
18
|
+
# trackable?: Boolean;
|
|
19
|
+
attr_accessor :trackable
|
|
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::TrackingMultiPieceInfoPieces` 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?(:'tracking_id')
|
|
33
|
+
self.tracking_id = attributes[:'tracking_id']
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
if attributes.key?(:'tracking_number')
|
|
37
|
+
self.tracking_number = attributes[:'tracking_number']
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
if attributes.key?(:'type')
|
|
41
|
+
self.type = attributes[:'type']
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
if attributes.key?(:'trackable')
|
|
45
|
+
self.trackable = attributes[:'trackable']
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Attribute type mapping.
|
|
50
|
+
def self.openapi_types
|
|
51
|
+
{
|
|
52
|
+
:'tracking_id' => :'String',
|
|
53
|
+
:'tracking_number' => :'String',
|
|
54
|
+
:'type' => :'TrackingMultiPieceInfoPiecesType',
|
|
55
|
+
:'trackable' => :'Boolean',
|
|
56
|
+
}
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
60
|
+
def self.attribute_map
|
|
61
|
+
{
|
|
62
|
+
:'tracking_id' => :'tracking_id',
|
|
63
|
+
:'tracking_number' => :'tracking_number',
|
|
64
|
+
:'type' => :'type',
|
|
65
|
+
:'trackable' => :'trackable',
|
|
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,26 @@
|
|
|
1
|
+
# This code was auto generated by AfterShip SDK Generator.
|
|
2
|
+
# Do not edit the class manually.
|
|
3
|
+
module AftershipAPI::Model
|
|
4
|
+
class TrackingMultiPieceInfoPiecesType
|
|
5
|
+
MASTER = "master".freeze
|
|
6
|
+
CHILD = "child".freeze
|
|
7
|
+
def self.all_vars
|
|
8
|
+
@all_vars ||= [MASTER, CHILD,].freeze
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# Builds the enum from string
|
|
12
|
+
# @param value [String] The enum value in the form of the string
|
|
13
|
+
# @return [String] The enum value
|
|
14
|
+
def self.build_from_hash(value)
|
|
15
|
+
new.build_from_hash(value)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Builds the enum from string
|
|
19
|
+
# @param value [String] The enum value in the form of the string
|
|
20
|
+
# @return [String] The enum value
|
|
21
|
+
def build_from_hash(value)
|
|
22
|
+
return value if TrackingMultiPieceInfoPiecesType.all_vars.include?(value)
|
|
23
|
+
raise "Invalid ENUM value #{value} for class #TrackingMultiPieceInfoPiecesType"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# This code was auto generated by AfterShip SDK Generator.
|
|
2
|
+
# Do not edit the class manually.
|
|
3
|
+
module AftershipAPI::Model
|
|
4
|
+
class TrackingMultiPieceInfoType
|
|
5
|
+
MASTER = "master".freeze
|
|
6
|
+
CHILD = "child".freeze
|
|
7
|
+
def self.all_vars
|
|
8
|
+
@all_vars ||= [MASTER, CHILD,].freeze
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# Builds the enum from string
|
|
12
|
+
# @param value [String] The enum value in the form of the string
|
|
13
|
+
# @return [String] The enum value
|
|
14
|
+
def self.build_from_hash(value)
|
|
15
|
+
new.build_from_hash(value)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Builds the enum from string
|
|
19
|
+
# @param value [String] The enum value in the form of the string
|
|
20
|
+
# @return [String] The enum value
|
|
21
|
+
def build_from_hash(value)
|
|
22
|
+
return value if TrackingMultiPieceInfoType.all_vars.include?(value)
|
|
23
|
+
raise "Invalid ENUM value #{value} for class #TrackingMultiPieceInfoType"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
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 TrackingProofOfDelivery
|
|
5
|
+
# The file type of the proof of delivery record. Currently, only images are supported.
|
|
6
|
+
# type?: String;
|
|
7
|
+
attr_accessor :type
|
|
8
|
+
|
|
9
|
+
# The URL of the proof of delivery record.
|
|
10
|
+
# url?: String;
|
|
11
|
+
attr_accessor :url
|
|
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::TrackingProofOfDelivery` 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?(:'type')
|
|
25
|
+
self.type = attributes[:'type']
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
if attributes.key?(:'url')
|
|
29
|
+
self.url = attributes[:'url']
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Attribute type mapping.
|
|
34
|
+
def self.openapi_types
|
|
35
|
+
{
|
|
36
|
+
:'type' => :'String',
|
|
37
|
+
:'url' => :'String',
|
|
38
|
+
}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
42
|
+
def self.attribute_map
|
|
43
|
+
{
|
|
44
|
+
:'type' => :'type',
|
|
45
|
+
:'url' => :'url',
|
|
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
|