aftership-tracking-sdk 13.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 +16 -6
- data/lib/aftership-tracking-sdk/models/create_tracking_request.rb +23 -13
- data/lib/aftership-tracking-sdk/models/create_tracking_request_customers.rb +10 -0
- data/lib/aftership-tracking-sdk/models/create_tracking_request_last_mile.rb +1 -1
- data/lib/aftership-tracking-sdk/models/create_tracking_request_order_promised_delivery_date.rb +171 -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.rb +2 -2
- 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 +63 -13
- 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_order_promised_delivery_date.rb +171 -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 +13 -3
- 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_order_promised_delivery_date.rb +171 -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 +16 -2
|
@@ -6,7 +6,7 @@ module AftershipAPI::Model
|
|
|
6
6
|
# country_region: String;
|
|
7
7
|
attr_accessor :country_region
|
|
8
8
|
|
|
9
|
-
# State, province, or the equivalent location of the origin address. Use 3 letters of ISO 3166-1 country/region code for countries/regions without state. Either `origin_address.state` or `origin_address.postal_code` is required
|
|
9
|
+
# State, province, or the equivalent location of the origin address. Use 3 letters of ISO 3166-1 country/region code for countries/regions without state. </br><span style=color:#ff6b2b;padding:2px>**Either `origin_address.state` or `origin_address.postal_code` is required.**</span>
|
|
10
10
|
# state?: String;
|
|
11
11
|
attr_accessor :state
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ module AftershipAPI::Model
|
|
|
14
14
|
# city?: String;
|
|
15
15
|
attr_accessor :city
|
|
16
16
|
|
|
17
|
-
# Postal code of the origin address. Use 3 letters of ISO 3166-1 country/region code for countries/regions without postal code. Either `origin_address.state` or `origin_address.postal_code` is required
|
|
17
|
+
# Postal code of the origin address. Use 3 letters of ISO 3166-1 country/region code for countries/regions without postal code. </br><span style=color:#ff6b2b;padding:2px>**Either `origin_address.state` or `origin_address.postal_code` is required.**</span>
|
|
18
18
|
# postal_code?: String;
|
|
19
19
|
attr_accessor :postal_code
|
|
20
20
|
|
|
@@ -122,6 +122,10 @@ module AftershipAPI::Model
|
|
|
122
122
|
# shipment_weight?: TrackingShipmentWeight;
|
|
123
123
|
attr_accessor :shipment_weight
|
|
124
124
|
|
|
125
|
+
# Physical dimensions of the package (length, width and height).
|
|
126
|
+
# shipment_dimensions?: TrackingShipmentDimensions;
|
|
127
|
+
attr_accessor :shipment_dimensions
|
|
128
|
+
|
|
125
129
|
# Signed by information for delivered shipment.
|
|
126
130
|
# signed_by?: String;
|
|
127
131
|
attr_accessor :signed_by
|
|
@@ -150,10 +154,6 @@ module AftershipAPI::Model
|
|
|
150
154
|
# tracked_count?: Float;
|
|
151
155
|
attr_accessor :tracked_count
|
|
152
156
|
|
|
153
|
-
# Indicates if the shipment is trackable till the final destination.Three possible values:- true- false- null
|
|
154
|
-
# last_mile_tracking_supported?: Boolean;
|
|
155
|
-
attr_accessor :last_mile_tracking_supported
|
|
156
|
-
|
|
157
157
|
# The recipient’s language. If you set up AfterShip notifications in different languages, we use this to send the recipient tracking updates in their preferred language.
|
|
158
158
|
# language?: String;
|
|
159
159
|
attr_accessor :language
|
|
@@ -178,8 +178,8 @@ module AftershipAPI::Model
|
|
|
178
178
|
# return_to_sender?: Boolean;
|
|
179
179
|
attr_accessor :return_to_sender
|
|
180
180
|
|
|
181
|
-
# The promised delivery date of the order
|
|
182
|
-
# order_promised_delivery_date?:
|
|
181
|
+
# The promised delivery date of the order in shipment recipient’s timezone.
|
|
182
|
+
# order_promised_delivery_date?: TrackingOrderPromisedDeliveryDate;
|
|
183
183
|
attr_accessor :order_promised_delivery_date
|
|
184
184
|
|
|
185
185
|
# Shipment delivery type- pickup_at_store- pickup_at_courier- door_to_door
|
|
@@ -302,6 +302,26 @@ module AftershipAPI::Model
|
|
|
302
302
|
# customers?: TrackingCustomers[];
|
|
303
303
|
attr_accessor :customers
|
|
304
304
|
|
|
305
|
+
# An array of proof of delivery (POD) records, such as a signature or photo captured upon successful delivery.This field returns a value only after the feature is enabled. Please contact your customer success manager if you'd like to know more.
|
|
306
|
+
# proof_of_delivery?: TrackingProofOfDelivery[];
|
|
307
|
+
attr_accessor :proof_of_delivery
|
|
308
|
+
|
|
309
|
+
# Multi-piece shipment refers to a scenario where a single shipment order is fulfilled by multiple physical packages. Each piece has its own carrier-assigned tracking number, but all pieces belong to the same shipment. This commonly occurs when an order is too large to fit in one box, or when items are packed separately for handling reasons.This field contains multi-piece shipment metadata describing a group of packages that belong to the same shipment.This field returns a value only when your subscription plan includes a multi-piece feature. To enable, go to .
|
|
310
|
+
# multi_piece_info?: TrackingMultiPieceInfo;
|
|
311
|
+
attr_accessor :multi_piece_info
|
|
312
|
+
|
|
313
|
+
# Indicates the business direction of the shipment in the e-commerce fulfillment lifecycle.Possible values:- `forward`: A forward (outbound-to-customer) shipment created for order fulfillment.- `return`: A return (customer-to-merchant) shipment created for after-sales return or exchange.This field is populated in either of the following cases:1. You explicitly provided it when creating the tracking.2. AfterShip automatically detected a linked forward or return shipment.It also determines which related shipment object (`forward_shipment` or `return_shipment`) may appear in the response.
|
|
314
|
+
# shipment_direction?: TrackingShipmentDirection;
|
|
315
|
+
attr_accessor :shipment_direction
|
|
316
|
+
|
|
317
|
+
# The associated return shipment linked to the current outbound shipment.This field is only present when `shipment_direction = "forward"` and AfterShip has detected a linked return shipment.
|
|
318
|
+
# return_shipment?: TrackingReturnShipment;
|
|
319
|
+
attr_accessor :return_shipment
|
|
320
|
+
|
|
321
|
+
# The original outbound shipment linked to this return. Use this to trace a return back to its source delivery.This field is only present when `shipment_direction = "return"` and AfterShip has detected a linked forward shipment.
|
|
322
|
+
# forward_shipment?: TrackingForwardShipment;
|
|
323
|
+
attr_accessor :forward_shipment
|
|
324
|
+
|
|
305
325
|
# Initializes the object
|
|
306
326
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
307
327
|
def initialize(attributes = {})
|
|
@@ -433,6 +453,10 @@ module AftershipAPI::Model
|
|
|
433
453
|
self.shipment_weight = attributes[:'shipment_weight']
|
|
434
454
|
end
|
|
435
455
|
|
|
456
|
+
if attributes.key?(:'shipment_dimensions')
|
|
457
|
+
self.shipment_dimensions = attributes[:'shipment_dimensions']
|
|
458
|
+
end
|
|
459
|
+
|
|
436
460
|
if attributes.key?(:'signed_by')
|
|
437
461
|
self.signed_by = attributes[:'signed_by']
|
|
438
462
|
end
|
|
@@ -461,10 +485,6 @@ module AftershipAPI::Model
|
|
|
461
485
|
self.tracked_count = attributes[:'tracked_count']
|
|
462
486
|
end
|
|
463
487
|
|
|
464
|
-
if attributes.key?(:'last_mile_tracking_supported')
|
|
465
|
-
self.last_mile_tracking_supported = attributes[:'last_mile_tracking_supported']
|
|
466
|
-
end
|
|
467
|
-
|
|
468
488
|
if attributes.key?(:'language')
|
|
469
489
|
self.language = attributes[:'language']
|
|
470
490
|
end
|
|
@@ -612,6 +632,26 @@ module AftershipAPI::Model
|
|
|
612
632
|
if attributes.key?(:'customers')
|
|
613
633
|
self.customers = attributes[:'customers']
|
|
614
634
|
end
|
|
635
|
+
|
|
636
|
+
if attributes.key?(:'proof_of_delivery')
|
|
637
|
+
self.proof_of_delivery = attributes[:'proof_of_delivery']
|
|
638
|
+
end
|
|
639
|
+
|
|
640
|
+
if attributes.key?(:'multi_piece_info')
|
|
641
|
+
self.multi_piece_info = attributes[:'multi_piece_info']
|
|
642
|
+
end
|
|
643
|
+
|
|
644
|
+
if attributes.key?(:'shipment_direction')
|
|
645
|
+
self.shipment_direction = attributes[:'shipment_direction']
|
|
646
|
+
end
|
|
647
|
+
|
|
648
|
+
if attributes.key?(:'return_shipment')
|
|
649
|
+
self.return_shipment = attributes[:'return_shipment']
|
|
650
|
+
end
|
|
651
|
+
|
|
652
|
+
if attributes.key?(:'forward_shipment')
|
|
653
|
+
self.forward_shipment = attributes[:'forward_shipment']
|
|
654
|
+
end
|
|
615
655
|
end
|
|
616
656
|
|
|
617
657
|
# Attribute type mapping.
|
|
@@ -647,6 +687,7 @@ module AftershipAPI::Model
|
|
|
647
687
|
:'shipment_delivery_date' => :'String',
|
|
648
688
|
:'shipment_type' => :'String',
|
|
649
689
|
:'shipment_weight' => :'TrackingShipmentWeight',
|
|
690
|
+
:'shipment_dimensions' => :'TrackingShipmentDimensions',
|
|
650
691
|
:'signed_by' => :'String',
|
|
651
692
|
:'source' => :'String',
|
|
652
693
|
:'tag' => :'Tag',
|
|
@@ -654,14 +695,13 @@ module AftershipAPI::Model
|
|
|
654
695
|
:'subtag_message' => :'String',
|
|
655
696
|
:'title' => :'String',
|
|
656
697
|
:'tracked_count' => :'Float',
|
|
657
|
-
:'last_mile_tracking_supported' => :'Boolean',
|
|
658
698
|
:'language' => :'String',
|
|
659
699
|
:'unique_token' => :'String',
|
|
660
700
|
:'checkpoints' => :'Array<Checkpoint>',
|
|
661
701
|
:'subscribed_smses' => :'Array<String>',
|
|
662
702
|
:'subscribed_emails' => :'Array<String>',
|
|
663
703
|
:'return_to_sender' => :'Boolean',
|
|
664
|
-
:'order_promised_delivery_date' => :'
|
|
704
|
+
:'order_promised_delivery_date' => :'TrackingOrderPromisedDeliveryDate',
|
|
665
705
|
:'delivery_type' => :'String',
|
|
666
706
|
:'pickup_location' => :'String',
|
|
667
707
|
:'pickup_note' => :'String',
|
|
@@ -692,6 +732,11 @@ module AftershipAPI::Model
|
|
|
692
732
|
:'first_mile' => :'TrackingFirstMile',
|
|
693
733
|
:'last_mile' => :'TrackingLastMile',
|
|
694
734
|
:'customers' => :'Array<TrackingCustomers>',
|
|
735
|
+
:'proof_of_delivery' => :'Array<TrackingProofOfDelivery>',
|
|
736
|
+
:'multi_piece_info' => :'TrackingMultiPieceInfo',
|
|
737
|
+
:'shipment_direction' => :'TrackingShipmentDirection',
|
|
738
|
+
:'return_shipment' => :'TrackingReturnShipment',
|
|
739
|
+
:'forward_shipment' => :'TrackingForwardShipment',
|
|
695
740
|
}
|
|
696
741
|
end
|
|
697
742
|
|
|
@@ -728,6 +773,7 @@ module AftershipAPI::Model
|
|
|
728
773
|
:'shipment_delivery_date' => :'shipment_delivery_date',
|
|
729
774
|
:'shipment_type' => :'shipment_type',
|
|
730
775
|
:'shipment_weight' => :'shipment_weight',
|
|
776
|
+
:'shipment_dimensions' => :'shipment_dimensions',
|
|
731
777
|
:'signed_by' => :'signed_by',
|
|
732
778
|
:'source' => :'source',
|
|
733
779
|
:'tag' => :'tag',
|
|
@@ -735,7 +781,6 @@ module AftershipAPI::Model
|
|
|
735
781
|
:'subtag_message' => :'subtag_message',
|
|
736
782
|
:'title' => :'title',
|
|
737
783
|
:'tracked_count' => :'tracked_count',
|
|
738
|
-
:'last_mile_tracking_supported' => :'last_mile_tracking_supported',
|
|
739
784
|
:'language' => :'language',
|
|
740
785
|
:'unique_token' => :'unique_token',
|
|
741
786
|
:'checkpoints' => :'checkpoints',
|
|
@@ -773,6 +818,11 @@ module AftershipAPI::Model
|
|
|
773
818
|
:'first_mile' => :'first_mile',
|
|
774
819
|
:'last_mile' => :'last_mile',
|
|
775
820
|
:'customers' => :'customers',
|
|
821
|
+
:'proof_of_delivery' => :'proof_of_delivery',
|
|
822
|
+
:'multi_piece_info' => :'multi_piece_info',
|
|
823
|
+
:'shipment_direction' => :'shipment_direction',
|
|
824
|
+
:'return_shipment' => :'return_shipment',
|
|
825
|
+
:'forward_shipment' => :'forward_shipment',
|
|
776
826
|
}
|
|
777
827
|
end
|
|
778
828
|
|
|
@@ -22,6 +22,10 @@ module AftershipAPI::Model
|
|
|
22
22
|
# language?: String;
|
|
23
23
|
attr_accessor :language
|
|
24
24
|
|
|
25
|
+
# The customer's identifier on the merchant or platform (for example, Shopify) side.
|
|
26
|
+
# id?: String;
|
|
27
|
+
attr_accessor :id
|
|
28
|
+
|
|
25
29
|
# Initializes the object
|
|
26
30
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
27
31
|
def initialize(attributes = {})
|
|
@@ -52,6 +56,10 @@ module AftershipAPI::Model
|
|
|
52
56
|
if attributes.key?(:'language')
|
|
53
57
|
self.language = attributes[:'language']
|
|
54
58
|
end
|
|
59
|
+
|
|
60
|
+
if attributes.key?(:'id')
|
|
61
|
+
self.id = attributes[:'id']
|
|
62
|
+
end
|
|
55
63
|
end
|
|
56
64
|
|
|
57
65
|
# Attribute type mapping.
|
|
@@ -62,6 +70,7 @@ module AftershipAPI::Model
|
|
|
62
70
|
:'phone_number' => :'String',
|
|
63
71
|
:'email' => :'String',
|
|
64
72
|
:'language' => :'String',
|
|
73
|
+
:'id' => :'String',
|
|
65
74
|
}
|
|
66
75
|
end
|
|
67
76
|
|
|
@@ -73,6 +82,7 @@ module AftershipAPI::Model
|
|
|
73
82
|
:'phone_number' => :'phone_number',
|
|
74
83
|
:'email' => :'email',
|
|
75
84
|
:'language' => :'language',
|
|
85
|
+
:'id' => :'id',
|
|
76
86
|
}
|
|
77
87
|
end
|
|
78
88
|
|
|
@@ -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
|