aftership-tracking-sdk 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +11 -0
  3. data/LICENSE +21 -0
  4. data/README.md +285 -0
  5. data/aftership-tracking-sdk.gemspec +27 -0
  6. data/lib/aftership-tracking-sdk/api/courier.rb +163 -0
  7. data/lib/aftership-tracking-sdk/api/estimated_delivery_date.rb +67 -0
  8. data/lib/aftership-tracking-sdk/api/last_checkpoint.rb +143 -0
  9. data/lib/aftership-tracking-sdk/api/notification.rb +403 -0
  10. data/lib/aftership-tracking-sdk/api/tracking.rb +793 -0
  11. data/lib/aftership-tracking-sdk/api_client.rb +426 -0
  12. data/lib/aftership-tracking-sdk/configuration.rb +122 -0
  13. data/lib/aftership-tracking-sdk/error.rb +125 -0
  14. data/lib/aftership-tracking-sdk/models/additional_fields_v1.rb +32 -0
  15. data/lib/aftership-tracking-sdk/models/aftership_estimated_delivery_date_tracking.rb +181 -0
  16. data/lib/aftership-tracking-sdk/models/carbon_emissions_tracking.rb +161 -0
  17. data/lib/aftership-tracking-sdk/models/checkpoint.rb +301 -0
  18. data/lib/aftership-tracking-sdk/models/coordinate_checkpoint.rb +161 -0
  19. data/lib/aftership-tracking-sdk/models/courier.rb +241 -0
  20. data/lib/aftership-tracking-sdk/models/courier_response_v1.rb +161 -0
  21. data/lib/aftership-tracking-sdk/models/custom_estimated_delivery_date_tracking.rb +181 -0
  22. data/lib/aftership-tracking-sdk/models/custom_fields_tracking_update_tracking_by_slug_tracking_number_request.rb +139 -0
  23. data/lib/aftership-tracking-sdk/models/data_courier_response_v1.rb +161 -0
  24. data/lib/aftership-tracking-sdk/models/data_notification_response_v1.rb +151 -0
  25. data/lib/aftership-tracking-sdk/models/data_tracking_delete_response_v1.rb +151 -0
  26. data/lib/aftership-tracking-sdk/models/data_tracking_response_get_multiple_v1.rb +281 -0
  27. data/lib/aftership-tracking-sdk/models/data_tracking_response_v1.rb +151 -0
  28. data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_request.rb +191 -0
  29. data/lib/aftership-tracking-sdk/models/destination_address_estimated_delivery_date_response.rb +191 -0
  30. data/lib/aftership-tracking-sdk/models/detect_courier_response.rb +161 -0
  31. data/lib/aftership-tracking-sdk/models/estimated_delivery_date_request.rb +221 -0
  32. data/lib/aftership-tracking-sdk/models/estimated_delivery_date_response.rb +261 -0
  33. data/lib/aftership-tracking-sdk/models/estimated_pickup_estimated_delivery_date_request.rb +181 -0
  34. data/lib/aftership-tracking-sdk/models/estimated_pickup_estimated_delivery_date_response.rb +191 -0
  35. data/lib/aftership-tracking-sdk/models/events_checkpoint.rb +161 -0
  36. data/lib/aftership-tracking-sdk/models/first_estimated_delivery_tracking.rb +191 -0
  37. data/lib/aftership-tracking-sdk/models/get_all_couriers_response.rb +161 -0
  38. data/lib/aftership-tracking-sdk/models/get_checkpoint_by_slug_tracking_number_response.rb +211 -0
  39. data/lib/aftership-tracking-sdk/models/get_checkpoint_by_tracking_id_response.rb +211 -0
  40. data/lib/aftership-tracking-sdk/models/get_trackings_response.rb +161 -0
  41. data/lib/aftership-tracking-sdk/models/get_user_couriers_response.rb +161 -0
  42. data/lib/aftership-tracking-sdk/models/latest_estimated_delivery_tracking.rb +191 -0
  43. data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_id_request.rb +151 -0
  44. data/lib/aftership-tracking-sdk/models/mark_tracking_completed_by_slug_tracking_number_request.rb +151 -0
  45. data/lib/aftership-tracking-sdk/models/meta_v1.rb +171 -0
  46. data/lib/aftership-tracking-sdk/models/next_couriers_tracking.rb +171 -0
  47. data/lib/aftership-tracking-sdk/models/next_couriers_tracking_create_tracking_request.rb +161 -0
  48. data/lib/aftership-tracking-sdk/models/notification.rb +161 -0
  49. data/lib/aftership-tracking-sdk/models/notification_request_v1.rb +161 -0
  50. data/lib/aftership-tracking-sdk/models/notification_response_v1.rb +161 -0
  51. data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_estimated_delivery_date_request.rb +161 -0
  52. data/lib/aftership-tracking-sdk/models/order_processing_time_estimated_pickup_estimated_delivery_date_response.rb +161 -0
  53. data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_request.rb +191 -0
  54. data/lib/aftership-tracking-sdk/models/origin_address_estimated_delivery_date_response.rb +191 -0
  55. data/lib/aftership-tracking-sdk/models/pagination.rb +156 -0
  56. data/lib/aftership-tracking-sdk/models/partial_delete_tracking.rb +241 -0
  57. data/lib/aftership-tracking-sdk/models/partial_update_tracking.rb +251 -0
  58. data/lib/aftership-tracking-sdk/models/predict_batch_request.rb +151 -0
  59. data/lib/aftership-tracking-sdk/models/predict_batch_response.rb +151 -0
  60. data/lib/aftership-tracking-sdk/models/reason_events_checkpoint.rb +151 -0
  61. data/lib/aftership-tracking-sdk/models/slug_group_v1.rb +37 -0
  62. data/lib/aftership-tracking-sdk/models/tag_v1.rb +34 -0
  63. data/lib/aftership-tracking-sdk/models/tracking.rb +921 -0
  64. data/lib/aftership-tracking-sdk/models/tracking_create_tracking_request.rb +551 -0
  65. data/lib/aftership-tracking-sdk/models/tracking_delete_response_v1.rb +161 -0
  66. data/lib/aftership-tracking-sdk/models/tracking_detect_courier_request.rb +261 -0
  67. data/lib/aftership-tracking-sdk/models/tracking_response_get_multiple_v1.rb +161 -0
  68. data/lib/aftership-tracking-sdk/models/tracking_response_v1.rb +161 -0
  69. data/lib/aftership-tracking-sdk/models/tracking_update_tracking_by_id_request.rb +501 -0
  70. data/lib/aftership-tracking-sdk/models/tracking_update_tracking_by_slug_tracking_number_request.rb +391 -0
  71. data/lib/aftership-tracking-sdk/models/weight_estimated_delivery_date_request.rb +161 -0
  72. data/lib/aftership-tracking-sdk/models/weight_estimated_delivery_date_response.rb +161 -0
  73. data/lib/aftership-tracking-sdk/sign_string.rb +77 -0
  74. data/lib/aftership-tracking-sdk/version.rb +5 -0
  75. data/lib/aftership-tracking-sdk.rb +47 -0
  76. metadata +157 -0
@@ -0,0 +1,191 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class OriginAddressEstimatedDeliveryDateRequest
5
+ # The country/region of the origin location from where the package is picked up by the carrier to be delivered to the final destination. Use 3 letters of ISO 3166-1 country/region code.
6
+ # country: String;
7
+ attr_accessor :country
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.
10
+ # state?: String;
11
+ attr_accessor :state
12
+
13
+ # City of the origin address. Use 3 letters of ISO 3166-1 country/region code for countries/regions without City.
14
+ # city?: String;
15
+ attr_accessor :city
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.
18
+ # postal_code?: String;
19
+ attr_accessor :postal_code
20
+
21
+ # Raw location of the origin address. A raw address will help AI to identify the accurate location of the origin address.
22
+ # raw_location?: String;
23
+ attr_accessor :raw_location
24
+
25
+ # Initializes the object
26
+ # @param [Hash] attributes Model attributes in the form of hash
27
+ def initialize(attributes = {})
28
+ if (!attributes.is_a?(Hash))
29
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::OriginAddressEstimatedDeliveryDateRequest` initialize method"
30
+ end
31
+
32
+ attributes = attributes.each_with_object({}) { |(k, v), h|
33
+ h[k.to_sym] = v
34
+ }
35
+
36
+ if attributes.key?(:'country')
37
+ self.country = attributes[:'country']
38
+ end
39
+
40
+ if attributes.key?(:'state')
41
+ self.state = attributes[:'state']
42
+ end
43
+
44
+ if attributes.key?(:'city')
45
+ self.city = attributes[:'city']
46
+ end
47
+
48
+ if attributes.key?(:'postal_code')
49
+ self.postal_code = attributes[:'postal_code']
50
+ end
51
+
52
+ if attributes.key?(:'raw_location')
53
+ self.raw_location = attributes[:'raw_location']
54
+ end
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.openapi_types
59
+ {
60
+ :'country' => :'String',
61
+ :'state' => :'String',
62
+ :'city' => :'String',
63
+ :'postal_code' => :'String',
64
+ :'raw_location' => :'String',
65
+ }
66
+ end
67
+
68
+ # Attribute mapping from ruby-style variable name to JSON key.
69
+ def self.attribute_map
70
+ {
71
+ :'country' => :'country',
72
+ :'state' => :'state',
73
+ :'city' => :'city',
74
+ :'postal_code' => :'postal_code',
75
+ :'raw_location' => :'raw_location',
76
+ }
77
+ end
78
+
79
+ # Builds the object from hash
80
+ # @param attributes [Hash] Model attributes in the form of hash
81
+ # @return [Object] Returns the model itself
82
+ def self.build_from_hash(attributes)
83
+ return nil unless attributes.is_a?(Hash)
84
+ attributes = attributes.transform_keys(&:to_sym)
85
+ transformed_hash = {}
86
+ openapi_types.each_pair do |key, type|
87
+ if attributes.key?(key) && attributes[key].nil?
88
+ transformed_hash["#{key}"] = nil
89
+ elsif type =~ /\AArray<(.*)>/i
90
+ # check to ensure the input is an array given that the attribute
91
+ # is documented as an array but the input is not
92
+ if attributes[key].is_a?(Array)
93
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
94
+ end
95
+ elsif !attributes[key].nil?
96
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
97
+ end
98
+ end
99
+ new(transformed_hash)
100
+ end
101
+
102
+ # Deserializes the data based on type
103
+ # @param type [String] Data type
104
+ # @param value [String] Value to be deserialized
105
+ # @return [Object] Deserialized data
106
+ def self._deserialize(type, value)
107
+ case type.to_sym
108
+ when :Time
109
+ Time.parse(value)
110
+ when :Date
111
+ Date.parse(value)
112
+ when :String
113
+ value.to_s
114
+ when :Integer
115
+ value.to_i
116
+ when :Float
117
+ value.to_f
118
+ when :Boolean
119
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
120
+ true
121
+ else
122
+ false
123
+ end
124
+ when :Object
125
+ # generic object (usually a Hash), return directly
126
+ value
127
+ when /\AArray<(?<inner_type>.+)>\z/
128
+ inner_type = Regexp.last_match[:inner_type]
129
+ value.map { |v| _deserialize(inner_type, v) }
130
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
131
+ k_type = Regexp.last_match[:k_type]
132
+ v_type = Regexp.last_match[:v_type]
133
+ {}.tap do |hash|
134
+ value.each do |k, v|
135
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
136
+ end
137
+ end
138
+ else # model
139
+ klass = AftershipAPI::Model.const_get(type)
140
+ klass.build_from_hash(value)
141
+ end
142
+ end
143
+
144
+ # Returns the string representation of the object
145
+ # @return [String] String presentation of the object
146
+ def to_s
147
+ to_hash.to_s
148
+ end
149
+
150
+ # to_body is an alias to to_hash (backward compatibility)
151
+ # @return [Hash] Returns the object in the form of hash
152
+ def to_body
153
+ to_hash
154
+ end
155
+
156
+ # Returns the object in the form of hash
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_hash
159
+ hash = {}
160
+ self.class.attribute_map.each_pair do |attr, param|
161
+ value = self.send(attr)
162
+ next if value.nil?
163
+
164
+ hash[param] = _to_hash(value)
165
+ end
166
+ hash
167
+ end
168
+
169
+ # Outputs non-array value in the form of hash
170
+ # For object, use to_hash. Otherwise, just return the value
171
+ # @param value [Object] Any valid value
172
+ # @return [Hash] Returns the value in the form of hash
173
+ def _to_hash(value)
174
+ if value.is_a?(Array)
175
+ value.compact.map { |v| _to_hash(v) }
176
+ elsif value.is_a?(Hash)
177
+ {}.tap do |hash|
178
+ value.each { |k, v| hash[k] = _to_hash(v) }
179
+ end
180
+ elsif value.respond_to? :to_hash
181
+ value.to_hash
182
+ else
183
+ value
184
+ end
185
+ end
186
+
187
+ def to_json(*a)
188
+ to_hash.to_json(*a)
189
+ end
190
+ end
191
+ end
@@ -0,0 +1,191 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class OriginAddressEstimatedDeliveryDateResponse
5
+ # The country/region of the origin location from where the package is picked up by the carrier to be delivered to the final destination. Use 3 letters of ISO 3166-1 country/region code.
6
+ # country: String;
7
+ attr_accessor :country
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.
10
+ # state?: String;
11
+ attr_accessor :state
12
+
13
+ # City of the origin address. Use 3 letters of ISO 3166-1 country/region code for countries/regions without City.
14
+ # city?: String;
15
+ attr_accessor :city
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.
18
+ # postal_code?: String;
19
+ attr_accessor :postal_code
20
+
21
+ # Raw location of the origin address. A raw address will help AI to identify the accurate location of the origin address.
22
+ # raw_location?: String;
23
+ attr_accessor :raw_location
24
+
25
+ # Initializes the object
26
+ # @param [Hash] attributes Model attributes in the form of hash
27
+ def initialize(attributes = {})
28
+ if (!attributes.is_a?(Hash))
29
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::OriginAddressEstimatedDeliveryDateResponse` initialize method"
30
+ end
31
+
32
+ attributes = attributes.each_with_object({}) { |(k, v), h|
33
+ h[k.to_sym] = v
34
+ }
35
+
36
+ if attributes.key?(:'country')
37
+ self.country = attributes[:'country']
38
+ end
39
+
40
+ if attributes.key?(:'state')
41
+ self.state = attributes[:'state']
42
+ end
43
+
44
+ if attributes.key?(:'city')
45
+ self.city = attributes[:'city']
46
+ end
47
+
48
+ if attributes.key?(:'postal_code')
49
+ self.postal_code = attributes[:'postal_code']
50
+ end
51
+
52
+ if attributes.key?(:'raw_location')
53
+ self.raw_location = attributes[:'raw_location']
54
+ end
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.openapi_types
59
+ {
60
+ :'country' => :'String',
61
+ :'state' => :'String',
62
+ :'city' => :'String',
63
+ :'postal_code' => :'String',
64
+ :'raw_location' => :'String',
65
+ }
66
+ end
67
+
68
+ # Attribute mapping from ruby-style variable name to JSON key.
69
+ def self.attribute_map
70
+ {
71
+ :'country' => :'country',
72
+ :'state' => :'state',
73
+ :'city' => :'city',
74
+ :'postal_code' => :'postal_code',
75
+ :'raw_location' => :'raw_location',
76
+ }
77
+ end
78
+
79
+ # Builds the object from hash
80
+ # @param attributes [Hash] Model attributes in the form of hash
81
+ # @return [Object] Returns the model itself
82
+ def self.build_from_hash(attributes)
83
+ return nil unless attributes.is_a?(Hash)
84
+ attributes = attributes.transform_keys(&:to_sym)
85
+ transformed_hash = {}
86
+ openapi_types.each_pair do |key, type|
87
+ if attributes.key?(key) && attributes[key].nil?
88
+ transformed_hash["#{key}"] = nil
89
+ elsif type =~ /\AArray<(.*)>/i
90
+ # check to ensure the input is an array given that the attribute
91
+ # is documented as an array but the input is not
92
+ if attributes[key].is_a?(Array)
93
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
94
+ end
95
+ elsif !attributes[key].nil?
96
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
97
+ end
98
+ end
99
+ new(transformed_hash)
100
+ end
101
+
102
+ # Deserializes the data based on type
103
+ # @param type [String] Data type
104
+ # @param value [String] Value to be deserialized
105
+ # @return [Object] Deserialized data
106
+ def self._deserialize(type, value)
107
+ case type.to_sym
108
+ when :Time
109
+ Time.parse(value)
110
+ when :Date
111
+ Date.parse(value)
112
+ when :String
113
+ value.to_s
114
+ when :Integer
115
+ value.to_i
116
+ when :Float
117
+ value.to_f
118
+ when :Boolean
119
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
120
+ true
121
+ else
122
+ false
123
+ end
124
+ when :Object
125
+ # generic object (usually a Hash), return directly
126
+ value
127
+ when /\AArray<(?<inner_type>.+)>\z/
128
+ inner_type = Regexp.last_match[:inner_type]
129
+ value.map { |v| _deserialize(inner_type, v) }
130
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
131
+ k_type = Regexp.last_match[:k_type]
132
+ v_type = Regexp.last_match[:v_type]
133
+ {}.tap do |hash|
134
+ value.each do |k, v|
135
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
136
+ end
137
+ end
138
+ else # model
139
+ klass = AftershipAPI::Model.const_get(type)
140
+ klass.build_from_hash(value)
141
+ end
142
+ end
143
+
144
+ # Returns the string representation of the object
145
+ # @return [String] String presentation of the object
146
+ def to_s
147
+ to_hash.to_s
148
+ end
149
+
150
+ # to_body is an alias to to_hash (backward compatibility)
151
+ # @return [Hash] Returns the object in the form of hash
152
+ def to_body
153
+ to_hash
154
+ end
155
+
156
+ # Returns the object in the form of hash
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_hash
159
+ hash = {}
160
+ self.class.attribute_map.each_pair do |attr, param|
161
+ value = self.send(attr)
162
+ next if value.nil?
163
+
164
+ hash[param] = _to_hash(value)
165
+ end
166
+ hash
167
+ end
168
+
169
+ # Outputs non-array value in the form of hash
170
+ # For object, use to_hash. Otherwise, just return the value
171
+ # @param value [Object] Any valid value
172
+ # @return [Hash] Returns the value in the form of hash
173
+ def _to_hash(value)
174
+ if value.is_a?(Array)
175
+ value.compact.map { |v| _to_hash(v) }
176
+ elsif value.is_a?(Hash)
177
+ {}.tap do |hash|
178
+ value.each { |k, v| hash[k] = _to_hash(v) }
179
+ end
180
+ elsif value.respond_to? :to_hash
181
+ value.to_hash
182
+ else
183
+ value
184
+ end
185
+ end
186
+
187
+ def to_json(*a)
188
+ to_hash.to_json(*a)
189
+ end
190
+ end
191
+ end
@@ -0,0 +1,156 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class Pagination
5
+ attr_accessor :total, :page, :limit, :has_next_page
6
+ # Initializes the object
7
+ # @param attributes [Hash] Model attributes in the form of hash
8
+ def initialize(attributes = {})
9
+ if (!attributes.is_a?(Hash))
10
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::Pagination` initialize method"
11
+ end
12
+
13
+ attributes = attributes.each_with_object({}) { |(k, v), h|
14
+ h[k.to_sym] = v
15
+ }
16
+
17
+ if attributes.key?(:'total')
18
+ self.total = attributes[:'total']
19
+ end
20
+
21
+ if attributes.key?(:'page')
22
+ self.page = attributes[:'page']
23
+ end
24
+
25
+ if attributes.key?(:'limit')
26
+ self.limit = attributes[:'limit']
27
+ end
28
+
29
+ if attributes.key?(:'has_next_page')
30
+ self.has_next_page = attributes[:'has_next_page']
31
+ end
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'total' => :'Integer',
38
+ :'page' => :'Integer',
39
+ :'limit' => :'Integer',
40
+ :'has_next_page' => :'Boolean'
41
+ }
42
+ end
43
+
44
+ # Builds the object from hash
45
+ # @param attributes [Hash] Model attributes in the form of hash
46
+ # @return [Object] Returns the model itself
47
+ def self.build_from_hash(attributes)
48
+ return nil unless attributes.is_a?(Hash)
49
+ attributes = attributes.transform_keys(&:to_sym)
50
+ transformed_hash = {}
51
+ openapi_types.each_pair do |key, type|
52
+ if attributes.key?(key) && attributes[key].nil?
53
+ transformed_hash["#{key}"] = nil
54
+ elsif type =~ /\AArray<(.*)>/i
55
+ # check to ensure the input is an array given that the attribute
56
+ # is documented as an array but the input is not
57
+ if attributes[key].is_a?(Array)
58
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
59
+ end
60
+ elsif !attributes[key].nil?
61
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
62
+ end
63
+ end
64
+ new(transformed_hash)
65
+ end
66
+
67
+ # Deserializes the data based on type
68
+ # @param type [String] Data type
69
+ # @param value [String] Value to be deserialized
70
+ # @return [Object] Deserialized data
71
+ def self._deserialize(type, value)
72
+ case type.to_sym
73
+ when :Time
74
+ Time.parse(value)
75
+ when :Date
76
+ Date.parse(value)
77
+ when :String
78
+ value.to_s
79
+ when :Integer
80
+ value.to_i
81
+ when :Float
82
+ value.to_f
83
+ when :Boolean
84
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
85
+ true
86
+ else
87
+ false
88
+ end
89
+ when :Object
90
+ # generic object (usually a Hash), return directly
91
+ value
92
+ when /\AArray<(?<inner_type>.+)>\z/
93
+ inner_type = Regexp.last_match[:inner_type]
94
+ value.map { |v| _deserialize(inner_type, v) }
95
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
96
+ k_type = Regexp.last_match[:k_type]
97
+ v_type = Regexp.last_match[:v_type]
98
+ {}.tap do |hash|
99
+ value.each do |k, v|
100
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
101
+ end
102
+ end
103
+ else # model
104
+ klass = AftershipAPI::Model.const_get(type)
105
+ klass.build_from_hash(value)
106
+ end
107
+ end
108
+
109
+ # Returns the string representation of the object
110
+ # @return [String] String presentation of the object
111
+ def to_s
112
+ to_hash.to_s
113
+ end
114
+
115
+ # to_body is an alias to to_hash (backward compatibility)
116
+ # @return [Hash] Returns the object in the form of hash
117
+ def to_body
118
+ to_hash
119
+ end
120
+
121
+ # Returns the object in the form of hash
122
+ # @return [Hash] Returns the object in the form of hash
123
+ def to_hash
124
+ hash = {}
125
+ self.class.openapi_types.each_pair do |attr, param|
126
+ value = self.send(attr)
127
+ next if value.nil?
128
+
129
+ hash[attr] = _to_hash(value)
130
+ end
131
+ hash
132
+ end
133
+
134
+ # Outputs non-array value in the form of hash
135
+ # For object, use to_hash. Otherwise, just return the value
136
+ # @param value [Object] Any valid value
137
+ # @return [Hash] Returns the value in the form of hash
138
+ def _to_hash(value)
139
+ if value.is_a?(Array)
140
+ value.compact.map { |v| _to_hash(v) }
141
+ elsif value.is_a?(Hash)
142
+ {}.tap do |hash|
143
+ value.each { |k, v| hash[k] = _to_hash(v) }
144
+ end
145
+ elsif value.respond_to? :to_hash
146
+ value.to_hash
147
+ else
148
+ value
149
+ end
150
+ end
151
+
152
+ def to_json(*a)
153
+ to_hash.to_json(*a)
154
+ end
155
+ end
156
+ end