aftership-tracking-sdk 7.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 (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,181 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class CustomEstimatedDeliveryDateTracking
5
+ # The format of the EDD. Either a single date or a date range.
6
+ # type?: String;
7
+ attr_accessor :type
8
+
9
+ # The specific EDD date.
10
+ # datetime?: String;
11
+ attr_accessor :datetime
12
+
13
+ # For a date range EDD format, the date for the lower end of the range.
14
+ # datetime_min?: String;
15
+ attr_accessor :datetime_min
16
+
17
+ # For a date range EDD format, the date for the upper end of the range.
18
+ # datetime_max?: String;
19
+ attr_accessor :datetime_max
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::CustomEstimatedDeliveryDateTracking` 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?(:'type')
33
+ self.type = attributes[:'type']
34
+ end
35
+
36
+ if attributes.key?(:'datetime')
37
+ self.datetime = attributes[:'datetime']
38
+ end
39
+
40
+ if attributes.key?(:'datetime_min')
41
+ self.datetime_min = attributes[:'datetime_min']
42
+ end
43
+
44
+ if attributes.key?(:'datetime_max')
45
+ self.datetime_max = attributes[:'datetime_max']
46
+ end
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'type' => :'String',
53
+ :'datetime' => :'String',
54
+ :'datetime_min' => :'String',
55
+ :'datetime_max' => :'String',
56
+ }
57
+ end
58
+
59
+ # Attribute mapping from ruby-style variable name to JSON key.
60
+ def self.attribute_map
61
+ {
62
+ :'type' => :'type',
63
+ :'datetime' => :'datetime',
64
+ :'datetime_min' => :'datetime_min',
65
+ :'datetime_max' => :'datetime_max',
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,139 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class CustomFieldsTrackingUpdateTrackingBySlugTrackingNumberRequest
5
+ # Initializes the object
6
+ # @param [Hash] attributes Model attributes in the form of hash
7
+ def initialize(attributes = {})
8
+ if (!attributes.is_a?(Hash))
9
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AftershipAPI::CustomFieldsTrackingUpdateTrackingBySlugTrackingNumberRequest` initialize method"
10
+ end
11
+
12
+ attributes = attributes.each_with_object({}) { |(k, v), h|
13
+ h[k.to_sym] = v
14
+ }
15
+ end
16
+
17
+ # Attribute type mapping.
18
+ def self.openapi_types
19
+ {}
20
+ end
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {}
25
+ end
26
+
27
+ # Builds the object from hash
28
+ # @param attributes [Hash] Model attributes in the form of hash
29
+ # @return [Object] Returns the model itself
30
+ def self.build_from_hash(attributes)
31
+ return nil unless attributes.is_a?(Hash)
32
+ attributes = attributes.transform_keys(&:to_sym)
33
+ transformed_hash = {}
34
+ openapi_types.each_pair do |key, type|
35
+ if attributes.key?(key) && attributes[key].nil?
36
+ transformed_hash["#{key}"] = nil
37
+ elsif type =~ /\AArray<(.*)>/i
38
+ # check to ensure the input is an array given that the attribute
39
+ # is documented as an array but the input is not
40
+ if attributes[key].is_a?(Array)
41
+ transformed_hash["#{key}"] = attributes[key].map { |v| _deserialize($1, v) }
42
+ end
43
+ elsif !attributes[key].nil?
44
+ transformed_hash["#{key}"] = _deserialize(type, attributes[key])
45
+ end
46
+ end
47
+ new(transformed_hash)
48
+ end
49
+
50
+ # Deserializes the data based on type
51
+ # @param type [String] Data type
52
+ # @param value [String] Value to be deserialized
53
+ # @return [Object] Deserialized data
54
+ def self._deserialize(type, value)
55
+ case type.to_sym
56
+ when :Time
57
+ Time.parse(value)
58
+ when :Date
59
+ Date.parse(value)
60
+ when :String
61
+ value.to_s
62
+ when :Integer
63
+ value.to_i
64
+ when :Float
65
+ value.to_f
66
+ when :Boolean
67
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
68
+ true
69
+ else
70
+ false
71
+ end
72
+ when :Object
73
+ # generic object (usually a Hash), return directly
74
+ value
75
+ when /\AArray<(?<inner_type>.+)>\z/
76
+ inner_type = Regexp.last_match[:inner_type]
77
+ value.map { |v| _deserialize(inner_type, v) }
78
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
79
+ k_type = Regexp.last_match[:k_type]
80
+ v_type = Regexp.last_match[:v_type]
81
+ {}.tap do |hash|
82
+ value.each do |k, v|
83
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
84
+ end
85
+ end
86
+ else # model
87
+ klass = AftershipAPI::Model.const_get(type)
88
+ klass.build_from_hash(value)
89
+ end
90
+ end
91
+
92
+ # Returns the string representation of the object
93
+ # @return [String] String presentation of the object
94
+ def to_s
95
+ to_hash.to_s
96
+ end
97
+
98
+ # to_body is an alias to to_hash (backward compatibility)
99
+ # @return [Hash] Returns the object in the form of hash
100
+ def to_body
101
+ to_hash
102
+ end
103
+
104
+ # Returns the object in the form of hash
105
+ # @return [Hash] Returns the object in the form of hash
106
+ def to_hash
107
+ hash = {}
108
+ self.class.attribute_map.each_pair do |attr, param|
109
+ value = self.send(attr)
110
+ next if value.nil?
111
+
112
+ hash[param] = _to_hash(value)
113
+ end
114
+ hash
115
+ end
116
+
117
+ # Outputs non-array value in the form of hash
118
+ # For object, use to_hash. Otherwise, just return the value
119
+ # @param value [Object] Any valid value
120
+ # @return [Hash] Returns the value in the form of hash
121
+ def _to_hash(value)
122
+ if value.is_a?(Array)
123
+ value.compact.map { |v| _to_hash(v) }
124
+ elsif value.is_a?(Hash)
125
+ {}.tap do |hash|
126
+ value.each { |k, v| hash[k] = _to_hash(v) }
127
+ end
128
+ elsif value.respond_to? :to_hash
129
+ value.to_hash
130
+ else
131
+ value
132
+ end
133
+ end
134
+
135
+ def to_json(*a)
136
+ to_hash.to_json(*a)
137
+ end
138
+ end
139
+ 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 DataCourierResponseV1
5
+ # Total count of courier objects
6
+ # total?: Integer;
7
+ attr_accessor :total
8
+
9
+ # Array of object.
10
+ # couriers?: Courier[];
11
+ attr_accessor :couriers
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::DataCourierResponseV1` 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?(:'total')
25
+ self.total = attributes[:'total']
26
+ end
27
+
28
+ if attributes.key?(:'couriers')
29
+ self.couriers = attributes[:'couriers']
30
+ end
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'total' => :'Integer',
37
+ :'couriers' => :'Array<Courier>',
38
+ }
39
+ end
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'total' => :'total',
45
+ :'couriers' => :'couriers',
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,151 @@
1
+ # This code was auto generated by AfterShip SDK Generator.
2
+ # Do not edit the class manually.
3
+ module AftershipAPI::Model
4
+ class DataNotificationResponseV1
5
+ # Object describes the notification information.
6
+ # notification?: Notification;
7
+ attr_accessor :notification
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::DataNotificationResponseV1` 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?(:'notification')
21
+ self.notification = attributes[:'notification']
22
+ end
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.openapi_types
27
+ {
28
+ :'notification' => :'Notification',
29
+ }
30
+ end
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'notification' => :'notification',
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