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.
- checksums.yaml +5 -5
- data/Gemfile +6 -1
- data/README.md +126 -111
- data/Rakefile +8 -8
- data/docs/App.md +76 -0
- data/docs/Button.md +22 -0
- data/docs/DefaultApi.md +1394 -0
- data/docs/DeliveryData.md +26 -0
- data/docs/ExportPlayersRequestBody.md +22 -0
- data/docs/Filter.md +24 -0
- data/docs/FilterExpressions.md +26 -0
- data/docs/FilterNotificationTarget.md +40 -0
- data/docs/GetNotificationRequestBody.md +22 -0
- data/docs/InlineResponse200.md +24 -0
- data/docs/InlineResponse2001.md +18 -0
- data/docs/InlineResponse2002.md +20 -0
- data/docs/InlineResponse2003.md +18 -0
- data/docs/InlineResponse2004.md +20 -0
- data/docs/InlineResponse2005.md +18 -0
- data/docs/InlineResponse201.md +20 -0
- data/docs/InlineResponse400.md +18 -0
- data/docs/InlineResponse4001.md +20 -0
- data/docs/InlineResponse4002.md +18 -0
- data/docs/InlineResponse409.md +20 -0
- data/docs/Notification.md +240 -0
- data/docs/NotificationAllOf.md +192 -0
- data/docs/NotificationAllOfAndroidBackgroundLayout.md +22 -0
- data/docs/NotificationSlice.md +24 -0
- data/docs/NotificationTarget.md +64 -0
- data/docs/Operator.md +18 -0
- data/docs/OutcomeData.md +22 -0
- data/docs/PlatformDeliveryData.md +28 -0
- data/docs/Player.md +70 -0
- data/docs/PlayerNotificationTarget.md +36 -0
- data/docs/PlayerSlice.md +24 -0
- data/docs/Purchase.md +22 -0
- data/docs/Segment.md +22 -0
- data/docs/SegmentNotificationTarget.md +20 -0
- data/docs/StringMap.md +102 -0
- data/docs/UpdatePlayerTagsRequestBody.md +18 -0
- data/git_push.sh +58 -0
- data/lib/OneSignal.rb +75 -0
- data/lib/onesignal/api/default_api.rb +1338 -0
- data/lib/onesignal/api_client.rb +391 -0
- data/lib/onesignal/api_error.rb +57 -0
- data/lib/onesignal/configuration.rb +242 -0
- data/lib/onesignal/models/app.rb +519 -13
- data/lib/onesignal/models/button.rb +241 -0
- data/lib/onesignal/models/delivery_data.rb +254 -0
- data/lib/onesignal/models/export_players_request_body.rb +241 -0
- data/lib/onesignal/models/filter.rb +293 -0
- data/lib/onesignal/models/filter_expressions.rb +335 -0
- data/lib/onesignal/models/filter_notification_target.rb +329 -0
- data/lib/onesignal/models/get_notification_request_body.rb +272 -0
- data/lib/onesignal/models/inline_response200.rb +256 -0
- data/lib/onesignal/models/inline_response2001.rb +218 -0
- data/lib/onesignal/models/inline_response2002.rb +227 -0
- data/lib/onesignal/models/inline_response2003.rb +218 -0
- data/lib/onesignal/models/inline_response2004.rb +227 -0
- data/lib/onesignal/models/inline_response2005.rb +218 -0
- data/lib/onesignal/models/inline_response201.rb +228 -0
- data/lib/onesignal/models/inline_response400.rb +220 -0
- data/lib/onesignal/models/inline_response4001.rb +229 -0
- data/lib/onesignal/models/inline_response4002.rb +220 -0
- data/lib/onesignal/models/inline_response409.rb +229 -0
- data/lib/onesignal/models/notification.rb +1395 -5
- data/lib/onesignal/models/notification_all_of.rb +1124 -0
- data/lib/onesignal/models/notification_all_of_android_background_layout.rb +240 -0
- data/lib/onesignal/models/notification_slice.rb +247 -0
- data/lib/onesignal/models/notification_target.rb +494 -0
- data/lib/onesignal/models/operator.rb +253 -0
- data/lib/onesignal/models/outcome_data.rb +285 -0
- data/lib/onesignal/models/platform_delivery_data.rb +264 -0
- data/lib/onesignal/models/player.rb +483 -9
- data/lib/onesignal/models/player_notification_target.rb +329 -0
- data/lib/onesignal/models/player_slice.rb +247 -0
- data/lib/onesignal/models/purchase.rb +254 -0
- data/lib/onesignal/models/segment.rb +251 -0
- data/lib/onesignal/models/segment_notification_target.rb +233 -0
- data/lib/onesignal/models/string_map.rb +644 -0
- data/lib/onesignal/models/update_player_tags_request_body.rb +219 -0
- data/lib/onesignal/version.rb +13 -1
- data/onesignal.gemspec +36 -27
- data/spec/api/default_api_spec.rb +285 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/app_spec.rb +212 -0
- data/spec/models/button_spec.rb +46 -0
- data/spec/models/delivery_data_spec.rb +58 -0
- data/spec/models/export_players_request_body_spec.rb +46 -0
- data/spec/models/filter_expressions_spec.rb +66 -0
- data/spec/models/filter_notification_target_spec.rb +100 -0
- data/spec/models/filter_spec.rb +56 -0
- data/spec/models/get_notification_request_body_spec.rb +50 -0
- data/spec/models/inline_response2001_spec.rb +34 -0
- data/spec/models/inline_response2002_spec.rb +40 -0
- data/spec/models/inline_response2003_spec.rb +34 -0
- data/spec/models/inline_response2004_spec.rb +40 -0
- data/spec/models/inline_response2005_spec.rb +34 -0
- data/spec/models/inline_response200_spec.rb +52 -0
- data/spec/models/inline_response201_spec.rb +40 -0
- data/spec/models/inline_response4001_spec.rb +40 -0
- data/spec/models/inline_response4002_spec.rb +34 -0
- data/spec/models/inline_response400_spec.rb +34 -0
- data/spec/models/inline_response409_spec.rb +40 -0
- data/spec/models/notification_all_of_android_background_layout_spec.rb +46 -0
- data/spec/models/notification_all_of_spec.rb +560 -0
- data/spec/models/notification_slice_spec.rb +52 -0
- data/spec/models/notification_spec.rb +704 -0
- data/spec/models/notification_target_spec.rb +172 -0
- data/spec/models/operator_spec.rb +38 -0
- data/spec/models/outcome_data_spec.rb +50 -0
- data/spec/models/platform_delivery_data_spec.rb +64 -0
- data/spec/models/player_notification_target_spec.rb +88 -0
- data/spec/models/player_slice_spec.rb +52 -0
- data/spec/models/player_spec.rb +190 -0
- data/spec/models/purchase_spec.rb +46 -0
- data/spec/models/segment_notification_target_spec.rb +40 -0
- data/spec/models/segment_spec.rb +46 -0
- data/spec/models/string_map_spec.rb +286 -0
- data/spec/models/update_player_tags_request_body_spec.rb +34 -0
- data/spec/spec_helper.rb +111 -0
- metadata +182 -65
- data/.gitignore +0 -10
- data/.rubocop.yml +0 -17
- data/.travis.yml +0 -16
- data/CHANGELOG.md +0 -22
- data/CODE_OF_CONDUCT.md +0 -49
- data/LICENSE +0 -21
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/onesignal/app_id_missing_error.rb +0 -7
- data/lib/onesignal/client.rb +0 -44
- data/lib/onesignal/models/base_model.rb +0 -40
- data/lib/onesignal/request.rb +0 -94
- data/lib/onesignal/request_error.rb +0 -21
- data/lib/onesignal/resources/app_resource.rb +0 -27
- data/lib/onesignal/resources/base_resource.rb +0 -35
- data/lib/onesignal/resources/notification_resource.rb +0 -33
- data/lib/onesignal/resources/player_resource.rb +0 -53
- data/lib/onesignal.rb +0 -23
@@ -0,0 +1,494 @@
|
|
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'
|
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
|
+
self.class.openapi_types.each_pair do |key, type|
|
387
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
388
|
+
self.send("#{key}=", nil)
|
389
|
+
elsif type =~ /\AArray<(.*)>/i
|
390
|
+
# check to ensure the input is an array given that the attribute
|
391
|
+
# is documented as an array but the input is not
|
392
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
393
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
394
|
+
end
|
395
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
396
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
397
|
+
end
|
398
|
+
end
|
399
|
+
|
400
|
+
self
|
401
|
+
end
|
402
|
+
|
403
|
+
# Deserializes the data based on type
|
404
|
+
# @param string type Data type
|
405
|
+
# @param string value Value to be deserialized
|
406
|
+
# @return [Object] Deserialized data
|
407
|
+
def _deserialize(type, value)
|
408
|
+
case type.to_sym
|
409
|
+
when :Time
|
410
|
+
Time.parse(value)
|
411
|
+
when :Date
|
412
|
+
Date.parse(value)
|
413
|
+
when :String
|
414
|
+
value.to_s
|
415
|
+
when :Integer
|
416
|
+
value.to_i
|
417
|
+
when :Float
|
418
|
+
value.to_f
|
419
|
+
when :Boolean
|
420
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
421
|
+
true
|
422
|
+
else
|
423
|
+
false
|
424
|
+
end
|
425
|
+
when :Object
|
426
|
+
# generic object (usually a Hash), return directly
|
427
|
+
value
|
428
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
429
|
+
inner_type = Regexp.last_match[:inner_type]
|
430
|
+
value.map { |v| _deserialize(inner_type, v) }
|
431
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
432
|
+
k_type = Regexp.last_match[:k_type]
|
433
|
+
v_type = Regexp.last_match[:v_type]
|
434
|
+
{}.tap do |hash|
|
435
|
+
value.each do |k, v|
|
436
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
437
|
+
end
|
438
|
+
end
|
439
|
+
else # model
|
440
|
+
# models (e.g. Pet) or oneOf
|
441
|
+
klass = OneSignal.const_get(type)
|
442
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
443
|
+
end
|
444
|
+
end
|
445
|
+
|
446
|
+
# Returns the string representation of the object
|
447
|
+
# @return [String] String presentation of the object
|
448
|
+
def to_s
|
449
|
+
to_hash.to_s
|
450
|
+
end
|
451
|
+
|
452
|
+
# to_body is an alias to to_hash (backward compatibility)
|
453
|
+
# @return [Hash] Returns the object in the form of hash
|
454
|
+
def to_body
|
455
|
+
to_hash
|
456
|
+
end
|
457
|
+
|
458
|
+
# Returns the object in the form of hash
|
459
|
+
# @return [Hash] Returns the object in the form of hash
|
460
|
+
def to_hash
|
461
|
+
hash = {}
|
462
|
+
self.class.attribute_map.each_pair do |attr, param|
|
463
|
+
value = self.send(attr)
|
464
|
+
if value.nil?
|
465
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
466
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
467
|
+
end
|
468
|
+
|
469
|
+
hash[param] = _to_hash(value)
|
470
|
+
end
|
471
|
+
hash
|
472
|
+
end
|
473
|
+
|
474
|
+
# Outputs non-array value in the form of hash
|
475
|
+
# For object, use to_hash. Otherwise, just return the value
|
476
|
+
# @param [Object] value Any valid value
|
477
|
+
# @return [Hash] Returns the value in the form of hash
|
478
|
+
def _to_hash(value)
|
479
|
+
if value.is_a?(Array)
|
480
|
+
value.compact.map { |v| _to_hash(v) }
|
481
|
+
elsif value.is_a?(Hash)
|
482
|
+
{}.tap do |hash|
|
483
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
484
|
+
end
|
485
|
+
elsif value.respond_to? :to_hash
|
486
|
+
value.to_hash
|
487
|
+
else
|
488
|
+
value
|
489
|
+
end
|
490
|
+
end
|
491
|
+
|
492
|
+
end
|
493
|
+
|
494
|
+
end
|