onesignal 0.3.0 → 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +6 -1
  3. data/README.md +126 -111
  4. data/Rakefile +8 -8
  5. data/docs/App.md +76 -0
  6. data/docs/Button.md +22 -0
  7. data/docs/DefaultApi.md +1394 -0
  8. data/docs/DeliveryData.md +26 -0
  9. data/docs/ExportPlayersRequestBody.md +22 -0
  10. data/docs/Filter.md +24 -0
  11. data/docs/FilterExpressions.md +26 -0
  12. data/docs/FilterNotificationTarget.md +40 -0
  13. data/docs/GetNotificationRequestBody.md +22 -0
  14. data/docs/InlineResponse200.md +24 -0
  15. data/docs/InlineResponse2001.md +18 -0
  16. data/docs/InlineResponse2002.md +20 -0
  17. data/docs/InlineResponse2003.md +18 -0
  18. data/docs/InlineResponse2004.md +20 -0
  19. data/docs/InlineResponse2005.md +18 -0
  20. data/docs/InlineResponse201.md +20 -0
  21. data/docs/InlineResponse400.md +18 -0
  22. data/docs/InlineResponse4001.md +20 -0
  23. data/docs/InlineResponse4002.md +18 -0
  24. data/docs/InlineResponse409.md +20 -0
  25. data/docs/Notification.md +240 -0
  26. data/docs/NotificationAllOf.md +192 -0
  27. data/docs/NotificationAllOfAndroidBackgroundLayout.md +22 -0
  28. data/docs/NotificationSlice.md +24 -0
  29. data/docs/NotificationTarget.md +64 -0
  30. data/docs/Operator.md +18 -0
  31. data/docs/OutcomeData.md +22 -0
  32. data/docs/PlatformDeliveryData.md +28 -0
  33. data/docs/Player.md +70 -0
  34. data/docs/PlayerNotificationTarget.md +36 -0
  35. data/docs/PlayerSlice.md +24 -0
  36. data/docs/Purchase.md +22 -0
  37. data/docs/Segment.md +22 -0
  38. data/docs/SegmentNotificationTarget.md +20 -0
  39. data/docs/StringMap.md +102 -0
  40. data/docs/UpdatePlayerTagsRequestBody.md +18 -0
  41. data/git_push.sh +58 -0
  42. data/lib/OneSignal.rb +75 -0
  43. data/lib/onesignal/api/default_api.rb +1338 -0
  44. data/lib/onesignal/api_client.rb +391 -0
  45. data/lib/onesignal/api_error.rb +57 -0
  46. data/lib/onesignal/configuration.rb +242 -0
  47. data/lib/onesignal/models/app.rb +519 -13
  48. data/lib/onesignal/models/button.rb +241 -0
  49. data/lib/onesignal/models/delivery_data.rb +254 -0
  50. data/lib/onesignal/models/export_players_request_body.rb +241 -0
  51. data/lib/onesignal/models/filter.rb +293 -0
  52. data/lib/onesignal/models/filter_expressions.rb +335 -0
  53. data/lib/onesignal/models/filter_notification_target.rb +329 -0
  54. data/lib/onesignal/models/get_notification_request_body.rb +272 -0
  55. data/lib/onesignal/models/inline_response200.rb +256 -0
  56. data/lib/onesignal/models/inline_response2001.rb +218 -0
  57. data/lib/onesignal/models/inline_response2002.rb +227 -0
  58. data/lib/onesignal/models/inline_response2003.rb +218 -0
  59. data/lib/onesignal/models/inline_response2004.rb +227 -0
  60. data/lib/onesignal/models/inline_response2005.rb +218 -0
  61. data/lib/onesignal/models/inline_response201.rb +228 -0
  62. data/lib/onesignal/models/inline_response400.rb +220 -0
  63. data/lib/onesignal/models/inline_response4001.rb +229 -0
  64. data/lib/onesignal/models/inline_response4002.rb +220 -0
  65. data/lib/onesignal/models/inline_response409.rb +229 -0
  66. data/lib/onesignal/models/notification.rb +1395 -5
  67. data/lib/onesignal/models/notification_all_of.rb +1124 -0
  68. data/lib/onesignal/models/notification_all_of_android_background_layout.rb +240 -0
  69. data/lib/onesignal/models/notification_slice.rb +247 -0
  70. data/lib/onesignal/models/notification_target.rb +494 -0
  71. data/lib/onesignal/models/operator.rb +253 -0
  72. data/lib/onesignal/models/outcome_data.rb +285 -0
  73. data/lib/onesignal/models/platform_delivery_data.rb +264 -0
  74. data/lib/onesignal/models/player.rb +483 -9
  75. data/lib/onesignal/models/player_notification_target.rb +329 -0
  76. data/lib/onesignal/models/player_slice.rb +247 -0
  77. data/lib/onesignal/models/purchase.rb +254 -0
  78. data/lib/onesignal/models/segment.rb +251 -0
  79. data/lib/onesignal/models/segment_notification_target.rb +233 -0
  80. data/lib/onesignal/models/string_map.rb +644 -0
  81. data/lib/onesignal/models/update_player_tags_request_body.rb +219 -0
  82. data/lib/onesignal/version.rb +13 -1
  83. data/onesignal.gemspec +36 -27
  84. data/spec/api/default_api_spec.rb +285 -0
  85. data/spec/api_client_spec.rb +226 -0
  86. data/spec/configuration_spec.rb +42 -0
  87. data/spec/models/app_spec.rb +212 -0
  88. data/spec/models/button_spec.rb +46 -0
  89. data/spec/models/delivery_data_spec.rb +58 -0
  90. data/spec/models/export_players_request_body_spec.rb +46 -0
  91. data/spec/models/filter_expressions_spec.rb +66 -0
  92. data/spec/models/filter_notification_target_spec.rb +100 -0
  93. data/spec/models/filter_spec.rb +56 -0
  94. data/spec/models/get_notification_request_body_spec.rb +50 -0
  95. data/spec/models/inline_response2001_spec.rb +34 -0
  96. data/spec/models/inline_response2002_spec.rb +40 -0
  97. data/spec/models/inline_response2003_spec.rb +34 -0
  98. data/spec/models/inline_response2004_spec.rb +40 -0
  99. data/spec/models/inline_response2005_spec.rb +34 -0
  100. data/spec/models/inline_response200_spec.rb +52 -0
  101. data/spec/models/inline_response201_spec.rb +40 -0
  102. data/spec/models/inline_response4001_spec.rb +40 -0
  103. data/spec/models/inline_response4002_spec.rb +34 -0
  104. data/spec/models/inline_response400_spec.rb +34 -0
  105. data/spec/models/inline_response409_spec.rb +40 -0
  106. data/spec/models/notification_all_of_android_background_layout_spec.rb +46 -0
  107. data/spec/models/notification_all_of_spec.rb +560 -0
  108. data/spec/models/notification_slice_spec.rb +52 -0
  109. data/spec/models/notification_spec.rb +704 -0
  110. data/spec/models/notification_target_spec.rb +172 -0
  111. data/spec/models/operator_spec.rb +38 -0
  112. data/spec/models/outcome_data_spec.rb +50 -0
  113. data/spec/models/platform_delivery_data_spec.rb +64 -0
  114. data/spec/models/player_notification_target_spec.rb +88 -0
  115. data/spec/models/player_slice_spec.rb +52 -0
  116. data/spec/models/player_spec.rb +190 -0
  117. data/spec/models/purchase_spec.rb +46 -0
  118. data/spec/models/segment_notification_target_spec.rb +40 -0
  119. data/spec/models/segment_spec.rb +46 -0
  120. data/spec/models/string_map_spec.rb +286 -0
  121. data/spec/models/update_player_tags_request_body_spec.rb +34 -0
  122. data/spec/spec_helper.rb +111 -0
  123. metadata +182 -65
  124. data/.gitignore +0 -10
  125. data/.rubocop.yml +0 -17
  126. data/.travis.yml +0 -16
  127. data/CHANGELOG.md +0 -22
  128. data/CODE_OF_CONDUCT.md +0 -49
  129. data/LICENSE +0 -21
  130. data/bin/console +0 -14
  131. data/bin/setup +0 -8
  132. data/lib/onesignal/app_id_missing_error.rb +0 -7
  133. data/lib/onesignal/client.rb +0 -44
  134. data/lib/onesignal/models/base_model.rb +0 -40
  135. data/lib/onesignal/request.rb +0 -94
  136. data/lib/onesignal/request_error.rb +0 -21
  137. data/lib/onesignal/resources/app_resource.rb +0 -27
  138. data/lib/onesignal/resources/base_resource.rb +0 -35
  139. data/lib/onesignal/resources/notification_resource.rb +0 -33
  140. data/lib/onesignal/resources/player_resource.rb +0 -53
  141. data/lib/onesignal.rb +0 -23
@@ -1,29 +1,535 @@
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: 1.0.0
7
+ Contact: devrel@onesignal.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
1
14
  require 'time'
2
15
 
3
16
  module OneSignal
4
- class App < BaseModel
5
- DATE_REGEX = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/
17
+ class App
18
+ attr_accessor :id
19
+
20
+ # The name of your app, as displayed on your apps list on the dashboard. This can be renamed.
21
+ attr_accessor :name
22
+
23
+ attr_accessor :players
24
+
25
+ attr_accessor :messageable_players
26
+
27
+ attr_accessor :updated_at
28
+
29
+ attr_accessor :created_at
30
+
31
+ # Android: Your Google Project number. Also known as Sender ID.
32
+ attr_accessor :android_gcm_sender_id
33
+
34
+ # Android: Your Google Push Messaging Auth Key
35
+ attr_accessor :gcm_key
36
+
37
+ # Chrome (All Browsers except Safari) (Recommended): The URL to your website. This field is required if you wish to enable web push and specify other web push parameters.
38
+ attr_accessor :chrome_web_origin
39
+
40
+ # Not for web push. Your Google Push Messaging Auth Key if you use Chrome Apps / Extensions.
41
+ attr_accessor :chrome_key
42
+
43
+ # Chrome (All Browsers except Safari): Your default notification icon. Should be 256x256 pixels, min 80x80.
44
+ attr_accessor :chrome_web_default_notification_icon
45
+
46
+ # Chrome (All Browsers except Safari): A subdomain of your choice in order to support Web Push on non-HTTPS websites. This field must be set in order for the chrome_web_gcm_sender_id property to be processed.
47
+ attr_accessor :chrome_web_sub_domain
48
+
49
+ # iOS: Either sandbox or production
50
+ attr_accessor :apns_env
51
+
52
+ # iOS: Your apple push notification p12 certificate file, converted to a string and Base64 encoded.
53
+ attr_accessor :apns_p12
54
+
55
+ # iOS: Required if using p12 certificate. Password for the apns_p12 file.
56
+ attr_accessor :apns_p12_password
6
57
 
7
- def created_at=(time)
8
- parse_time('created_at', time)
58
+ attr_accessor :apns_certificates
59
+
60
+ attr_accessor :safari_apns_certificates
61
+
62
+ # Safari: Your apple push notification p12 certificate file for Safari Push Notifications, converted to a string and Base64 encoded.
63
+ attr_accessor :safari_apns_p12
64
+
65
+ # Safari: Password for safari_apns_p12 file
66
+ attr_accessor :safari_apns_p12_password
67
+
68
+ # Safari (Recommended): The hostname to your website including http(s)://
69
+ attr_accessor :safari_site_origin
70
+
71
+ attr_accessor :safari_push_id
72
+
73
+ attr_accessor :safari_icon_16_16
74
+
75
+ attr_accessor :safari_icon_32_32
76
+
77
+ attr_accessor :safari_icon_64_64
78
+
79
+ attr_accessor :safari_icon_128_128
80
+
81
+ # Safari: A url for a 256x256 png notification icon. This is the only Safari icon URL you need to provide.
82
+ attr_accessor :safari_icon_256_256
83
+
84
+ # All Browsers (Recommended): The Site Name. Requires both chrome_web_origin and safari_site_origin to be set to add or update it.
85
+ attr_accessor :site_name
86
+
87
+ attr_accessor :basic_auth_key
88
+
89
+ # The Id of the Organization you would like to add this app to.
90
+ attr_accessor :organization_id
91
+
92
+ # iOS: Notification data (additional data) values will be added to the root of the apns payload when sent to the device. Ignore if you're not using any other plugins, or not using OneSignal SDK methods to read the payload.
93
+ attr_accessor :additional_data_is_root_payload
94
+
95
+ class EnumAttributeValidator
96
+ attr_reader :datatype
97
+ attr_reader :allowable_values
98
+
99
+ def initialize(datatype, allowable_values)
100
+ @allowable_values = allowable_values.map do |value|
101
+ case datatype.to_s
102
+ when /Integer/i
103
+ value.to_i
104
+ when /Float/i
105
+ value.to_f
106
+ else
107
+ value
108
+ end
109
+ end
110
+ end
111
+
112
+ def valid?(value)
113
+ !value || allowable_values.include?(value)
114
+ end
9
115
  end
10
116
 
11
- def updated_at=(time)
12
- parse_time('updated_at', time)
117
+ # Attribute mapping from ruby-style variable name to JSON key.
118
+ def self.attribute_map
119
+ {
120
+ :'id' => :'id',
121
+ :'name' => :'name',
122
+ :'players' => :'players',
123
+ :'messageable_players' => :'messageable_players',
124
+ :'updated_at' => :'updated_at',
125
+ :'created_at' => :'created_at',
126
+ :'android_gcm_sender_id' => :'android_gcm_sender_id',
127
+ :'gcm_key' => :'gcm_key',
128
+ :'chrome_web_origin' => :'chrome_web_origin',
129
+ :'chrome_key' => :'chrome_key',
130
+ :'chrome_web_default_notification_icon' => :'chrome_web_default_notification_icon',
131
+ :'chrome_web_sub_domain' => :'chrome_web_sub_domain',
132
+ :'apns_env' => :'apns_env',
133
+ :'apns_p12' => :'apns_p12',
134
+ :'apns_p12_password' => :'apns_p12_password',
135
+ :'apns_certificates' => :'apns_certificates',
136
+ :'safari_apns_certificates' => :'safari_apns_certificates',
137
+ :'safari_apns_p12' => :'safari_apns_p12',
138
+ :'safari_apns_p12_password' => :'safari_apns_p12_password',
139
+ :'safari_site_origin' => :'safari_site_origin',
140
+ :'safari_push_id' => :'safari_push_id',
141
+ :'safari_icon_16_16' => :'safari_icon_16_16',
142
+ :'safari_icon_32_32' => :'safari_icon_32_32',
143
+ :'safari_icon_64_64' => :'safari_icon_64_64',
144
+ :'safari_icon_128_128' => :'safari_icon_128_128',
145
+ :'safari_icon_256_256' => :'safari_icon_256_256',
146
+ :'site_name' => :'site_name',
147
+ :'basic_auth_key' => :'basic_auth_key',
148
+ :'organization_id' => :'organization_id',
149
+ :'additional_data_is_root_payload' => :'additional_data_is_root_payload'
150
+ }
13
151
  end
14
152
 
15
- private
153
+ # Returns all the JSON keys this model knows about
154
+ def self.acceptable_attributes
155
+ attribute_map.values
156
+ end
157
+
158
+ # Attribute type mapping.
159
+ def self.openapi_types
160
+ {
161
+ :'id' => :'String',
162
+ :'name' => :'String',
163
+ :'players' => :'Integer',
164
+ :'messageable_players' => :'Integer',
165
+ :'updated_at' => :'Time',
166
+ :'created_at' => :'Time',
167
+ :'android_gcm_sender_id' => :'String',
168
+ :'gcm_key' => :'String',
169
+ :'chrome_web_origin' => :'String',
170
+ :'chrome_key' => :'String',
171
+ :'chrome_web_default_notification_icon' => :'String',
172
+ :'chrome_web_sub_domain' => :'String',
173
+ :'apns_env' => :'String',
174
+ :'apns_p12' => :'String',
175
+ :'apns_p12_password' => :'String',
176
+ :'apns_certificates' => :'String',
177
+ :'safari_apns_certificates' => :'String',
178
+ :'safari_apns_p12' => :'String',
179
+ :'safari_apns_p12_password' => :'String',
180
+ :'safari_site_origin' => :'String',
181
+ :'safari_push_id' => :'String',
182
+ :'safari_icon_16_16' => :'String',
183
+ :'safari_icon_32_32' => :'String',
184
+ :'safari_icon_64_64' => :'String',
185
+ :'safari_icon_128_128' => :'String',
186
+ :'safari_icon_256_256' => :'String',
187
+ :'site_name' => :'String',
188
+ :'basic_auth_key' => :'String',
189
+ :'organization_id' => :'String',
190
+ :'additional_data_is_root_payload' => :'Boolean'
191
+ }
192
+ end
193
+
194
+ # List of attributes with nullable: true
195
+ def self.openapi_nullable
196
+ Set.new([
197
+ ])
198
+ end
199
+
200
+ # Initializes the object
201
+ # @param [Hash] attributes Model attributes in the form of hash
202
+ def initialize(attributes = {})
203
+ if (!attributes.is_a?(Hash))
204
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::App` initialize method"
205
+ end
206
+
207
+ # check to see if the attribute exists and convert string to symbol for hash key
208
+ attributes = attributes.each_with_object({}) { |(k, v), h|
209
+ if (!self.class.attribute_map.key?(k.to_sym))
210
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::App`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
211
+ end
212
+ h[k.to_sym] = v
213
+ }
214
+
215
+ if attributes.key?(:'id')
216
+ self.id = attributes[:'id']
217
+ end
218
+
219
+ if attributes.key?(:'name')
220
+ self.name = attributes[:'name']
221
+ end
222
+
223
+ if attributes.key?(:'players')
224
+ self.players = attributes[:'players']
225
+ end
226
+
227
+ if attributes.key?(:'messageable_players')
228
+ self.messageable_players = attributes[:'messageable_players']
229
+ end
230
+
231
+ if attributes.key?(:'updated_at')
232
+ self.updated_at = attributes[:'updated_at']
233
+ end
234
+
235
+ if attributes.key?(:'created_at')
236
+ self.created_at = attributes[:'created_at']
237
+ end
238
+
239
+ if attributes.key?(:'android_gcm_sender_id')
240
+ self.android_gcm_sender_id = attributes[:'android_gcm_sender_id']
241
+ end
242
+
243
+ if attributes.key?(:'gcm_key')
244
+ self.gcm_key = attributes[:'gcm_key']
245
+ end
246
+
247
+ if attributes.key?(:'chrome_web_origin')
248
+ self.chrome_web_origin = attributes[:'chrome_web_origin']
249
+ end
250
+
251
+ if attributes.key?(:'chrome_key')
252
+ self.chrome_key = attributes[:'chrome_key']
253
+ end
254
+
255
+ if attributes.key?(:'chrome_web_default_notification_icon')
256
+ self.chrome_web_default_notification_icon = attributes[:'chrome_web_default_notification_icon']
257
+ end
258
+
259
+ if attributes.key?(:'chrome_web_sub_domain')
260
+ self.chrome_web_sub_domain = attributes[:'chrome_web_sub_domain']
261
+ end
16
262
 
17
- def parse_time(attribute, value)
18
- if string_date?(value)
19
- value = Time.parse(value)
263
+ if attributes.key?(:'apns_env')
264
+ self.apns_env = attributes[:'apns_env']
20
265
  end
21
266
 
22
- instance_variable_set("@#{attribute}", value)
267
+ if attributes.key?(:'apns_p12')
268
+ self.apns_p12 = attributes[:'apns_p12']
269
+ end
270
+
271
+ if attributes.key?(:'apns_p12_password')
272
+ self.apns_p12_password = attributes[:'apns_p12_password']
273
+ end
274
+
275
+ if attributes.key?(:'apns_certificates')
276
+ self.apns_certificates = attributes[:'apns_certificates']
277
+ end
278
+
279
+ if attributes.key?(:'safari_apns_certificates')
280
+ self.safari_apns_certificates = attributes[:'safari_apns_certificates']
281
+ end
282
+
283
+ if attributes.key?(:'safari_apns_p12')
284
+ self.safari_apns_p12 = attributes[:'safari_apns_p12']
285
+ end
286
+
287
+ if attributes.key?(:'safari_apns_p12_password')
288
+ self.safari_apns_p12_password = attributes[:'safari_apns_p12_password']
289
+ end
290
+
291
+ if attributes.key?(:'safari_site_origin')
292
+ self.safari_site_origin = attributes[:'safari_site_origin']
293
+ end
294
+
295
+ if attributes.key?(:'safari_push_id')
296
+ self.safari_push_id = attributes[:'safari_push_id']
297
+ end
298
+
299
+ if attributes.key?(:'safari_icon_16_16')
300
+ self.safari_icon_16_16 = attributes[:'safari_icon_16_16']
301
+ end
302
+
303
+ if attributes.key?(:'safari_icon_32_32')
304
+ self.safari_icon_32_32 = attributes[:'safari_icon_32_32']
305
+ end
306
+
307
+ if attributes.key?(:'safari_icon_64_64')
308
+ self.safari_icon_64_64 = attributes[:'safari_icon_64_64']
309
+ end
310
+
311
+ if attributes.key?(:'safari_icon_128_128')
312
+ self.safari_icon_128_128 = attributes[:'safari_icon_128_128']
313
+ end
314
+
315
+ if attributes.key?(:'safari_icon_256_256')
316
+ self.safari_icon_256_256 = attributes[:'safari_icon_256_256']
317
+ end
318
+
319
+ if attributes.key?(:'site_name')
320
+ self.site_name = attributes[:'site_name']
321
+ end
322
+
323
+ if attributes.key?(:'basic_auth_key')
324
+ self.basic_auth_key = attributes[:'basic_auth_key']
325
+ end
326
+
327
+ if attributes.key?(:'organization_id')
328
+ self.organization_id = attributes[:'organization_id']
329
+ end
330
+
331
+ if attributes.key?(:'additional_data_is_root_payload')
332
+ self.additional_data_is_root_payload = attributes[:'additional_data_is_root_payload']
333
+ end
334
+ end
335
+
336
+ # Show invalid properties with the reasons. Usually used together with valid?
337
+ # @return Array for valid properties with the reasons
338
+ def list_invalid_properties
339
+ invalid_properties = Array.new
340
+ if @id.nil?
341
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
342
+ end
343
+
344
+ invalid_properties
345
+ end
346
+
347
+ # Check to see if the all the properties in the model are valid
348
+ # @return true if the model is valid
349
+ def valid?
350
+ return false if @id.nil?
351
+ apns_env_validator = EnumAttributeValidator.new('String', ["sandbox", "production"])
352
+ return false unless apns_env_validator.valid?(@apns_env)
353
+ true
354
+ end
355
+
356
+ # Custom attribute writer method checking allowed values (enum).
357
+ # @param [Object] apns_env Object to be assigned
358
+ def apns_env=(apns_env)
359
+ validator = EnumAttributeValidator.new('String', ["sandbox", "production"])
360
+ unless validator.valid?(apns_env)
361
+ fail ArgumentError, "invalid value for \"apns_env\", must be one of #{validator.allowable_values}."
362
+ end
363
+ @apns_env = apns_env
364
+ end
365
+
366
+ # Checks equality by comparing each attribute.
367
+ # @param [Object] Object to be compared
368
+ def ==(o)
369
+ return true if self.equal?(o)
370
+ self.class == o.class &&
371
+ id == o.id &&
372
+ name == o.name &&
373
+ players == o.players &&
374
+ messageable_players == o.messageable_players &&
375
+ updated_at == o.updated_at &&
376
+ created_at == o.created_at &&
377
+ android_gcm_sender_id == o.android_gcm_sender_id &&
378
+ gcm_key == o.gcm_key &&
379
+ chrome_web_origin == o.chrome_web_origin &&
380
+ chrome_key == o.chrome_key &&
381
+ chrome_web_default_notification_icon == o.chrome_web_default_notification_icon &&
382
+ chrome_web_sub_domain == o.chrome_web_sub_domain &&
383
+ apns_env == o.apns_env &&
384
+ apns_p12 == o.apns_p12 &&
385
+ apns_p12_password == o.apns_p12_password &&
386
+ apns_certificates == o.apns_certificates &&
387
+ safari_apns_certificates == o.safari_apns_certificates &&
388
+ safari_apns_p12 == o.safari_apns_p12 &&
389
+ safari_apns_p12_password == o.safari_apns_p12_password &&
390
+ safari_site_origin == o.safari_site_origin &&
391
+ safari_push_id == o.safari_push_id &&
392
+ safari_icon_16_16 == o.safari_icon_16_16 &&
393
+ safari_icon_32_32 == o.safari_icon_32_32 &&
394
+ safari_icon_64_64 == o.safari_icon_64_64 &&
395
+ safari_icon_128_128 == o.safari_icon_128_128 &&
396
+ safari_icon_256_256 == o.safari_icon_256_256 &&
397
+ site_name == o.site_name &&
398
+ basic_auth_key == o.basic_auth_key &&
399
+ organization_id == o.organization_id &&
400
+ additional_data_is_root_payload == o.additional_data_is_root_payload
401
+ end
402
+
403
+ # @see the `==` method
404
+ # @param [Object] Object to be compared
405
+ def eql?(o)
406
+ self == o
407
+ end
408
+
409
+ # Calculates hash code according to all attributes.
410
+ # @return [Integer] Hash code
411
+ def hash
412
+ [id, name, players, messageable_players, updated_at, created_at, android_gcm_sender_id, gcm_key, chrome_web_origin, chrome_key, chrome_web_default_notification_icon, chrome_web_sub_domain, apns_env, apns_p12, apns_p12_password, apns_certificates, safari_apns_certificates, safari_apns_p12, safari_apns_p12_password, safari_site_origin, safari_push_id, safari_icon_16_16, safari_icon_32_32, safari_icon_64_64, safari_icon_128_128, safari_icon_256_256, site_name, basic_auth_key, organization_id, additional_data_is_root_payload].hash
413
+ end
414
+
415
+ # Builds the object from hash
416
+ # @param [Hash] attributes Model attributes in the form of hash
417
+ # @return [Object] Returns the model itself
418
+ def self.build_from_hash(attributes)
419
+ new.build_from_hash(attributes)
420
+ end
421
+
422
+ # Builds the object from hash
423
+ # @param [Hash] attributes Model attributes in the form of hash
424
+ # @return [Object] Returns the model itself
425
+ def build_from_hash(attributes)
426
+ return nil unless attributes.is_a?(Hash)
427
+ self.class.openapi_types.each_pair do |key, type|
428
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
429
+ self.send("#{key}=", nil)
430
+ elsif type =~ /\AArray<(.*)>/i
431
+ # check to ensure the input is an array given that the attribute
432
+ # is documented as an array but the input is not
433
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
434
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
435
+ end
436
+ elsif !attributes[self.class.attribute_map[key]].nil?
437
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
438
+ end
439
+ end
440
+
441
+ self
23
442
  end
24
443
 
25
- def string_date?(date)
26
- date.is_a?(String) && date.match(DATE_REGEX)
444
+ # Deserializes the data based on type
445
+ # @param string type Data type
446
+ # @param string value Value to be deserialized
447
+ # @return [Object] Deserialized data
448
+ def _deserialize(type, value)
449
+ case type.to_sym
450
+ when :Time
451
+ Time.parse(value)
452
+ when :Date
453
+ Date.parse(value)
454
+ when :String
455
+ value.to_s
456
+ when :Integer
457
+ value.to_i
458
+ when :Float
459
+ value.to_f
460
+ when :Boolean
461
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
462
+ true
463
+ else
464
+ false
465
+ end
466
+ when :Object
467
+ # generic object (usually a Hash), return directly
468
+ value
469
+ when /\AArray<(?<inner_type>.+)>\z/
470
+ inner_type = Regexp.last_match[:inner_type]
471
+ value.map { |v| _deserialize(inner_type, v) }
472
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
473
+ k_type = Regexp.last_match[:k_type]
474
+ v_type = Regexp.last_match[:v_type]
475
+ {}.tap do |hash|
476
+ value.each do |k, v|
477
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
478
+ end
479
+ end
480
+ else # model
481
+ # models (e.g. Pet) or oneOf
482
+ klass = OneSignal.const_get(type)
483
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
484
+ end
27
485
  end
486
+
487
+ # Returns the string representation of the object
488
+ # @return [String] String presentation of the object
489
+ def to_s
490
+ to_hash.to_s
491
+ end
492
+
493
+ # to_body is an alias to to_hash (backward compatibility)
494
+ # @return [Hash] Returns the object in the form of hash
495
+ def to_body
496
+ to_hash
497
+ end
498
+
499
+ # Returns the object in the form of hash
500
+ # @return [Hash] Returns the object in the form of hash
501
+ def to_hash
502
+ hash = {}
503
+ self.class.attribute_map.each_pair do |attr, param|
504
+ value = self.send(attr)
505
+ if value.nil?
506
+ is_nullable = self.class.openapi_nullable.include?(attr)
507
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
508
+ end
509
+
510
+ hash[param] = _to_hash(value)
511
+ end
512
+ hash
513
+ end
514
+
515
+ # Outputs non-array value in the form of hash
516
+ # For object, use to_hash. Otherwise, just return the value
517
+ # @param [Object] value Any valid value
518
+ # @return [Hash] Returns the value in the form of hash
519
+ def _to_hash(value)
520
+ if value.is_a?(Array)
521
+ value.compact.map { |v| _to_hash(v) }
522
+ elsif value.is_a?(Hash)
523
+ {}.tap do |hash|
524
+ value.each { |k, v| hash[k] = _to_hash(v) }
525
+ end
526
+ elsif value.respond_to? :to_hash
527
+ value.to_hash
528
+ else
529
+ value
530
+ end
531
+ end
532
+
28
533
  end
534
+
29
535
  end