aftership-tracking-sdk 10.0.0 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -12
  3. data/lib/aftership-tracking-sdk/api/courier.rb +16 -60
  4. data/lib/aftership-tracking-sdk/api/courier_connection.rb +283 -0
  5. data/lib/aftership-tracking-sdk/api/estimated_delivery_date.rb +2 -2
  6. data/lib/aftership-tracking-sdk/api/tracking.rb +9 -9
  7. data/lib/aftership-tracking-sdk/models/{additional_fields_v1.rb → additional_fields.rb} +9 -9
  8. data/lib/aftership-tracking-sdk/models/checkpoint.rb +2 -2
  9. data/lib/aftership-tracking-sdk/models/courier.rb +10 -0
  10. data/lib/aftership-tracking-sdk/models/courier_connection.rb +193 -0
  11. data/lib/aftership-tracking-sdk/models/courier_connection_response_for_get_courier_connections.rb +163 -0
  12. data/lib/aftership-tracking-sdk/models/{courier_response_v1.rb → courier_response.rb} +6 -6
  13. data/lib/aftership-tracking-sdk/models/create_tracking_request.rb +22 -52
  14. data/lib/aftership-tracking-sdk/models/create_tracking_response.rb +4 -44
  15. data/lib/aftership-tracking-sdk/models/credential_field.rb +173 -0
  16. data/lib/aftership-tracking-sdk/models/{get_user_couriers_response.rb → credentials_courier.rb} +9 -19
  17. data/lib/aftership-tracking-sdk/models/data_courier_connection_response_for_get_courier_connections.rb +163 -0
  18. data/lib/aftership-tracking-sdk/models/{data_courier_response_v1.rb → data_courier_response.rb} +2 -2
  19. data/lib/aftership-tracking-sdk/models/{data_tracking_response_get_multiple_v1.rb → data_tracking_response_for_get_trackings.rb} +4 -4
  20. data/lib/aftership-tracking-sdk/models/delete_courier_connections_by_id_response.rb +193 -0
  21. data/lib/aftership-tracking-sdk/models/delete_tracking_by_id_response.rb +4 -44
  22. data/lib/aftership-tracking-sdk/models/detect_courier_request.rb +14 -34
  23. data/lib/aftership-tracking-sdk/models/first_mile_create_tracking_response.rb +2 -2
  24. data/lib/aftership-tracking-sdk/models/first_mile_delete_tracking_by_id_response.rb +2 -2
  25. data/lib/aftership-tracking-sdk/models/first_mile_get_tracking_by_id_response.rb +2 -2
  26. data/lib/aftership-tracking-sdk/models/first_mile_mark_tracking_completed_by_id_response.rb +2 -2
  27. data/lib/aftership-tracking-sdk/models/first_mile_retrack_tracking_by_id_response.rb +2 -2
  28. data/lib/aftership-tracking-sdk/models/first_mile_tracking.rb +2 -2
  29. data/lib/aftership-tracking-sdk/models/first_mile_update_tracking_by_id_response.rb +2 -2
  30. data/lib/aftership-tracking-sdk/models/get_courier_connections_by_id_response.rb +193 -0
  31. data/lib/aftership-tracking-sdk/models/get_courier_connections_response.rb +163 -0
  32. data/lib/aftership-tracking-sdk/models/{get_all_couriers_response.rb → get_couriers_response.rb} +2 -2
  33. data/lib/aftership-tracking-sdk/models/get_tracking_by_id_response.rb +4 -44
  34. data/lib/aftership-tracking-sdk/models/last_mile_create_tracking_response.rb +2 -2
  35. data/lib/aftership-tracking-sdk/models/last_mile_delete_tracking_by_id_response.rb +2 -2
  36. data/lib/aftership-tracking-sdk/models/last_mile_get_tracking_by_id_response.rb +2 -2
  37. data/lib/aftership-tracking-sdk/models/last_mile_mark_tracking_completed_by_id_response.rb +2 -2
  38. data/lib/aftership-tracking-sdk/models/last_mile_retrack_tracking_by_id_response.rb +2 -2
  39. data/lib/aftership-tracking-sdk/models/last_mile_tracking.rb +2 -2
  40. data/lib/aftership-tracking-sdk/models/last_mile_update_tracking_by_id_response.rb +2 -2
  41. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_create_tracking_response.rb +10 -0
  42. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_delete_tracking_by_id_response.rb +10 -0
  43. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_get_tracking_by_id_response.rb +10 -0
  44. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_mark_tracking_completed_by_id_response.rb +10 -0
  45. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_retrack_tracking_by_id_response.rb +10 -0
  46. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_tracking.rb +10 -0
  47. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_update_tracking_by_id_response.rb +10 -0
  48. data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_request.rb +10 -0
  49. data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_response.rb +4 -44
  50. data/lib/aftership-tracking-sdk/models/{meta_v1.rb → meta.rb} +2 -2
  51. data/lib/aftership-tracking-sdk/models/pagination_data_courier_connection_response_for_get_courier_connections.rb +173 -0
  52. data/lib/aftership-tracking-sdk/models/{pagination_data_tracking_response_get_multiple_v1.rb → pagination_data_tracking_response_for_get_trackings.rb} +2 -2
  53. data/lib/aftership-tracking-sdk/models/pagination_get_courier_connections_response.rb +173 -0
  54. data/lib/aftership-tracking-sdk/models/post_courier_connections_request.rb +163 -0
  55. data/lib/aftership-tracking-sdk/models/post_courier_connections_response.rb +193 -0
  56. data/lib/aftership-tracking-sdk/models/put_courier_connections_by_id_request.rb +153 -0
  57. data/lib/aftership-tracking-sdk/models/put_courier_connections_by_id_response.rb +193 -0
  58. data/lib/aftership-tracking-sdk/models/retrack_tracking_by_id_response.rb +4 -44
  59. data/lib/aftership-tracking-sdk/models/{slug_group_v1.rb → slug_group.rb} +3 -3
  60. data/lib/aftership-tracking-sdk/models/{tag_v1.rb → tag.rb} +3 -3
  61. data/lib/aftership-tracking-sdk/models/tracking.rb +4 -44
  62. data/lib/aftership-tracking-sdk/models/{tracking_response_v1.rb → tracking_response.rb} +4 -4
  63. data/lib/aftership-tracking-sdk/models/{tracking_response_get_multiple_v1.rb → tracking_response_for_get_trackings.rb} +6 -6
  64. data/lib/aftership-tracking-sdk/models/update_tracking_by_id_request.rb +0 -40
  65. data/lib/aftership-tracking-sdk/models/update_tracking_by_id_response.rb +4 -44
  66. data/lib/aftership-tracking-sdk/version.rb +1 -1
  67. metadata +28 -14
@@ -23,6 +23,10 @@ module AftershipAPI::Model
23
23
  # datetime_max?: String;
24
24
  attr_accessor :datetime_max
25
25
 
26
+ # Explains the reason for a change to the latest_estimated_delivery. This string will only have a value if:1. The source for the latest EDD is AfterShip EDD. 2. The reason for the change is known.For a comprehensive list of reasons, please refer to this document.
27
+ # revise_reason?: String;
28
+ attr_accessor :revise_reason
29
+
26
30
  # Initializes the object
27
31
  # @param [Hash] attributes Model attributes in the form of hash
28
32
  def initialize(attributes = {})
@@ -53,6 +57,10 @@ module AftershipAPI::Model
53
57
  if attributes.key?(:'datetime_max')
54
58
  self.datetime_max = attributes[:'datetime_max']
55
59
  end
60
+
61
+ if attributes.key?(:'revise_reason')
62
+ self.revise_reason = attributes[:'revise_reason']
63
+ end
56
64
  end
57
65
 
58
66
  # Attribute type mapping.
@@ -63,6 +71,7 @@ module AftershipAPI::Model
63
71
  :'datetime' => :'String',
64
72
  :'datetime_min' => :'String',
65
73
  :'datetime_max' => :'String',
74
+ :'revise_reason' => :'String',
66
75
  }
67
76
  end
68
77
 
@@ -74,6 +83,7 @@ module AftershipAPI::Model
74
83
  :'datetime' => :'datetime',
75
84
  :'datetime_min' => :'datetime_min',
76
85
  :'datetime_max' => :'datetime_max',
86
+ :'revise_reason' => :'revise_reason',
77
87
  }
78
88
  end
79
89
 
@@ -7,6 +7,10 @@ module AftershipAPI::Model
7
7
  # reason: String;
8
8
  attr_accessor :reason
9
9
 
10
+ # The actual occurrence time of the marked tracking status.The field supports the following formats: - YYYY-MM-DD- YYYY-MM-DDTHH:mm:ss- YYYY-MM-DDTHH:mm:ssZ
11
+ # event_datetime?: String;
12
+ attr_accessor :event_datetime
13
+
10
14
  # Initializes the object
11
15
  # @param [Hash] attributes Model attributes in the form of hash
12
16
  def initialize(attributes = {})
@@ -21,12 +25,17 @@ module AftershipAPI::Model
21
25
  if attributes.key?(:'reason')
22
26
  self.reason = attributes[:'reason']
23
27
  end
28
+
29
+ if attributes.key?(:'event_datetime')
30
+ self.event_datetime = attributes[:'event_datetime']
31
+ end
24
32
  end
25
33
 
26
34
  # Attribute type mapping.
27
35
  def self.openapi_types
28
36
  {
29
37
  :'reason' => :'String',
38
+ :'event_datetime' => :'String',
30
39
  }
31
40
  end
32
41
 
@@ -34,6 +43,7 @@ module AftershipAPI::Model
34
43
  def self.attribute_map
35
44
  {
36
45
  :'reason' => :'reason',
46
+ :'event_datetime' => :'event_datetime',
37
47
  }
38
48
  end
39
49
 
@@ -3,7 +3,7 @@
3
3
  module AftershipAPI::Model
4
4
  class MarkTrackingCompletedByIdResponse
5
5
 
6
- # Tracking ID.
6
+ # A system-generated tracking ID by default, which can be customized by the user when creating a tracking.
7
7
  # id?: String;
8
8
  attr_accessor :id
9
9
 
@@ -27,7 +27,7 @@ module AftershipAPI::Model
27
27
  # slug?: String;
28
28
  attr_accessor :slug
29
29
 
30
- # 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.
30
+ # Whether or not AfterShip will continue tracking the shipment. Value is false when no further updates for a few days since last update.
31
31
  # active?: Boolean;
32
32
  attr_accessor :active
33
33
 
@@ -132,7 +132,7 @@ module AftershipAPI::Model
132
132
  attr_accessor :source
133
133
 
134
134
  # Current status of tracking. (
135
- # tag?: TagV1;
135
+ # tag?: Tag;
136
136
  attr_accessor :tag
137
137
 
138
138
  # Current subtag of tracking. (
@@ -259,22 +259,6 @@ module AftershipAPI::Model
259
259
  # courier_connection_id?: String;
260
260
  attr_accessor :courier_connection_id
261
261
 
262
- # (Legacy) Replaced by `origin_country_region`. 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.
263
- # tracking_origin_country_region?: String;
264
- attr_accessor :tracking_origin_country_region
265
-
266
- # (Legacy) Replaced by `destination_country_region`. 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.
267
- # tracking_destination_country_region?: String;
268
- attr_accessor :tracking_destination_country_region
269
-
270
- # (Legacy) Replaced by `destination_postal_code`. 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.
271
- # tracking_postal_code?: String;
272
- attr_accessor :tracking_postal_code
273
-
274
- # (Legacy) Replaced by `destination_state`. 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.
275
- # tracking_state?: String;
276
- attr_accessor :tracking_state
277
-
278
262
  # The model contains the total amount of carbon emissions generated by the shipment. - AfterShip will provide this data only when it is available, and its availability is contingent upon the location and weight information that AfterShip can obtain.- The values will be accessible solely for shipments that have been successfully delivered. However, in the event of a shipping update after the delivery status has been achieved, the value may change.- It’s a paid service and only for Tracking Enterprise users, please contact your customer success manager if you want to know more.
279
263
  # carbon_emissions?: CarbonEmissionsMarkTrackingCompletedByIdResponse;
280
264
  attr_accessor :carbon_emissions
@@ -586,22 +570,6 @@ module AftershipAPI::Model
586
570
  self.courier_connection_id = attributes[:'courier_connection_id']
587
571
  end
588
572
 
589
- if attributes.key?(:'tracking_origin_country_region')
590
- self.tracking_origin_country_region = attributes[:'tracking_origin_country_region']
591
- end
592
-
593
- if attributes.key?(:'tracking_destination_country_region')
594
- self.tracking_destination_country_region = attributes[:'tracking_destination_country_region']
595
- end
596
-
597
- if attributes.key?(:'tracking_postal_code')
598
- self.tracking_postal_code = attributes[:'tracking_postal_code']
599
- end
600
-
601
- if attributes.key?(:'tracking_state')
602
- self.tracking_state = attributes[:'tracking_state']
603
- end
604
-
605
573
  if attributes.key?(:'carbon_emissions')
606
574
  self.carbon_emissions = attributes[:'carbon_emissions']
607
575
  end
@@ -682,7 +650,7 @@ module AftershipAPI::Model
682
650
  :'shipment_weight' => :'ShipmentWeightMarkTrackingCompletedByIdResponse',
683
651
  :'signed_by' => :'String',
684
652
  :'source' => :'String',
685
- :'tag' => :'TagV1',
653
+ :'tag' => :'Tag',
686
654
  :'subtag' => :'String',
687
655
  :'subtag_message' => :'String',
688
656
  :'title' => :'String',
@@ -714,10 +682,6 @@ module AftershipAPI::Model
714
682
  :'latest_estimated_delivery' => :'LatestEstimatedDeliveryMarkTrackingCompletedByIdResponse',
715
683
  :'shipment_tags' => :'Array<String>',
716
684
  :'courier_connection_id' => :'String',
717
- :'tracking_origin_country_region' => :'String',
718
- :'tracking_destination_country_region' => :'String',
719
- :'tracking_postal_code' => :'String',
720
- :'tracking_state' => :'String',
721
685
  :'carbon_emissions' => :'CarbonEmissionsMarkTrackingCompletedByIdResponse',
722
686
  :'location_id' => :'String',
723
687
  :'shipping_method' => :'String',
@@ -799,10 +763,6 @@ module AftershipAPI::Model
799
763
  :'latest_estimated_delivery' => :'latest_estimated_delivery',
800
764
  :'shipment_tags' => :'shipment_tags',
801
765
  :'courier_connection_id' => :'courier_connection_id',
802
- :'tracking_origin_country_region' => :'tracking_origin_country_region',
803
- :'tracking_destination_country_region' => :'tracking_destination_country_region',
804
- :'tracking_postal_code' => :'tracking_postal_code',
805
- :'tracking_state' => :'tracking_state',
806
766
  :'carbon_emissions' => :'carbon_emissions',
807
767
  :'location_id' => :'location_id',
808
768
  :'shipping_method' => :'shipping_method',
@@ -1,7 +1,7 @@
1
1
  # This code was auto generated by AfterShip SDK Generator.
2
2
  # Do not edit the class manually.
3
3
  module AftershipAPI::Model
4
- class MetaV1
4
+ class Meta
5
5
 
6
6
  # meta code
7
7
  # code: Integer;
@@ -19,7 +19,7 @@ module AftershipAPI::Model
19
19
  # @param [Hash] attributes Model attributes in the form of hash
20
20
  def initialize(attributes = {})
21
21
  if (!attributes.is_a?(Hash))
22
- fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::MetaV1` initialize method"
22
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::Meta` initialize method"
23
23
  end
24
24
 
25
25
  attributes = attributes.each_with_object({}) { |(k, v), h|
@@ -0,0 +1,173 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class PaginationDataCourierConnectionResponseForGetCourierConnections
5
+
6
+ # The total number of courier connections.
7
+ # total?: Integer;
8
+ attr_accessor :total
9
+
10
+ # A string representing the cursor value for the next page of results.
11
+ # next_cursor?: String;
12
+ attr_accessor :next_cursor
13
+
14
+ # To indicate if next page is available.
15
+ # has_next_page?: Boolean;
16
+ attr_accessor :has_next_page
17
+
18
+ # Initializes the object
19
+ # @param [Hash] attributes Model attributes in the form of hash
20
+ def initialize(attributes = {})
21
+ if (!attributes.is_a?(Hash))
22
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::PaginationDataCourierConnectionResponseForGetCourierConnections` initialize method"
23
+ end
24
+
25
+ attributes = attributes.each_with_object({}) { |(k, v), h|
26
+ h[k.to_sym] = v
27
+ }
28
+
29
+ if attributes.key?(:'total')
30
+ self.total = attributes[:'total']
31
+ end
32
+
33
+ if attributes.key?(:'next_cursor')
34
+ self.next_cursor = attributes[:'next_cursor']
35
+ end
36
+
37
+ if attributes.key?(:'has_next_page')
38
+ self.has_next_page = attributes[:'has_next_page']
39
+ end
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'total' => :'Integer',
46
+ :'next_cursor' => :'String',
47
+ :'has_next_page' => :'Boolean',
48
+ }
49
+ end
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'total' => :'total',
55
+ :'next_cursor' => :'next_cursor',
56
+ :'has_next_page' => :'has_next_page',
57
+ }
58
+ end
59
+
60
+ # Builds the object from hash
61
+ # @param attributes [Hash] Model attributes in the form of hash
62
+ # @return [Object] Returns the model itself
63
+ def self.build_from_hash(attributes)
64
+ return nil unless attributes.is_a?(Hash)
65
+ attributes = attributes.transform_keys(&:to_sym)
66
+ transformed_hash = {}
67
+ openapi_types.each_pair do |key, type|
68
+ if attributes.key?(key) && attributes[key].nil?
69
+ transformed_hash["#{key}"] = nil
70
+ elsif type =~ /\AArray<(.*)>/i
71
+ # check to ensure the input is an array given that the attribute
72
+ # is documented as an array but the input is not
73
+ if attributes[key].is_a?(Array)
74
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
75
+ end
76
+ elsif !attributes[key].nil?
77
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
78
+ end
79
+ end
80
+ new(transformed_hash)
81
+ end
82
+
83
+ # Deserializes the data based on type
84
+ # @param type [String] Data type
85
+ # @param value [String] Value to be deserialized
86
+ # @return [Object] Deserialized data
87
+ def self._deserialize(type, value)
88
+ case type.to_sym
89
+ when :Time
90
+ Time.parse(value)
91
+ when :Date
92
+ Date.parse(value)
93
+ when :String
94
+ value.to_s
95
+ when :Integer
96
+ value.to_i
97
+ when :Float
98
+ value.to_f
99
+ when :Boolean
100
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
101
+ true
102
+ else
103
+ false
104
+ end
105
+ when :Object
106
+ # generic object (usually a Hash), return directly
107
+ value
108
+ when /\AArray<(?<inner_type>.+)>\z/
109
+ inner_type = Regexp.last_match[:inner_type]
110
+ value.map { |v| _deserialize(inner_type, v) }
111
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
112
+ k_type = Regexp.last_match[:k_type]
113
+ v_type = Regexp.last_match[:v_type]
114
+ {}.tap do |hash|
115
+ value.each do |k, v|
116
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
117
+ end
118
+ end
119
+ else # model
120
+ klass = AftershipAPI::Model.const_get(type)
121
+ klass.build_from_hash(value)
122
+ end
123
+ end
124
+
125
+ # Returns the string representation of the object
126
+ # @return [String] String presentation of the object
127
+ def to_s
128
+ to_hash.to_s
129
+ end
130
+
131
+ # to_body is an alias to to_hash (backward compatibility)
132
+ # @return [Hash] Returns the object in the form of hash
133
+ def to_body
134
+ to_hash
135
+ end
136
+
137
+ # Returns the object in the form of hash
138
+ # @return [Hash] Returns the object in the form of hash
139
+ def to_hash
140
+ hash = {}
141
+ self.class.attribute_map.each_pair do |attr, param|
142
+ value = self.send(attr)
143
+ next if value.nil?
144
+
145
+ hash[param] = _to_hash(value)
146
+ end
147
+ hash
148
+ end
149
+
150
+ # Outputs non-array value in the form of hash
151
+ # For object, use to_hash. Otherwise, just return the value
152
+ # @param value [Object] Any valid value
153
+ # @return [Hash] Returns the value in the form of hash
154
+ def _to_hash(value)
155
+ if value.is_a?(Array)
156
+ value.compact.map { |v| _to_hash(v) }
157
+ elsif value.is_a?(Hash)
158
+ {}.tap do |hash|
159
+ value.each { |k, v| hash[k] = _to_hash(v) }
160
+ end
161
+ elsif value.respond_to? :to_hash
162
+ value.to_hash
163
+ else
164
+ value
165
+ end
166
+ end
167
+
168
+ def to_json(*a)
169
+ to_hash.to_json(*a)
170
+ end
171
+ end
172
+ end
173
+
@@ -1,7 +1,7 @@
1
1
  # This code was auto generated by AfterShip SDK Generator.
2
2
  # Do not edit the class manually.
3
3
  module AftershipAPI::Model
4
- class PaginationDataTrackingResponseGetMultipleV1
4
+ class PaginationDataTrackingResponseForGetTrackings
5
5
 
6
6
  # The total number of trackings.
7
7
  # total?: Integer;
@@ -19,7 +19,7 @@ module AftershipAPI::Model
19
19
  # @param [Hash] attributes Model attributes in the form of hash
20
20
  def initialize(attributes = {})
21
21
  if (!attributes.is_a?(Hash))
22
- fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::PaginationDataTrackingResponseGetMultipleV1` initialize method"
22
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::PaginationDataTrackingResponseForGetTrackings` initialize method"
23
23
  end
24
24
 
25
25
  attributes = attributes.each_with_object({}) { |(k, v), h|
@@ -0,0 +1,173 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class PaginationGetCourierConnectionsResponse
5
+
6
+ # The total number of courier connections.
7
+ # total?: Integer;
8
+ attr_accessor :total
9
+
10
+ # A string representing the cursor value for the next page of results.
11
+ # next_cursor?: String;
12
+ attr_accessor :next_cursor
13
+
14
+ # To indicate if next page is available.
15
+ # has_next_page?: Boolean;
16
+ attr_accessor :has_next_page
17
+
18
+ # Initializes the object
19
+ # @param [Hash] attributes Model attributes in the form of hash
20
+ def initialize(attributes = {})
21
+ if (!attributes.is_a?(Hash))
22
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::PaginationGetCourierConnectionsResponse` initialize method"
23
+ end
24
+
25
+ attributes = attributes.each_with_object({}) { |(k, v), h|
26
+ h[k.to_sym] = v
27
+ }
28
+
29
+ if attributes.key?(:'total')
30
+ self.total = attributes[:'total']
31
+ end
32
+
33
+ if attributes.key?(:'next_cursor')
34
+ self.next_cursor = attributes[:'next_cursor']
35
+ end
36
+
37
+ if attributes.key?(:'has_next_page')
38
+ self.has_next_page = attributes[:'has_next_page']
39
+ end
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'total' => :'Integer',
46
+ :'next_cursor' => :'String',
47
+ :'has_next_page' => :'Boolean',
48
+ }
49
+ end
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'total' => :'total',
55
+ :'next_cursor' => :'next_cursor',
56
+ :'has_next_page' => :'has_next_page',
57
+ }
58
+ end
59
+
60
+ # Builds the object from hash
61
+ # @param attributes [Hash] Model attributes in the form of hash
62
+ # @return [Object] Returns the model itself
63
+ def self.build_from_hash(attributes)
64
+ return nil unless attributes.is_a?(Hash)
65
+ attributes = attributes.transform_keys(&:to_sym)
66
+ transformed_hash = {}
67
+ openapi_types.each_pair do |key, type|
68
+ if attributes.key?(key) && attributes[key].nil?
69
+ transformed_hash["#{key}"] = nil
70
+ elsif type =~ /\AArray<(.*)>/i
71
+ # check to ensure the input is an array given that the attribute
72
+ # is documented as an array but the input is not
73
+ if attributes[key].is_a?(Array)
74
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
75
+ end
76
+ elsif !attributes[key].nil?
77
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
78
+ end
79
+ end
80
+ new(transformed_hash)
81
+ end
82
+
83
+ # Deserializes the data based on type
84
+ # @param type [String] Data type
85
+ # @param value [String] Value to be deserialized
86
+ # @return [Object] Deserialized data
87
+ def self._deserialize(type, value)
88
+ case type.to_sym
89
+ when :Time
90
+ Time.parse(value)
91
+ when :Date
92
+ Date.parse(value)
93
+ when :String
94
+ value.to_s
95
+ when :Integer
96
+ value.to_i
97
+ when :Float
98
+ value.to_f
99
+ when :Boolean
100
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
101
+ true
102
+ else
103
+ false
104
+ end
105
+ when :Object
106
+ # generic object (usually a Hash), return directly
107
+ value
108
+ when /\AArray<(?<inner_type>.+)>\z/
109
+ inner_type = Regexp.last_match[:inner_type]
110
+ value.map { |v| _deserialize(inner_type, v) }
111
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
112
+ k_type = Regexp.last_match[:k_type]
113
+ v_type = Regexp.last_match[:v_type]
114
+ {}.tap do |hash|
115
+ value.each do |k, v|
116
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
117
+ end
118
+ end
119
+ else # model
120
+ klass = AftershipAPI::Model.const_get(type)
121
+ klass.build_from_hash(value)
122
+ end
123
+ end
124
+
125
+ # Returns the string representation of the object
126
+ # @return [String] String presentation of the object
127
+ def to_s
128
+ to_hash.to_s
129
+ end
130
+
131
+ # to_body is an alias to to_hash (backward compatibility)
132
+ # @return [Hash] Returns the object in the form of hash
133
+ def to_body
134
+ to_hash
135
+ end
136
+
137
+ # Returns the object in the form of hash
138
+ # @return [Hash] Returns the object in the form of hash
139
+ def to_hash
140
+ hash = {}
141
+ self.class.attribute_map.each_pair do |attr, param|
142
+ value = self.send(attr)
143
+ next if value.nil?
144
+
145
+ hash[param] = _to_hash(value)
146
+ end
147
+ hash
148
+ end
149
+
150
+ # Outputs non-array value in the form of hash
151
+ # For object, use to_hash. Otherwise, just return the value
152
+ # @param value [Object] Any valid value
153
+ # @return [Hash] Returns the value in the form of hash
154
+ def _to_hash(value)
155
+ if value.is_a?(Array)
156
+ value.compact.map { |v| _to_hash(v) }
157
+ elsif value.is_a?(Hash)
158
+ {}.tap do |hash|
159
+ value.each { |k, v| hash[k] = _to_hash(v) }
160
+ end
161
+ elsif value.respond_to? :to_hash
162
+ value.to_hash
163
+ else
164
+ value
165
+ end
166
+ end
167
+
168
+ def to_json(*a)
169
+ to_hash.to_json(*a)
170
+ end
171
+ end
172
+ end
173
+