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
@@ -0,0 +1,495 @@
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'
14
+ require 'time'
15
+
16
+ module OneSignal
17
+ class NotificationTarget
18
+ # The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"]
19
+ attr_accessor :included_segments
20
+
21
+ # Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"]
22
+ attr_accessor :excluded_segments
23
+
24
+ # relation = \">\" or \"<\" hours_ago = number of hours before or after the users last session. Example: \"1.1\"
25
+ attr_accessor :last_session
26
+
27
+ # relation = \">\" or \"<\" hours_ago = number of hours before or after the users first session. Example: \"1.1\"
28
+ attr_accessor :first_session
29
+
30
+ # relation = \">\", \"<\", \"=\" or \"!=\" value = number sessions. Example: \"1\"
31
+ attr_accessor :session_count
32
+
33
+ # relation = \">\", \"<\", \"=\" or \"!=\" value = Time in seconds the user has been in your app. Example: \"3600\"
34
+ attr_accessor :session_time
35
+
36
+ # relation = \">\", \"<\", or \"=\" value = Amount in USD a user has spent on IAP (In App Purchases). Example: \"0.99\"
37
+ attr_accessor :amount_spent
38
+
39
+ # relation = \">\", \"<\" or \"=\" key = SKU purchased in your app as an IAP (In App Purchases). Example: \"com.domain.100coinpack\" value = value of SKU to compare to. Example: \"0.99\"
40
+ attr_accessor :bought_sku
41
+
42
+ # relation = \">\", \"<\", \"=\", \"!=\", \"exists\", \"not_exists\", \"time_elapsed_gt\" (paid plan only) or \"time_elapsed_lt\" (paid plan only) See Time Operators key = Tag key to compare. value = Tag value to compare. Not required for \"exists\" or \"not_exists\". Example: See Formatting Filters
43
+ attr_accessor :tag
44
+
45
+ # relation = \"=\" or \"!=\" value = 2 character language code. Example: \"en\". For a list of all language codes see Language & Localization.
46
+ attr_accessor :language
47
+
48
+ # relation = \">\", \"<\", \"=\" or \"!=\" value = app version. Example: \"1.0.0\"
49
+ attr_accessor :app_version
50
+
51
+ # radius = in meters lat = latitude long = longitude
52
+ attr_accessor :location
53
+
54
+ # value = email address Only for sending Push Notifications Use this for targeting push subscribers associated with an email set with all SDK setEmail methods To send emails to specific email addresses use include_email_tokens parameter
55
+ attr_accessor :email
56
+
57
+ # relation = \"=\" value = 2-digit Country code Example: \"field\": \"country\", \"relation\": \"=\", \"value\", \"US\"
58
+ attr_accessor :country
59
+
60
+ # Specific playerids to send your notification to. _Does not require API Auth Key. Do not combine with other targeting parameters. Not compatible with any other targeting parameters. Example: [\"1dd608f2-c6a1-11e3-851d-000c2940e62c\"] Limit of 2,000 entries per REST API call
61
+ attr_accessor :include_player_ids
62
+
63
+ # Target specific devices by custom user IDs assigned via API. Not compatible with any other targeting parameters Example: [\"custom-id-assigned-by-api\"] REQUIRED: REST API Key Authentication Limit of 2,000 entries per REST API call. Note: If targeting push, email, or sms subscribers with same ids, use with channel_for_external_user_ids to indicate you are sending a push or email or sms.
64
+ attr_accessor :include_external_user_ids
65
+
66
+ # Recommended for Sending Emails - Target specific email addresses. If an email does not correspond to an existing user, a new user will be created. Example: nick@catfac.ts Limit of 2,000 entries per REST API call
67
+ attr_accessor :include_email_tokens
68
+
69
+ # Recommended for Sending SMS - Target specific phone numbers. The phone number should be in the E.164 format. Phone number should be an existing subscriber on OneSignal. Refer our docs to learn how to add phone numbers to OneSignal. Example phone number: +1999999999 Limit of 2,000 entries per REST API call
70
+ attr_accessor :include_phone_numbers
71
+
72
+ # Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using iOS device tokens. Warning: Only works with Production tokens. All non-alphanumeric characters must be removed from each token. If a token does not correspond to an existing user, a new user will be created. Example: ce777617da7f548fe7a9ab6febb56cf39fba6d38203... Limit of 2,000 entries per REST API call
73
+ attr_accessor :include_ios_tokens
74
+
75
+ # Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Windows URIs. If a token does not correspond to an existing user, a new user will be created. Example: http://s.notify.live.net/u/1/bn1/HmQAAACPaLDr-... Limit of 2,000 entries per REST API call
76
+ attr_accessor :include_wp_wns_uris
77
+
78
+ # Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Amazon ADM registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: amzn1.adm-registration.v1.XpvSSUk0Rc3hTVVV... Limit of 2,000 entries per REST API call
79
+ attr_accessor :include_amazon_reg_ids
80
+
81
+ # Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Chrome App registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call
82
+ attr_accessor :include_chrome_reg_ids
83
+
84
+ # Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Chrome Web Push registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call
85
+ attr_accessor :include_chrome_web_reg_ids
86
+
87
+ # Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Android device registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call
88
+ attr_accessor :include_android_reg_ids
89
+
90
+ # Attribute mapping from ruby-style variable name to JSON key.
91
+ def self.attribute_map
92
+ {
93
+ :'included_segments' => :'included_segments',
94
+ :'excluded_segments' => :'excluded_segments',
95
+ :'last_session' => :'last_session',
96
+ :'first_session' => :'first_session',
97
+ :'session_count' => :'session_count',
98
+ :'session_time' => :'session_time',
99
+ :'amount_spent' => :'amount_spent',
100
+ :'bought_sku' => :'bought_sku',
101
+ :'tag' => :'tag',
102
+ :'language' => :'language',
103
+ :'app_version' => :'app_version',
104
+ :'location' => :'location',
105
+ :'email' => :'email',
106
+ :'country' => :'country',
107
+ :'include_player_ids' => :'include_player_ids',
108
+ :'include_external_user_ids' => :'include_external_user_ids',
109
+ :'include_email_tokens' => :'include_email_tokens',
110
+ :'include_phone_numbers' => :'include_phone_numbers',
111
+ :'include_ios_tokens' => :'include_ios_tokens',
112
+ :'include_wp_wns_uris' => :'include_wp_wns_uris',
113
+ :'include_amazon_reg_ids' => :'include_amazon_reg_ids',
114
+ :'include_chrome_reg_ids' => :'include_chrome_reg_ids',
115
+ :'include_chrome_web_reg_ids' => :'include_chrome_web_reg_ids',
116
+ :'include_android_reg_ids' => :'include_android_reg_ids'
117
+ }
118
+ end
119
+
120
+ # Returns all the JSON keys this model knows about
121
+ def self.acceptable_attributes
122
+ attribute_map.values
123
+ end
124
+
125
+ # Attribute type mapping.
126
+ def self.openapi_types
127
+ {
128
+ :'included_segments' => :'Array<String>',
129
+ :'excluded_segments' => :'Array<String>',
130
+ :'last_session' => :'String',
131
+ :'first_session' => :'String',
132
+ :'session_count' => :'String',
133
+ :'session_time' => :'String',
134
+ :'amount_spent' => :'String',
135
+ :'bought_sku' => :'String',
136
+ :'tag' => :'String',
137
+ :'language' => :'String',
138
+ :'app_version' => :'String',
139
+ :'location' => :'String',
140
+ :'email' => :'String',
141
+ :'country' => :'String',
142
+ :'include_player_ids' => :'Array<String>',
143
+ :'include_external_user_ids' => :'Array<String>',
144
+ :'include_email_tokens' => :'Array<String>',
145
+ :'include_phone_numbers' => :'Array<String>',
146
+ :'include_ios_tokens' => :'Array<String>',
147
+ :'include_wp_wns_uris' => :'Array<String>',
148
+ :'include_amazon_reg_ids' => :'Array<String>',
149
+ :'include_chrome_reg_ids' => :'Array<String>',
150
+ :'include_chrome_web_reg_ids' => :'Array<String>',
151
+ :'include_android_reg_ids' => :'Array<String>'
152
+ }
153
+ end
154
+
155
+ # List of attributes with nullable: true
156
+ def self.openapi_nullable
157
+ Set.new([
158
+ ])
159
+ end
160
+
161
+ # List of class defined in anyOf (OpenAPI v3)
162
+ def self.openapi_any_of
163
+ [
164
+ :'FilterNotificationTarget',
165
+ :'PlayerNotificationTarget',
166
+ :'SegmentNotificationTarget'
167
+ ]
168
+ end
169
+
170
+ # Initializes the object
171
+ # @param [Hash] attributes Model attributes in the form of hash
172
+ def initialize(attributes = {})
173
+ if (!attributes.is_a?(Hash))
174
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::NotificationTarget` initialize method"
175
+ end
176
+
177
+ # check to see if the attribute exists and convert string to symbol for hash key
178
+ attributes = attributes.each_with_object({}) { |(k, v), h|
179
+ if (!self.class.attribute_map.key?(k.to_sym))
180
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::NotificationTarget`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
181
+ end
182
+ h[k.to_sym] = v
183
+ }
184
+
185
+ if attributes.key?(:'included_segments')
186
+ if (value = attributes[:'included_segments']).is_a?(Array)
187
+ self.included_segments = value
188
+ end
189
+ end
190
+
191
+ if attributes.key?(:'excluded_segments')
192
+ if (value = attributes[:'excluded_segments']).is_a?(Array)
193
+ self.excluded_segments = value
194
+ end
195
+ end
196
+
197
+ if attributes.key?(:'last_session')
198
+ self.last_session = attributes[:'last_session']
199
+ end
200
+
201
+ if attributes.key?(:'first_session')
202
+ self.first_session = attributes[:'first_session']
203
+ end
204
+
205
+ if attributes.key?(:'session_count')
206
+ self.session_count = attributes[:'session_count']
207
+ end
208
+
209
+ if attributes.key?(:'session_time')
210
+ self.session_time = attributes[:'session_time']
211
+ end
212
+
213
+ if attributes.key?(:'amount_spent')
214
+ self.amount_spent = attributes[:'amount_spent']
215
+ end
216
+
217
+ if attributes.key?(:'bought_sku')
218
+ self.bought_sku = attributes[:'bought_sku']
219
+ end
220
+
221
+ if attributes.key?(:'tag')
222
+ self.tag = attributes[:'tag']
223
+ end
224
+
225
+ if attributes.key?(:'language')
226
+ self.language = attributes[:'language']
227
+ end
228
+
229
+ if attributes.key?(:'app_version')
230
+ self.app_version = attributes[:'app_version']
231
+ end
232
+
233
+ if attributes.key?(:'location')
234
+ self.location = attributes[:'location']
235
+ end
236
+
237
+ if attributes.key?(:'email')
238
+ self.email = attributes[:'email']
239
+ end
240
+
241
+ if attributes.key?(:'country')
242
+ self.country = attributes[:'country']
243
+ end
244
+
245
+ if attributes.key?(:'include_player_ids')
246
+ if (value = attributes[:'include_player_ids']).is_a?(Array)
247
+ self.include_player_ids = value
248
+ end
249
+ end
250
+
251
+ if attributes.key?(:'include_external_user_ids')
252
+ if (value = attributes[:'include_external_user_ids']).is_a?(Array)
253
+ self.include_external_user_ids = value
254
+ end
255
+ end
256
+
257
+ if attributes.key?(:'include_email_tokens')
258
+ if (value = attributes[:'include_email_tokens']).is_a?(Array)
259
+ self.include_email_tokens = value
260
+ end
261
+ end
262
+
263
+ if attributes.key?(:'include_phone_numbers')
264
+ if (value = attributes[:'include_phone_numbers']).is_a?(Array)
265
+ self.include_phone_numbers = value
266
+ end
267
+ end
268
+
269
+ if attributes.key?(:'include_ios_tokens')
270
+ if (value = attributes[:'include_ios_tokens']).is_a?(Array)
271
+ self.include_ios_tokens = value
272
+ end
273
+ end
274
+
275
+ if attributes.key?(:'include_wp_wns_uris')
276
+ if (value = attributes[:'include_wp_wns_uris']).is_a?(Array)
277
+ self.include_wp_wns_uris = value
278
+ end
279
+ end
280
+
281
+ if attributes.key?(:'include_amazon_reg_ids')
282
+ if (value = attributes[:'include_amazon_reg_ids']).is_a?(Array)
283
+ self.include_amazon_reg_ids = value
284
+ end
285
+ end
286
+
287
+ if attributes.key?(:'include_chrome_reg_ids')
288
+ if (value = attributes[:'include_chrome_reg_ids']).is_a?(Array)
289
+ self.include_chrome_reg_ids = value
290
+ end
291
+ end
292
+
293
+ if attributes.key?(:'include_chrome_web_reg_ids')
294
+ if (value = attributes[:'include_chrome_web_reg_ids']).is_a?(Array)
295
+ self.include_chrome_web_reg_ids = value
296
+ end
297
+ end
298
+
299
+ if attributes.key?(:'include_android_reg_ids')
300
+ if (value = attributes[:'include_android_reg_ids']).is_a?(Array)
301
+ self.include_android_reg_ids = value
302
+ end
303
+ end
304
+ end
305
+
306
+ # Show invalid properties with the reasons. Usually used together with valid?
307
+ # @return Array for valid properties with the reasons
308
+ def list_invalid_properties
309
+ invalid_properties = Array.new
310
+ invalid_properties
311
+ end
312
+
313
+ # Check to see if the all the properties in the model are valid
314
+ # @return true if the model is valid
315
+ def valid?
316
+ _any_of_found = false
317
+ self.class.openapi_any_of.each do |_class|
318
+ _any_of = OneSignal.const_get(_class).build_from_hash(self.to_hash)
319
+ if _any_of.valid?
320
+ _any_of_found = true
321
+ end
322
+ end
323
+
324
+ if !_any_of_found
325
+ return false
326
+ end
327
+
328
+ true
329
+ end
330
+
331
+ # Checks equality by comparing each attribute.
332
+ # @param [Object] Object to be compared
333
+ def ==(o)
334
+ return true if self.equal?(o)
335
+ self.class == o.class &&
336
+ included_segments == o.included_segments &&
337
+ excluded_segments == o.excluded_segments &&
338
+ last_session == o.last_session &&
339
+ first_session == o.first_session &&
340
+ session_count == o.session_count &&
341
+ session_time == o.session_time &&
342
+ amount_spent == o.amount_spent &&
343
+ bought_sku == o.bought_sku &&
344
+ tag == o.tag &&
345
+ language == o.language &&
346
+ app_version == o.app_version &&
347
+ location == o.location &&
348
+ email == o.email &&
349
+ country == o.country &&
350
+ include_player_ids == o.include_player_ids &&
351
+ include_external_user_ids == o.include_external_user_ids &&
352
+ include_email_tokens == o.include_email_tokens &&
353
+ include_phone_numbers == o.include_phone_numbers &&
354
+ include_ios_tokens == o.include_ios_tokens &&
355
+ include_wp_wns_uris == o.include_wp_wns_uris &&
356
+ include_amazon_reg_ids == o.include_amazon_reg_ids &&
357
+ include_chrome_reg_ids == o.include_chrome_reg_ids &&
358
+ include_chrome_web_reg_ids == o.include_chrome_web_reg_ids &&
359
+ include_android_reg_ids == o.include_android_reg_ids
360
+ end
361
+
362
+ # @see the `==` method
363
+ # @param [Object] Object to be compared
364
+ def eql?(o)
365
+ self == o
366
+ end
367
+
368
+ # Calculates hash code according to all attributes.
369
+ # @return [Integer] Hash code
370
+ def hash
371
+ [included_segments, excluded_segments, last_session, first_session, session_count, session_time, amount_spent, bought_sku, tag, language, app_version, location, email, country, include_player_ids, include_external_user_ids, include_email_tokens, include_phone_numbers, include_ios_tokens, include_wp_wns_uris, include_amazon_reg_ids, include_chrome_reg_ids, include_chrome_web_reg_ids, include_android_reg_ids].hash
372
+ end
373
+
374
+ # Builds the object from hash
375
+ # @param [Hash] attributes Model attributes in the form of hash
376
+ # @return [Object] Returns the model itself
377
+ def self.build_from_hash(attributes)
378
+ new.build_from_hash(attributes)
379
+ end
380
+
381
+ # Builds the object from hash
382
+ # @param [Hash] attributes Model attributes in the form of hash
383
+ # @return [Object] Returns the model itself
384
+ def build_from_hash(attributes)
385
+ return nil unless attributes.is_a?(Hash)
386
+ attributes = attributes.transform_keys(&:to_sym)
387
+ self.class.openapi_types.each_pair do |key, type|
388
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
389
+ self.send("#{key}=", nil)
390
+ elsif type =~ /\AArray<(.*)>/i
391
+ # check to ensure the input is an array given that the attribute
392
+ # is documented as an array but the input is not
393
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
394
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
395
+ end
396
+ elsif !attributes[self.class.attribute_map[key]].nil?
397
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
398
+ end
399
+ end
400
+
401
+ self
402
+ end
403
+
404
+ # Deserializes the data based on type
405
+ # @param string type Data type
406
+ # @param string value Value to be deserialized
407
+ # @return [Object] Deserialized data
408
+ def _deserialize(type, value)
409
+ case type.to_sym
410
+ when :Time
411
+ Time.parse(value)
412
+ when :Date
413
+ Date.parse(value)
414
+ when :String
415
+ value.to_s
416
+ when :Integer
417
+ value.to_i
418
+ when :Float
419
+ value.to_f
420
+ when :Boolean
421
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
422
+ true
423
+ else
424
+ false
425
+ end
426
+ when :Object
427
+ # generic object (usually a Hash), return directly
428
+ value
429
+ when /\AArray<(?<inner_type>.+)>\z/
430
+ inner_type = Regexp.last_match[:inner_type]
431
+ value.map { |v| _deserialize(inner_type, v) }
432
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
433
+ k_type = Regexp.last_match[:k_type]
434
+ v_type = Regexp.last_match[:v_type]
435
+ {}.tap do |hash|
436
+ value.each do |k, v|
437
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
438
+ end
439
+ end
440
+ else # model
441
+ # models (e.g. Pet) or oneOf
442
+ klass = OneSignal.const_get(type)
443
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
444
+ end
445
+ end
446
+
447
+ # Returns the string representation of the object
448
+ # @return [String] String presentation of the object
449
+ def to_s
450
+ to_hash.to_s
451
+ end
452
+
453
+ # to_body is an alias to to_hash (backward compatibility)
454
+ # @return [Hash] Returns the object in the form of hash
455
+ def to_body
456
+ to_hash
457
+ end
458
+
459
+ # Returns the object in the form of hash
460
+ # @return [Hash] Returns the object in the form of hash
461
+ def to_hash
462
+ hash = {}
463
+ self.class.attribute_map.each_pair do |attr, param|
464
+ value = self.send(attr)
465
+ if value.nil?
466
+ is_nullable = self.class.openapi_nullable.include?(attr)
467
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
468
+ end
469
+
470
+ hash[param] = _to_hash(value)
471
+ end
472
+ hash
473
+ end
474
+
475
+ # Outputs non-array value in the form of hash
476
+ # For object, use to_hash. Otherwise, just return the value
477
+ # @param [Object] value Any valid value
478
+ # @return [Hash] Returns the value in the form of hash
479
+ def _to_hash(value)
480
+ if value.is_a?(Array)
481
+ value.compact.map { |v| _to_hash(v) }
482
+ elsif value.is_a?(Hash)
483
+ {}.tap do |hash|
484
+ value.each { |k, v| hash[k] = _to_hash(v) }
485
+ end
486
+ elsif value.respond_to? :to_hash
487
+ value.to_hash
488
+ else
489
+ value
490
+ end
491
+ end
492
+
493
+ end
494
+
495
+ end