onesignal 5.2.0.pre.beta1 → 5.3.0.pre.beta1

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 (165) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -5
  3. data/docs/ApiKeyToken.md +28 -0
  4. data/docs/ApiKeyTokensListResponse.md +18 -0
  5. data/docs/CopyTemplateRequest.md +18 -0
  6. data/docs/CreateApiKeyRequest.md +22 -0
  7. data/docs/CreateApiKeyResponse.md +20 -0
  8. data/docs/CreateTemplateRequest.md +32 -0
  9. data/docs/CustomEvent.md +26 -0
  10. data/docs/CustomEventsRequest.md +18 -0
  11. data/docs/DefaultApi.md +1132 -110
  12. data/docs/NotificationWithMeta.md +3 -1
  13. data/docs/NotificationWithMetaAllOf.md +3 -1
  14. data/docs/StartLiveActivityRequest.md +48 -0
  15. data/docs/StartLiveActivitySuccessResponse.md +18 -0
  16. data/docs/TemplateResource.md +28 -0
  17. data/docs/TemplatesListResponse.md +18 -0
  18. data/docs/UpdateApiKeyRequest.md +22 -0
  19. data/docs/UpdateTemplateRequest.md +30 -0
  20. data/lib/onesignal/api/default_api.rb +1043 -1
  21. data/lib/onesignal/api_client.rb +2 -2
  22. data/lib/onesignal/api_error.rb +1 -1
  23. data/lib/onesignal/configuration.rb +1 -1
  24. data/lib/onesignal/models/api_key_token.rb +300 -0
  25. data/lib/onesignal/models/api_key_tokens_list_response.rb +221 -0
  26. data/lib/onesignal/models/app.rb +1 -1
  27. data/lib/onesignal/models/basic_notification.rb +1 -1
  28. data/lib/onesignal/models/basic_notification_all_of.rb +1 -1
  29. data/lib/onesignal/models/basic_notification_all_of_android_background_layout.rb +1 -1
  30. data/lib/onesignal/models/button.rb +1 -1
  31. data/lib/onesignal/models/copy_template_request.rb +225 -0
  32. data/lib/onesignal/models/create_api_key_request.rb +273 -0
  33. data/lib/onesignal/models/create_api_key_response.rb +228 -0
  34. data/lib/onesignal/models/create_notification_success_response.rb +1 -1
  35. data/lib/onesignal/models/create_segment_conflict_response.rb +1 -1
  36. data/lib/onesignal/models/create_segment_success_response.rb +1 -1
  37. data/lib/onesignal/models/create_template_request.rb +307 -0
  38. data/lib/onesignal/models/create_user_conflict_response.rb +1 -1
  39. data/lib/onesignal/models/create_user_conflict_response_errors_inner.rb +1 -1
  40. data/lib/onesignal/models/create_user_conflict_response_errors_items_meta.rb +1 -1
  41. data/lib/onesignal/models/custom_event.rb +269 -0
  42. data/lib/onesignal/models/custom_events_request.rb +226 -0
  43. data/lib/onesignal/models/delivery_data.rb +1 -1
  44. data/lib/onesignal/models/export_events_success_response.rb +1 -1
  45. data/lib/onesignal/models/export_subscriptions_request_body.rb +1 -1
  46. data/lib/onesignal/models/export_subscriptions_success_response.rb +1 -1
  47. data/lib/onesignal/models/filter.rb +1 -1
  48. data/lib/onesignal/models/filter_expression.rb +1 -1
  49. data/lib/onesignal/models/generic_error.rb +1 -1
  50. data/lib/onesignal/models/generic_success_bool_response.rb +1 -1
  51. data/lib/onesignal/models/get_notification_history_request_body.rb +1 -1
  52. data/lib/onesignal/models/get_segments_success_response.rb +1 -1
  53. data/lib/onesignal/models/language_string_map.rb +1 -1
  54. data/lib/onesignal/models/notification.rb +1 -1
  55. data/lib/onesignal/models/notification_all_of.rb +1 -1
  56. data/lib/onesignal/models/notification_history_success_response.rb +1 -1
  57. data/lib/onesignal/models/notification_slice.rb +1 -1
  58. data/lib/onesignal/models/notification_target.rb +1 -1
  59. data/lib/onesignal/models/notification_with_meta.rb +15 -5
  60. data/lib/onesignal/models/notification_with_meta_all_of.rb +16 -6
  61. data/lib/onesignal/models/operator.rb +1 -1
  62. data/lib/onesignal/models/outcome_data.rb +1 -1
  63. data/lib/onesignal/models/outcomes_data.rb +1 -1
  64. data/lib/onesignal/models/platform_delivery_data.rb +1 -1
  65. data/lib/onesignal/models/platform_delivery_data_email_all_of.rb +1 -1
  66. data/lib/onesignal/models/platform_delivery_data_sms_all_of.rb +1 -1
  67. data/lib/onesignal/models/properties_body.rb +1 -1
  68. data/lib/onesignal/models/properties_deltas.rb +1 -1
  69. data/lib/onesignal/models/properties_object.rb +1 -1
  70. data/lib/onesignal/models/purchase.rb +1 -1
  71. data/lib/onesignal/models/rate_limit_error.rb +1 -1
  72. data/lib/onesignal/models/segment.rb +1 -1
  73. data/lib/onesignal/models/segment_data.rb +1 -1
  74. data/lib/onesignal/models/segment_notification_target.rb +1 -1
  75. data/lib/onesignal/models/start_live_activity_request.rb +454 -0
  76. data/lib/onesignal/models/start_live_activity_success_response.rb +219 -0
  77. data/lib/onesignal/models/subscription.rb +1 -1
  78. data/lib/onesignal/models/subscription_body.rb +1 -1
  79. data/lib/onesignal/models/subscription_notification_target.rb +1 -1
  80. data/lib/onesignal/models/template_resource.rb +302 -0
  81. data/lib/onesignal/models/templates_list_response.rb +221 -0
  82. data/lib/onesignal/models/transfer_subscription_request_body.rb +1 -1
  83. data/lib/onesignal/models/update_api_key_request.rb +273 -0
  84. data/lib/onesignal/models/update_live_activity_request.rb +1 -1
  85. data/lib/onesignal/models/update_live_activity_success_response.rb +1 -1
  86. data/lib/onesignal/models/update_template_request.rb +282 -0
  87. data/lib/onesignal/models/update_user_request.rb +1 -1
  88. data/lib/onesignal/models/user.rb +1 -1
  89. data/lib/onesignal/models/user_identity_body.rb +1 -1
  90. data/lib/onesignal/models/web_button.rb +1 -1
  91. data/lib/onesignal/version.rb +2 -2
  92. data/lib/onesignal.rb +15 -1
  93. data/onesignal.gemspec +1 -1
  94. data/spec/api/default_api_spec.rb +189 -1
  95. data/spec/api_client_spec.rb +1 -1
  96. data/spec/configuration_spec.rb +1 -1
  97. data/spec/models/api_key_token_spec.rb +68 -0
  98. data/spec/models/api_key_tokens_list_response_spec.rb +34 -0
  99. data/spec/models/app_spec.rb +1 -1
  100. data/spec/models/basic_notification_all_of_android_background_layout_spec.rb +1 -1
  101. data/spec/models/basic_notification_all_of_spec.rb +1 -1
  102. data/spec/models/basic_notification_spec.rb +1 -1
  103. data/spec/models/button_spec.rb +1 -1
  104. data/spec/models/copy_template_request_spec.rb +34 -0
  105. data/spec/models/create_api_key_request_spec.rb +50 -0
  106. data/spec/models/create_api_key_response_spec.rb +40 -0
  107. data/spec/models/create_notification_success_response_spec.rb +1 -1
  108. data/spec/models/create_segment_conflict_response_spec.rb +1 -1
  109. data/spec/models/create_segment_success_response_spec.rb +1 -1
  110. data/spec/models/create_template_request_spec.rb +76 -0
  111. data/spec/models/create_user_conflict_response_errors_inner_spec.rb +1 -1
  112. data/spec/models/create_user_conflict_response_errors_items_meta_spec.rb +1 -1
  113. data/spec/models/create_user_conflict_response_spec.rb +1 -1
  114. data/spec/models/custom_event_spec.rb +58 -0
  115. data/spec/models/custom_events_request_spec.rb +34 -0
  116. data/spec/models/delivery_data_spec.rb +1 -1
  117. data/spec/models/export_events_success_response_spec.rb +1 -1
  118. data/spec/models/export_subscriptions_request_body_spec.rb +1 -1
  119. data/spec/models/export_subscriptions_success_response_spec.rb +1 -1
  120. data/spec/models/filter_expression_spec.rb +1 -1
  121. data/spec/models/filter_spec.rb +1 -1
  122. data/spec/models/generic_error_spec.rb +1 -1
  123. data/spec/models/generic_success_bool_response_spec.rb +1 -1
  124. data/spec/models/get_notification_history_request_body_spec.rb +1 -1
  125. data/spec/models/get_segments_success_response_spec.rb +1 -1
  126. data/spec/models/language_string_map_spec.rb +1 -1
  127. data/spec/models/notification_all_of_spec.rb +1 -1
  128. data/spec/models/notification_history_success_response_spec.rb +1 -1
  129. data/spec/models/notification_slice_spec.rb +1 -1
  130. data/spec/models/notification_spec.rb +1 -1
  131. data/spec/models/notification_target_spec.rb +1 -1
  132. data/spec/models/notification_with_meta_all_of_spec.rb +7 -1
  133. data/spec/models/notification_with_meta_spec.rb +7 -1
  134. data/spec/models/operator_spec.rb +1 -1
  135. data/spec/models/outcome_data_spec.rb +1 -1
  136. data/spec/models/outcomes_data_spec.rb +1 -1
  137. data/spec/models/platform_delivery_data_email_all_of_spec.rb +1 -1
  138. data/spec/models/platform_delivery_data_sms_all_of_spec.rb +1 -1
  139. data/spec/models/platform_delivery_data_spec.rb +1 -1
  140. data/spec/models/properties_body_spec.rb +1 -1
  141. data/spec/models/properties_deltas_spec.rb +1 -1
  142. data/spec/models/properties_object_spec.rb +1 -1
  143. data/spec/models/purchase_spec.rb +1 -1
  144. data/spec/models/rate_limit_error_spec.rb +1 -1
  145. data/spec/models/segment_data_spec.rb +1 -1
  146. data/spec/models/segment_notification_target_spec.rb +1 -1
  147. data/spec/models/segment_spec.rb +1 -1
  148. data/spec/models/start_live_activity_request_spec.rb +128 -0
  149. data/spec/models/start_live_activity_success_response_spec.rb +34 -0
  150. data/spec/models/subscription_body_spec.rb +1 -1
  151. data/spec/models/subscription_notification_target_spec.rb +1 -1
  152. data/spec/models/subscription_spec.rb +1 -1
  153. data/spec/models/template_resource_spec.rb +68 -0
  154. data/spec/models/templates_list_response_spec.rb +34 -0
  155. data/spec/models/transfer_subscription_request_body_spec.rb +1 -1
  156. data/spec/models/update_api_key_request_spec.rb +50 -0
  157. data/spec/models/update_live_activity_request_spec.rb +1 -1
  158. data/spec/models/update_live_activity_success_response_spec.rb +1 -1
  159. data/spec/models/update_template_request_spec.rb +70 -0
  160. data/spec/models/update_user_request_spec.rb +1 -1
  161. data/spec/models/user_identity_body_spec.rb +1 -1
  162. data/spec/models/user_spec.rb +1 -1
  163. data/spec/models/web_button_spec.rb +1 -1
  164. data/spec/spec_helper.rb +1 -1
  165. metadata +57 -1
@@ -0,0 +1,302 @@
1
+ =begin
2
+ #OneSignal
3
+
4
+ #A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
5
+
6
+ The version of the OpenAPI document: 5.3.0
7
+ Contact: devrel@onesignal.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OneSignal
17
+ class TemplateResource
18
+ attr_accessor :id
19
+
20
+ attr_accessor :name
21
+
22
+ attr_accessor :created_at
23
+
24
+ attr_accessor :updated_at
25
+
26
+ attr_accessor :channel
27
+
28
+ # Rendered content and channel/platform flags for the template.
29
+ attr_accessor :content
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'id' => :'id',
57
+ :'name' => :'name',
58
+ :'created_at' => :'created_at',
59
+ :'updated_at' => :'updated_at',
60
+ :'channel' => :'channel',
61
+ :'content' => :'content'
62
+ }
63
+ end
64
+
65
+ # Returns all the JSON keys this model knows about
66
+ def self.acceptable_attributes
67
+ attribute_map.values
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.openapi_types
72
+ {
73
+ :'id' => :'String',
74
+ :'name' => :'String',
75
+ :'created_at' => :'Time',
76
+ :'updated_at' => :'Time',
77
+ :'channel' => :'String',
78
+ :'content' => :'Hash<String, Object>'
79
+ }
80
+ end
81
+
82
+ # List of attributes with nullable: true
83
+ def self.openapi_nullable
84
+ Set.new([
85
+ :'channel',
86
+ ])
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ if (!attributes.is_a?(Hash))
93
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::TemplateResource` initialize method"
94
+ end
95
+
96
+ # check to see if the attribute exists and convert string to symbol for hash key
97
+ attributes = attributes.each_with_object({}) { |(k, v), h|
98
+ if (!self.class.attribute_map.key?(k.to_sym))
99
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::TemplateResource`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
100
+ end
101
+ h[k.to_sym] = v
102
+ }
103
+
104
+ if attributes.key?(:'id')
105
+ self.id = attributes[:'id']
106
+ end
107
+
108
+ if attributes.key?(:'name')
109
+ self.name = attributes[:'name']
110
+ end
111
+
112
+ if attributes.key?(:'created_at')
113
+ self.created_at = attributes[:'created_at']
114
+ end
115
+
116
+ if attributes.key?(:'updated_at')
117
+ self.updated_at = attributes[:'updated_at']
118
+ end
119
+
120
+ if attributes.key?(:'channel')
121
+ self.channel = attributes[:'channel']
122
+ end
123
+
124
+ if attributes.key?(:'content')
125
+ if (value = attributes[:'content']).is_a?(Hash)
126
+ self.content = value
127
+ end
128
+ end
129
+ end
130
+
131
+ # Show invalid properties with the reasons. Usually used together with valid?
132
+ # @return Array for valid properties with the reasons
133
+ def list_invalid_properties
134
+ invalid_properties = Array.new
135
+ invalid_properties
136
+ end
137
+
138
+ # Check to see if the all the properties in the model are valid
139
+ # @return true if the model is valid
140
+ def valid?
141
+ channel_validator = EnumAttributeValidator.new('String', ["push", "email", "sms"])
142
+ return false unless channel_validator.valid?(@channel)
143
+ true
144
+ end
145
+
146
+ # Custom attribute writer method checking allowed values (enum).
147
+ # @param [Object] channel Object to be assigned
148
+ def channel=(channel)
149
+ validator = EnumAttributeValidator.new('String', ["push", "email", "sms"])
150
+ unless validator.valid?(channel)
151
+ fail ArgumentError, "invalid value for \"channel\", must be one of #{validator.allowable_values}."
152
+ end
153
+ @channel = channel
154
+ end
155
+
156
+ # Checks equality by comparing each attribute.
157
+ # @param [Object] Object to be compared
158
+ def ==(o)
159
+ return true if self.equal?(o)
160
+ self.class == o.class &&
161
+ id == o.id &&
162
+ name == o.name &&
163
+ created_at == o.created_at &&
164
+ updated_at == o.updated_at &&
165
+ channel == o.channel &&
166
+ content == o.content
167
+ end
168
+
169
+ # @see the `==` method
170
+ # @param [Object] Object to be compared
171
+ def eql?(o)
172
+ self == o
173
+ end
174
+
175
+ # Calculates hash code according to all attributes.
176
+ # @return [Integer] Hash code
177
+ def hash
178
+ [id, name, created_at, updated_at, channel, content].hash
179
+ end
180
+
181
+ # Builds the object from hash
182
+ # @param [Hash] attributes Model attributes in the form of hash
183
+ # @return [Object] Returns the model itself
184
+ def self.build_from_hash(attributes)
185
+ new.build_from_hash(attributes)
186
+ end
187
+
188
+ # Builds the object from hash
189
+ # @param [Hash] attributes Model attributes in the form of hash
190
+ # @return [Object] Returns the model itself
191
+ def build_from_hash(attributes)
192
+ return nil unless attributes.is_a?(Hash)
193
+ attributes = attributes.transform_keys(&:to_sym)
194
+ self.class.openapi_types.each_pair do |key, type|
195
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
196
+ self.send("#{key}=", nil)
197
+ elsif type =~ /\AArray<(.*)>/i
198
+ # check to ensure the input is an array given that the attribute
199
+ # is documented as an array but the input is not
200
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
201
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
202
+ end
203
+ elsif !attributes[self.class.attribute_map[key]].nil?
204
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
205
+ end
206
+ end
207
+
208
+ self
209
+ end
210
+
211
+ # Deserializes the data based on type
212
+ # @param string type Data type
213
+ # @param string value Value to be deserialized
214
+ # @return [Object] Deserialized data
215
+ def _deserialize(type, value)
216
+ case type.to_sym
217
+ when :Time
218
+ Time.parse(value)
219
+ when :Date
220
+ Date.parse(value)
221
+ when :String
222
+ value.to_s
223
+ when :Integer
224
+ value.to_i
225
+ when :Float
226
+ value.to_f
227
+ when :Boolean
228
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
229
+ true
230
+ else
231
+ false
232
+ end
233
+ when :Object
234
+ # generic object (usually a Hash), return directly
235
+ value
236
+ when /\AArray<(?<inner_type>.+)>\z/
237
+ inner_type = Regexp.last_match[:inner_type]
238
+ value.map { |v| _deserialize(inner_type, v) }
239
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
240
+ k_type = Regexp.last_match[:k_type]
241
+ v_type = Regexp.last_match[:v_type]
242
+ {}.tap do |hash|
243
+ value.each do |k, v|
244
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
245
+ end
246
+ end
247
+ else # model
248
+ # models (e.g. Pet) or oneOf
249
+ klass = OneSignal.const_get(type)
250
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
251
+ end
252
+ end
253
+
254
+ # Returns the string representation of the object
255
+ # @return [String] String presentation of the object
256
+ def to_s
257
+ to_hash.to_s
258
+ end
259
+
260
+ # to_body is an alias to to_hash (backward compatibility)
261
+ # @return [Hash] Returns the object in the form of hash
262
+ def to_body
263
+ to_hash
264
+ end
265
+
266
+ # Returns the object in the form of hash
267
+ # @return [Hash] Returns the object in the form of hash
268
+ def to_hash
269
+ hash = {}
270
+ self.class.attribute_map.each_pair do |attr, param|
271
+ value = self.send(attr)
272
+ if value.nil?
273
+ is_nullable = self.class.openapi_nullable.include?(attr)
274
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
275
+ end
276
+
277
+ hash[param] = _to_hash(value)
278
+ end
279
+ hash
280
+ end
281
+
282
+ # Outputs non-array value in the form of hash
283
+ # For object, use to_hash. Otherwise, just return the value
284
+ # @param [Object] value Any valid value
285
+ # @return [Hash] Returns the value in the form of hash
286
+ def _to_hash(value)
287
+ if value.is_a?(Array)
288
+ value.compact.map { |v| _to_hash(v) }
289
+ elsif value.is_a?(Hash)
290
+ {}.tap do |hash|
291
+ value.each { |k, v| hash[k] = _to_hash(v) }
292
+ end
293
+ elsif value.respond_to? :to_hash
294
+ value.to_hash
295
+ else
296
+ value
297
+ end
298
+ end
299
+
300
+ end
301
+
302
+ end
@@ -0,0 +1,221 @@
1
+ =begin
2
+ #OneSignal
3
+
4
+ #A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
5
+
6
+ The version of the OpenAPI document: 5.3.0
7
+ Contact: devrel@onesignal.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OneSignal
17
+ class TemplatesListResponse
18
+ attr_accessor :templates
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'templates' => :'templates'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'templates' => :'Array<TemplateResource>'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::TemplatesListResponse` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::TemplatesListResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'templates')
61
+ if (value = attributes[:'templates']).is_a?(Array)
62
+ self.templates = value
63
+ end
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = Array.new
71
+ invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ templates == o.templates
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Integer] Hash code
96
+ def hash
97
+ [templates].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def self.build_from_hash(attributes)
104
+ new.build_from_hash(attributes)
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ attributes = attributes.transform_keys(&:to_sym)
113
+ self.class.openapi_types.each_pair do |key, type|
114
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
115
+ self.send("#{key}=", nil)
116
+ elsif type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :Time
137
+ Time.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ # models (e.g. Pet) or oneOf
168
+ klass = OneSignal.const_get(type)
169
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ if value.nil?
192
+ is_nullable = self.class.openapi_nullable.include?(attr)
193
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
+ end
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ # Outputs non-array value in the form of hash
202
+ # For object, use to_hash. Otherwise, just return the value
203
+ # @param [Object] value Any valid value
204
+ # @return [Hash] Returns the value in the form of hash
205
+ def _to_hash(value)
206
+ if value.is_a?(Array)
207
+ value.compact.map { |v| _to_hash(v) }
208
+ elsif value.is_a?(Hash)
209
+ {}.tap do |hash|
210
+ value.each { |k, v| hash[k] = _to_hash(v) }
211
+ end
212
+ elsif value.respond_to? :to_hash
213
+ value.to_hash
214
+ else
215
+ value
216
+ end
217
+ end
218
+
219
+ end
220
+
221
+ end
@@ -3,7 +3,7 @@
3
3
 
4
4
  #A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
5
5
 
6
- The version of the OpenAPI document: 5.2.0
6
+ The version of the OpenAPI document: 5.3.0
7
7
  Contact: devrel@onesignal.com
8
8
  Generated by: https://openapi-generator.tech
9
9
  OpenAPI Generator version: 6.0.0-SNAPSHOT