onesignal 0.2.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +14 -0
  3. data/Gemfile +6 -1
  4. data/LICENSE +6 -3
  5. data/README.md +144 -99
  6. data/RELEASE_INSTRUCTIONS.md +11 -0
  7. data/Rakefile +8 -8
  8. data/docs/App.md +76 -0
  9. data/docs/Button.md +22 -0
  10. data/docs/DefaultApi.md +1394 -0
  11. data/docs/DeliveryData.md +26 -0
  12. data/docs/ExportPlayersRequestBody.md +22 -0
  13. data/docs/Filter.md +24 -0
  14. data/docs/FilterExpressions.md +26 -0
  15. data/docs/FilterNotificationTarget.md +40 -0
  16. data/docs/GetNotificationRequestBody.md +22 -0
  17. data/docs/InlineResponse200.md +24 -0
  18. data/docs/InlineResponse2001.md +18 -0
  19. data/docs/InlineResponse2002.md +20 -0
  20. data/docs/InlineResponse2005.md +20 -0
  21. data/docs/InlineResponse2007.md +18 -0
  22. data/docs/InlineResponse2008.md +18 -0
  23. data/docs/InlineResponse201.md +20 -0
  24. data/docs/InlineResponse400.md +18 -0
  25. data/docs/InlineResponse4001.md +20 -0
  26. data/docs/InlineResponse4002.md +20 -0
  27. data/docs/InlineResponse4003.md +18 -0
  28. data/docs/InvalidIdentifierError.md +20 -0
  29. data/docs/Notification.md +240 -0
  30. data/docs/Notification200Errors.md +49 -0
  31. data/docs/NotificationAllOf.md +192 -0
  32. data/docs/NotificationAllOfAndroidBackgroundLayout.md +22 -0
  33. data/docs/NotificationSlice.md +24 -0
  34. data/docs/NotificationTarget.md +64 -0
  35. data/docs/NotificationWithMeta.md +260 -0
  36. data/docs/NotificationWithMetaAllOf.md +38 -0
  37. data/docs/Operator.md +18 -0
  38. data/docs/OutcomeData.md +22 -0
  39. data/docs/OutcomesData.md +18 -0
  40. data/docs/PlatformDeliveryData.md +28 -0
  41. data/docs/Player.md +70 -0
  42. data/docs/PlayerNotificationTarget.md +36 -0
  43. data/docs/PlayerSlice.md +24 -0
  44. data/docs/Purchase.md +22 -0
  45. data/docs/Segment.md +22 -0
  46. data/docs/SegmentNotificationTarget.md +20 -0
  47. data/docs/StringMap.md +102 -0
  48. data/docs/UpdatePlayerTagsRequestBody.md +18 -0
  49. data/lib/onesignal/api/default_api.rb +1365 -0
  50. data/lib/onesignal/api_client.rb +393 -0
  51. data/lib/onesignal/api_error.rb +57 -0
  52. data/lib/onesignal/configuration.rb +245 -0
  53. data/lib/onesignal/models/app.rb +519 -20
  54. data/lib/onesignal/models/button.rb +242 -0
  55. data/lib/onesignal/models/delivery_data.rb +260 -0
  56. data/lib/onesignal/models/export_players_request_body.rb +242 -0
  57. data/lib/onesignal/models/filter.rb +294 -0
  58. data/lib/onesignal/models/filter_expressions.rb +336 -0
  59. data/lib/onesignal/models/filter_notification_target.rb +330 -0
  60. data/lib/onesignal/models/get_notification_request_body.rb +273 -0
  61. data/lib/onesignal/models/inline_response200.rb +257 -0
  62. data/lib/onesignal/models/inline_response2001.rb +219 -0
  63. data/lib/onesignal/models/inline_response2002.rb +228 -0
  64. data/lib/onesignal/models/inline_response2005.rb +228 -0
  65. data/lib/onesignal/models/inline_response2007.rb +219 -0
  66. data/lib/onesignal/models/inline_response2008.rb +219 -0
  67. data/lib/onesignal/models/inline_response201.rb +229 -0
  68. data/lib/onesignal/models/inline_response400.rb +221 -0
  69. data/lib/onesignal/models/inline_response4001.rb +230 -0
  70. data/lib/onesignal/models/inline_response4002.rb +230 -0
  71. data/lib/onesignal/models/inline_response4003.rb +221 -0
  72. data/lib/onesignal/models/invalid_identifier_error.rb +234 -0
  73. data/lib/onesignal/models/notification.rb +1414 -9
  74. data/lib/onesignal/models/notification200_errors.rb +105 -0
  75. data/lib/onesignal/models/notification_all_of.rb +1144 -0
  76. data/lib/onesignal/models/notification_all_of_android_background_layout.rb +241 -0
  77. data/lib/onesignal/models/notification_slice.rb +248 -0
  78. data/lib/onesignal/models/notification_target.rb +495 -0
  79. data/lib/onesignal/models/notification_with_meta.rb +1526 -0
  80. data/lib/onesignal/models/notification_with_meta_all_of.rb +322 -0
  81. data/lib/onesignal/models/operator.rb +254 -0
  82. data/lib/onesignal/models/outcome_data.rb +286 -0
  83. data/lib/onesignal/models/outcomes_data.rb +221 -0
  84. data/lib/onesignal/models/platform_delivery_data.rb +265 -0
  85. data/lib/onesignal/models/player.rb +480 -13
  86. data/lib/onesignal/models/player_notification_target.rb +330 -0
  87. data/lib/onesignal/models/player_slice.rb +248 -0
  88. data/lib/onesignal/models/purchase.rb +255 -0
  89. data/lib/onesignal/models/segment.rb +252 -0
  90. data/lib/onesignal/models/segment_notification_target.rb +234 -0
  91. data/lib/onesignal/models/string_map.rb +640 -0
  92. data/lib/onesignal/models/update_player_tags_request_body.rb +220 -0
  93. data/lib/onesignal/version.rb +13 -1
  94. data/lib/onesignal.rb +73 -16
  95. data/onesignal.gemspec +37 -27
  96. data/spec/api/default_api_spec.rb +285 -0
  97. data/spec/api_client_spec.rb +226 -0
  98. data/spec/configuration_spec.rb +42 -0
  99. data/spec/models/app_spec.rb +212 -0
  100. data/spec/models/button_spec.rb +46 -0
  101. data/spec/models/delivery_data_spec.rb +58 -0
  102. data/spec/models/export_players_request_body_spec.rb +46 -0
  103. data/spec/models/filter_expressions_spec.rb +66 -0
  104. data/spec/models/filter_notification_target_spec.rb +100 -0
  105. data/spec/models/filter_spec.rb +56 -0
  106. data/spec/models/get_notification_request_body_spec.rb +50 -0
  107. data/spec/models/inline_response2001_spec.rb +34 -0
  108. data/spec/models/inline_response2002_spec.rb +40 -0
  109. data/spec/models/inline_response2005_spec.rb +40 -0
  110. data/spec/models/inline_response2007_spec.rb +34 -0
  111. data/spec/models/inline_response2008_spec.rb +34 -0
  112. data/spec/models/inline_response200_spec.rb +52 -0
  113. data/spec/models/inline_response201_spec.rb +40 -0
  114. data/spec/models/inline_response4001_spec.rb +40 -0
  115. data/spec/models/inline_response4002_spec.rb +40 -0
  116. data/spec/models/inline_response4003_spec.rb +34 -0
  117. data/spec/models/inline_response400_spec.rb +34 -0
  118. data/spec/models/invalid_identifier_error_spec.rb +40 -0
  119. data/spec/models/notification200_errors_spec.rb +31 -0
  120. data/spec/models/notification_all_of_android_background_layout_spec.rb +46 -0
  121. data/spec/models/notification_all_of_spec.rb +560 -0
  122. data/spec/models/notification_slice_spec.rb +52 -0
  123. data/spec/models/notification_spec.rb +704 -0
  124. data/spec/models/notification_target_spec.rb +172 -0
  125. data/spec/models/notification_with_meta_all_of_spec.rb +94 -0
  126. data/spec/models/notification_with_meta_spec.rb +764 -0
  127. data/spec/models/operator_spec.rb +38 -0
  128. data/spec/models/outcome_data_spec.rb +50 -0
  129. data/spec/models/outcomes_data_spec.rb +34 -0
  130. data/spec/models/platform_delivery_data_spec.rb +64 -0
  131. data/spec/models/player_notification_target_spec.rb +88 -0
  132. data/spec/models/player_slice_spec.rb +52 -0
  133. data/spec/models/player_spec.rb +190 -0
  134. data/spec/models/purchase_spec.rb +46 -0
  135. data/spec/models/segment_notification_target_spec.rb +40 -0
  136. data/spec/models/segment_spec.rb +46 -0
  137. data/spec/models/string_map_spec.rb +286 -0
  138. data/spec/models/update_player_tags_request_body_spec.rb +34 -0
  139. data/spec/spec_helper.rb +111 -0
  140. metadata +203 -64
  141. data/.gitignore +0 -10
  142. data/.rubocop.yml +0 -17
  143. data/.travis.yml +0 -16
  144. data/CODE_OF_CONDUCT.md +0 -49
  145. data/bin/console +0 -14
  146. data/bin/setup +0 -8
  147. data/lib/onesignal/app_id_missing_error.rb +0 -7
  148. data/lib/onesignal/client.rb +0 -44
  149. data/lib/onesignal/models/base_model.rb +0 -19
  150. data/lib/onesignal/request.rb +0 -94
  151. data/lib/onesignal/request_error.rb +0 -21
  152. data/lib/onesignal/resources/app_resource.rb +0 -27
  153. data/lib/onesignal/resources/base_resource.rb +0 -35
  154. data/lib/onesignal/resources/notification_resource.rb +0 -33
  155. data/lib/onesignal/resources/player_resource.rb +0 -53
@@ -1,37 +1,536 @@
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.1
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'
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
57
+
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
115
+ end
116
+
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
+ }
151
+ end
152
+
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
6
250
 
7
- attr_accessor :apns_certificates, :apns_env, :basic_auth_key, :chrome_key,
8
- :chrome_web_default_notification_icon, :chrome_web_gcm_sender_id,
9
- :chrome_web_origin, :chrome_web_sub_domain, :created_at, :gcm_key, :id,
10
- :messageable_players, :name, :players, :safari_apns_certificate,
11
- :safari_icon_128_128, :safari_icon_16_16, :safari_icon_256_256,
12
- :safari_icon_32_32, :safari_icon_64_64, :safari_push_id,
13
- :safari_site_origin, :site_name, :updated_at
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
262
+
263
+ if attributes.key?(:'apns_env')
264
+ self.apns_env = attributes[:'apns_env']
265
+ end
266
+
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
14
365
 
15
- def created_at=(time)
16
- parse_time('created_at', time)
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
17
401
  end
18
402
 
19
- def updated_at=(time)
20
- parse_time('updated_at', time)
403
+ # @see the `==` method
404
+ # @param [Object] Object to be compared
405
+ def eql?(o)
406
+ self == o
21
407
  end
22
408
 
23
- private
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
24
421
 
25
- def parse_time(attribute, value)
26
- if string_date?(value)
27
- value = Time.parse(value)
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
+ attributes = attributes.transform_keys(&:to_sym)
428
+ self.class.openapi_types.each_pair do |key, type|
429
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
430
+ self.send("#{key}=", nil)
431
+ elsif type =~ /\AArray<(.*)>/i
432
+ # check to ensure the input is an array given that the attribute
433
+ # is documented as an array but the input is not
434
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
435
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
436
+ end
437
+ elsif !attributes[self.class.attribute_map[key]].nil?
438
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
439
+ end
28
440
  end
29
441
 
30
- instance_variable_set("@#{attribute}", value)
442
+ self
31
443
  end
32
444
 
33
- def string_date?(date)
34
- date.is_a?(String) && date.match(DATE_REGEX)
445
+ # Deserializes the data based on type
446
+ # @param string type Data type
447
+ # @param string value Value to be deserialized
448
+ # @return [Object] Deserialized data
449
+ def _deserialize(type, value)
450
+ case type.to_sym
451
+ when :Time
452
+ Time.parse(value)
453
+ when :Date
454
+ Date.parse(value)
455
+ when :String
456
+ value.to_s
457
+ when :Integer
458
+ value.to_i
459
+ when :Float
460
+ value.to_f
461
+ when :Boolean
462
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
463
+ true
464
+ else
465
+ false
466
+ end
467
+ when :Object
468
+ # generic object (usually a Hash), return directly
469
+ value
470
+ when /\AArray<(?<inner_type>.+)>\z/
471
+ inner_type = Regexp.last_match[:inner_type]
472
+ value.map { |v| _deserialize(inner_type, v) }
473
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
474
+ k_type = Regexp.last_match[:k_type]
475
+ v_type = Regexp.last_match[:v_type]
476
+ {}.tap do |hash|
477
+ value.each do |k, v|
478
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
479
+ end
480
+ end
481
+ else # model
482
+ # models (e.g. Pet) or oneOf
483
+ klass = OneSignal.const_get(type)
484
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
485
+ end
35
486
  end
487
+
488
+ # Returns the string representation of the object
489
+ # @return [String] String presentation of the object
490
+ def to_s
491
+ to_hash.to_s
492
+ end
493
+
494
+ # to_body is an alias to to_hash (backward compatibility)
495
+ # @return [Hash] Returns the object in the form of hash
496
+ def to_body
497
+ to_hash
498
+ end
499
+
500
+ # Returns the object in the form of hash
501
+ # @return [Hash] Returns the object in the form of hash
502
+ def to_hash
503
+ hash = {}
504
+ self.class.attribute_map.each_pair do |attr, param|
505
+ value = self.send(attr)
506
+ if value.nil?
507
+ is_nullable = self.class.openapi_nullable.include?(attr)
508
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
509
+ end
510
+
511
+ hash[param] = _to_hash(value)
512
+ end
513
+ hash
514
+ end
515
+
516
+ # Outputs non-array value in the form of hash
517
+ # For object, use to_hash. Otherwise, just return the value
518
+ # @param [Object] value Any valid value
519
+ # @return [Hash] Returns the value in the form of hash
520
+ def _to_hash(value)
521
+ if value.is_a?(Array)
522
+ value.compact.map { |v| _to_hash(v) }
523
+ elsif value.is_a?(Hash)
524
+ {}.tap do |hash|
525
+ value.each { |k, v| hash[k] = _to_hash(v) }
526
+ end
527
+ elsif value.respond_to? :to_hash
528
+ value.to_hash
529
+ else
530
+ value
531
+ end
532
+ end
533
+
36
534
  end
535
+
37
536
  end