onesignal 0.2.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +14 -0
- data/Gemfile +6 -1
- data/LICENSE +6 -3
- data/README.md +144 -99
- data/RELEASE_INSTRUCTIONS.md +11 -0
- 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/InlineResponse2005.md +20 -0
- data/docs/InlineResponse2007.md +18 -0
- data/docs/InlineResponse2008.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 +20 -0
- data/docs/InlineResponse4003.md +18 -0
- data/docs/InvalidIdentifierError.md +20 -0
- data/docs/Notification.md +240 -0
- data/docs/Notification200Errors.md +49 -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/NotificationWithMeta.md +260 -0
- data/docs/NotificationWithMetaAllOf.md +38 -0
- data/docs/Operator.md +18 -0
- data/docs/OutcomeData.md +22 -0
- data/docs/OutcomesData.md +18 -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/lib/onesignal/api/default_api.rb +1365 -0
- data/lib/onesignal/api_client.rb +393 -0
- data/lib/onesignal/api_error.rb +57 -0
- data/lib/onesignal/configuration.rb +245 -0
- data/lib/onesignal/models/app.rb +519 -20
- data/lib/onesignal/models/button.rb +242 -0
- data/lib/onesignal/models/delivery_data.rb +260 -0
- data/lib/onesignal/models/export_players_request_body.rb +242 -0
- data/lib/onesignal/models/filter.rb +294 -0
- data/lib/onesignal/models/filter_expressions.rb +336 -0
- data/lib/onesignal/models/filter_notification_target.rb +330 -0
- data/lib/onesignal/models/get_notification_request_body.rb +273 -0
- data/lib/onesignal/models/inline_response200.rb +257 -0
- data/lib/onesignal/models/inline_response2001.rb +219 -0
- data/lib/onesignal/models/inline_response2002.rb +228 -0
- data/lib/onesignal/models/inline_response2005.rb +228 -0
- data/lib/onesignal/models/inline_response2007.rb +219 -0
- data/lib/onesignal/models/inline_response2008.rb +219 -0
- data/lib/onesignal/models/inline_response201.rb +229 -0
- data/lib/onesignal/models/inline_response400.rb +221 -0
- data/lib/onesignal/models/inline_response4001.rb +230 -0
- data/lib/onesignal/models/inline_response4002.rb +230 -0
- data/lib/onesignal/models/inline_response4003.rb +221 -0
- data/lib/onesignal/models/invalid_identifier_error.rb +234 -0
- data/lib/onesignal/models/notification.rb +1414 -9
- data/lib/onesignal/models/notification200_errors.rb +105 -0
- data/lib/onesignal/models/notification_all_of.rb +1144 -0
- data/lib/onesignal/models/notification_all_of_android_background_layout.rb +241 -0
- data/lib/onesignal/models/notification_slice.rb +248 -0
- data/lib/onesignal/models/notification_target.rb +495 -0
- data/lib/onesignal/models/notification_with_meta.rb +1526 -0
- data/lib/onesignal/models/notification_with_meta_all_of.rb +322 -0
- data/lib/onesignal/models/operator.rb +254 -0
- data/lib/onesignal/models/outcome_data.rb +286 -0
- data/lib/onesignal/models/outcomes_data.rb +221 -0
- data/lib/onesignal/models/platform_delivery_data.rb +265 -0
- data/lib/onesignal/models/player.rb +480 -13
- data/lib/onesignal/models/player_notification_target.rb +330 -0
- data/lib/onesignal/models/player_slice.rb +248 -0
- data/lib/onesignal/models/purchase.rb +255 -0
- data/lib/onesignal/models/segment.rb +252 -0
- data/lib/onesignal/models/segment_notification_target.rb +234 -0
- data/lib/onesignal/models/string_map.rb +640 -0
- data/lib/onesignal/models/update_player_tags_request_body.rb +220 -0
- data/lib/onesignal/version.rb +13 -1
- data/lib/onesignal.rb +73 -16
- data/onesignal.gemspec +37 -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_response2005_spec.rb +40 -0
- data/spec/models/inline_response2007_spec.rb +34 -0
- data/spec/models/inline_response2008_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 +40 -0
- data/spec/models/inline_response4003_spec.rb +34 -0
- data/spec/models/inline_response400_spec.rb +34 -0
- data/spec/models/invalid_identifier_error_spec.rb +40 -0
- data/spec/models/notification200_errors_spec.rb +31 -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/notification_with_meta_all_of_spec.rb +94 -0
- data/spec/models/notification_with_meta_spec.rb +764 -0
- data/spec/models/operator_spec.rb +38 -0
- data/spec/models/outcome_data_spec.rb +50 -0
- data/spec/models/outcomes_data_spec.rb +34 -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 +203 -64
- data/.gitignore +0 -10
- data/.rubocop.yml +0 -17
- data/.travis.yml +0 -16
- data/CODE_OF_CONDUCT.md +0 -49
- 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 -19
- 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
@@ -1,24 +1,491 @@
|
|
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
|
+
|
1
16
|
module OneSignal
|
2
|
-
class Player
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
17
|
+
class Player
|
18
|
+
# The device's OneSignal ID
|
19
|
+
attr_accessor :id
|
20
|
+
|
21
|
+
# If true, this is the equivalent of a user being Unsubscribed
|
22
|
+
attr_accessor :invalid_identifier
|
23
|
+
|
24
|
+
attr_accessor :app_id
|
25
|
+
|
26
|
+
# Required The device's platform: 0 = iOS 1 = Android 2 = Amazon 3 = WindowsPhone (MPNS) 4 = Chrome Apps / Extensions 5 = Chrome Web Push 6 = Windows (WNS) 7 = Safari 8 = Firefox 9 = MacOS 10 = Alexa 11 = Email 13 = For Huawei App Gallery Builds SDK Setup. Not for Huawei Devices using FCM 14 = SMS
|
27
|
+
attr_accessor :device_type
|
28
|
+
|
29
|
+
# a custom user ID
|
30
|
+
attr_accessor :external_user_id
|
31
|
+
|
32
|
+
# Only required if you have enabled Identity Verification and device_type is NOT 11 email.
|
33
|
+
attr_accessor :external_user_id_auth_hash
|
34
|
+
|
35
|
+
# Email - Only required if you have enabled Identity Verification and device_type is email (11).
|
36
|
+
attr_accessor :email_auth_hash
|
37
|
+
|
38
|
+
# Recommended: For Push Notifications, this is the Push Token Identifier from Google or Apple. For Apple Push identifiers, you must strip all non alphanumeric characters. Examples: iOS: 7abcd558f29d0b1f048083e2834ad8ea4b3d87d8ad9c088b33c132706ff445f0 Android: APA91bHbYHk7aq-Uam_2pyJ2qbZvqllyyh2wjfPRaw5gLEX2SUlQBRvOc6sck1sa7H7nGeLNlDco8lXj83HWWwzV... For Email Addresses, set the full email address email@email.com and make sure to set device_type to 11.
|
39
|
+
attr_accessor :identifier
|
40
|
+
|
41
|
+
# Language code. Typically lower case two letters, except for Chinese where it must be one of zh-Hans or zh-Hant. Example: en
|
42
|
+
attr_accessor :language
|
43
|
+
|
44
|
+
# Number of seconds away from UTC. Example: -28800
|
45
|
+
attr_accessor :timezone
|
46
|
+
|
47
|
+
# Version of your app. Example: 1.1
|
48
|
+
attr_accessor :game_version
|
49
|
+
|
50
|
+
# Device make and model. Example: iPhone5,1
|
51
|
+
attr_accessor :device_model
|
7
52
|
|
8
|
-
|
9
|
-
|
53
|
+
# Device operating system version. Example: 7.0.4
|
54
|
+
attr_accessor :device_os
|
55
|
+
|
56
|
+
# The ad id for the device's platform: Android = Advertising Id iOS = identifierForVendor WP8.0 = DeviceUniqueId WP8.1 = AdvertisingId
|
57
|
+
attr_accessor :ad_id
|
58
|
+
|
59
|
+
# Name and version of the sdk/plugin that's calling this API method (if any)
|
60
|
+
attr_accessor :sdk
|
61
|
+
|
62
|
+
# Number of times the user has played the game, defaults to 1
|
63
|
+
attr_accessor :session_count
|
64
|
+
|
65
|
+
# Custom tags for the player. Only support string and integer key value pairs. Does not support arrays or other nested objects. Setting a tag value to null or an empty string will remove the tag. Example: {\"foo\":\"bar\",\"this\":\"that\"} Limitations: - 100 tags per call - Android SDK users: tags cannot be removed or changed via API if set through SDK sendTag methods. Recommended to only tag devices with 1 kilobyte of data Please consider using your own Database to save more than 1 kilobyte of data. See: Internal Database & CRM
|
66
|
+
attr_accessor :tags
|
67
|
+
|
68
|
+
# Amount the user has spent in USD, up to two decimal places
|
69
|
+
attr_accessor :amount_spent
|
70
|
+
|
71
|
+
# Unixtime when the player joined the game
|
72
|
+
attr_accessor :created_at
|
73
|
+
|
74
|
+
# Seconds player was running your app.
|
75
|
+
attr_accessor :playtime
|
76
|
+
|
77
|
+
# Current iOS badge count displayed on the app icon NOTE: Not supported for apps created after June 2018, since badge count for apps created after this date are handled on the client.
|
78
|
+
attr_accessor :badge_count
|
79
|
+
|
80
|
+
# Unixtime when the player was last active
|
81
|
+
attr_accessor :last_active
|
82
|
+
|
83
|
+
# 1 = subscribed -2 = unsubscribed iOS - These values are set each time the user opens the app from the SDK. Use the SDK function set Subscription instead. Android - You may set this but you can no longer use the SDK method setSubscription later in your app as it will create synchronization issues.
|
84
|
+
attr_accessor :notification_types
|
85
|
+
|
86
|
+
# This is used in deciding whether to use your iOS Sandbox or Production push certificate when sending a push when both have been uploaded. Set to the iOS provisioning profile that was used to build your app. 1 = Development 2 = Ad-Hoc Omit this field for App Store builds.
|
87
|
+
attr_accessor :test_type
|
88
|
+
|
89
|
+
# Longitude of the device, used for geotagging to segment on.
|
90
|
+
attr_accessor :long
|
91
|
+
|
92
|
+
# Latitude of the device, used for geotagging to segment on.
|
93
|
+
attr_accessor :lat
|
94
|
+
|
95
|
+
# Country code in the ISO 3166-1 Alpha 2 format
|
96
|
+
attr_accessor :country
|
97
|
+
|
98
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
99
|
+
def self.attribute_map
|
100
|
+
{
|
101
|
+
:'id' => :'id',
|
102
|
+
:'invalid_identifier' => :'invalid_identifier',
|
103
|
+
:'app_id' => :'app_id',
|
104
|
+
:'device_type' => :'device_type',
|
105
|
+
:'external_user_id' => :'external_user_id',
|
106
|
+
:'external_user_id_auth_hash' => :'external_user_id_auth_hash',
|
107
|
+
:'email_auth_hash' => :'email_auth_hash',
|
108
|
+
:'identifier' => :'identifier',
|
109
|
+
:'language' => :'language',
|
110
|
+
:'timezone' => :'timezone',
|
111
|
+
:'game_version' => :'game_version',
|
112
|
+
:'device_model' => :'device_model',
|
113
|
+
:'device_os' => :'device_os',
|
114
|
+
:'ad_id' => :'ad_id',
|
115
|
+
:'sdk' => :'sdk',
|
116
|
+
:'session_count' => :'session_count',
|
117
|
+
:'tags' => :'tags',
|
118
|
+
:'amount_spent' => :'amount_spent',
|
119
|
+
:'created_at' => :'created_at',
|
120
|
+
:'playtime' => :'playtime',
|
121
|
+
:'badge_count' => :'badge_count',
|
122
|
+
:'last_active' => :'last_active',
|
123
|
+
:'notification_types' => :'notification_types',
|
124
|
+
:'test_type' => :'test_type',
|
125
|
+
:'long' => :'long',
|
126
|
+
:'lat' => :'lat',
|
127
|
+
:'country' => :'country'
|
128
|
+
}
|
10
129
|
end
|
11
130
|
|
12
|
-
|
13
|
-
|
14
|
-
|
131
|
+
# Returns all the JSON keys this model knows about
|
132
|
+
def self.acceptable_attributes
|
133
|
+
attribute_map.values
|
134
|
+
end
|
135
|
+
|
136
|
+
# Attribute type mapping.
|
137
|
+
def self.openapi_types
|
138
|
+
{
|
139
|
+
:'id' => :'String',
|
140
|
+
:'invalid_identifier' => :'Boolean',
|
141
|
+
:'app_id' => :'String',
|
142
|
+
:'device_type' => :'Integer',
|
143
|
+
:'external_user_id' => :'String',
|
144
|
+
:'external_user_id_auth_hash' => :'String',
|
145
|
+
:'email_auth_hash' => :'String',
|
146
|
+
:'identifier' => :'String',
|
147
|
+
:'language' => :'String',
|
148
|
+
:'timezone' => :'Integer',
|
149
|
+
:'game_version' => :'String',
|
150
|
+
:'device_model' => :'String',
|
151
|
+
:'device_os' => :'String',
|
152
|
+
:'ad_id' => :'String',
|
153
|
+
:'sdk' => :'String',
|
154
|
+
:'session_count' => :'Integer',
|
155
|
+
:'tags' => :'Object',
|
156
|
+
:'amount_spent' => :'Float',
|
157
|
+
:'created_at' => :'Integer',
|
158
|
+
:'playtime' => :'Integer',
|
159
|
+
:'badge_count' => :'Integer',
|
160
|
+
:'last_active' => :'Integer',
|
161
|
+
:'notification_types' => :'Integer',
|
162
|
+
:'test_type' => :'Integer',
|
163
|
+
:'long' => :'Float',
|
164
|
+
:'lat' => :'Float',
|
165
|
+
:'country' => :'String'
|
166
|
+
}
|
167
|
+
end
|
168
|
+
|
169
|
+
# List of attributes with nullable: true
|
170
|
+
def self.openapi_nullable
|
171
|
+
Set.new([
|
172
|
+
:'timezone',
|
173
|
+
:'test_type',
|
174
|
+
])
|
175
|
+
end
|
176
|
+
|
177
|
+
# Initializes the object
|
178
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
179
|
+
def initialize(attributes = {})
|
180
|
+
if (!attributes.is_a?(Hash))
|
181
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::Player` initialize method"
|
182
|
+
end
|
183
|
+
|
184
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
185
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
186
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
187
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::Player`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
188
|
+
end
|
189
|
+
h[k.to_sym] = v
|
190
|
+
}
|
191
|
+
|
192
|
+
if attributes.key?(:'id')
|
193
|
+
self.id = attributes[:'id']
|
194
|
+
end
|
195
|
+
|
196
|
+
if attributes.key?(:'invalid_identifier')
|
197
|
+
self.invalid_identifier = attributes[:'invalid_identifier']
|
198
|
+
end
|
199
|
+
|
200
|
+
if attributes.key?(:'app_id')
|
201
|
+
self.app_id = attributes[:'app_id']
|
202
|
+
end
|
203
|
+
|
204
|
+
if attributes.key?(:'device_type')
|
205
|
+
self.device_type = attributes[:'device_type']
|
206
|
+
end
|
207
|
+
|
208
|
+
if attributes.key?(:'external_user_id')
|
209
|
+
self.external_user_id = attributes[:'external_user_id']
|
15
210
|
end
|
16
211
|
|
17
|
-
|
212
|
+
if attributes.key?(:'external_user_id_auth_hash')
|
213
|
+
self.external_user_id_auth_hash = attributes[:'external_user_id_auth_hash']
|
214
|
+
end
|
215
|
+
|
216
|
+
if attributes.key?(:'email_auth_hash')
|
217
|
+
self.email_auth_hash = attributes[:'email_auth_hash']
|
218
|
+
end
|
219
|
+
|
220
|
+
if attributes.key?(:'identifier')
|
221
|
+
self.identifier = attributes[:'identifier']
|
222
|
+
end
|
223
|
+
|
224
|
+
if attributes.key?(:'language')
|
225
|
+
self.language = attributes[:'language']
|
226
|
+
end
|
227
|
+
|
228
|
+
if attributes.key?(:'timezone')
|
229
|
+
self.timezone = attributes[:'timezone']
|
230
|
+
end
|
231
|
+
|
232
|
+
if attributes.key?(:'game_version')
|
233
|
+
self.game_version = attributes[:'game_version']
|
234
|
+
end
|
235
|
+
|
236
|
+
if attributes.key?(:'device_model')
|
237
|
+
self.device_model = attributes[:'device_model']
|
238
|
+
end
|
239
|
+
|
240
|
+
if attributes.key?(:'device_os')
|
241
|
+
self.device_os = attributes[:'device_os']
|
242
|
+
end
|
243
|
+
|
244
|
+
if attributes.key?(:'ad_id')
|
245
|
+
self.ad_id = attributes[:'ad_id']
|
246
|
+
end
|
247
|
+
|
248
|
+
if attributes.key?(:'sdk')
|
249
|
+
self.sdk = attributes[:'sdk']
|
250
|
+
end
|
251
|
+
|
252
|
+
if attributes.key?(:'session_count')
|
253
|
+
self.session_count = attributes[:'session_count']
|
254
|
+
end
|
255
|
+
|
256
|
+
if attributes.key?(:'tags')
|
257
|
+
self.tags = attributes[:'tags']
|
258
|
+
end
|
259
|
+
|
260
|
+
if attributes.key?(:'amount_spent')
|
261
|
+
self.amount_spent = attributes[:'amount_spent']
|
262
|
+
end
|
263
|
+
|
264
|
+
if attributes.key?(:'created_at')
|
265
|
+
self.created_at = attributes[:'created_at']
|
266
|
+
end
|
267
|
+
|
268
|
+
if attributes.key?(:'playtime')
|
269
|
+
self.playtime = attributes[:'playtime']
|
270
|
+
end
|
271
|
+
|
272
|
+
if attributes.key?(:'badge_count')
|
273
|
+
self.badge_count = attributes[:'badge_count']
|
274
|
+
end
|
275
|
+
|
276
|
+
if attributes.key?(:'last_active')
|
277
|
+
self.last_active = attributes[:'last_active']
|
278
|
+
end
|
279
|
+
|
280
|
+
if attributes.key?(:'notification_types')
|
281
|
+
self.notification_types = attributes[:'notification_types']
|
282
|
+
end
|
283
|
+
|
284
|
+
if attributes.key?(:'test_type')
|
285
|
+
self.test_type = attributes[:'test_type']
|
286
|
+
end
|
287
|
+
|
288
|
+
if attributes.key?(:'long')
|
289
|
+
self.long = attributes[:'long']
|
290
|
+
end
|
291
|
+
|
292
|
+
if attributes.key?(:'lat')
|
293
|
+
self.lat = attributes[:'lat']
|
294
|
+
end
|
295
|
+
|
296
|
+
if attributes.key?(:'country')
|
297
|
+
self.country = attributes[:'country']
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
302
|
+
# @return Array for valid properties with the reasons
|
303
|
+
def list_invalid_properties
|
304
|
+
invalid_properties = Array.new
|
305
|
+
if @id.nil?
|
306
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
307
|
+
end
|
308
|
+
|
309
|
+
if @device_type.nil?
|
310
|
+
invalid_properties.push('invalid value for "device_type", device_type cannot be nil.')
|
311
|
+
end
|
312
|
+
|
313
|
+
invalid_properties
|
314
|
+
end
|
315
|
+
|
316
|
+
# Check to see if the all the properties in the model are valid
|
317
|
+
# @return true if the model is valid
|
318
|
+
def valid?
|
319
|
+
return false if @id.nil?
|
320
|
+
return false if @device_type.nil?
|
321
|
+
true
|
322
|
+
end
|
323
|
+
|
324
|
+
# Checks equality by comparing each attribute.
|
325
|
+
# @param [Object] Object to be compared
|
326
|
+
def ==(o)
|
327
|
+
return true if self.equal?(o)
|
328
|
+
self.class == o.class &&
|
329
|
+
id == o.id &&
|
330
|
+
invalid_identifier == o.invalid_identifier &&
|
331
|
+
app_id == o.app_id &&
|
332
|
+
device_type == o.device_type &&
|
333
|
+
external_user_id == o.external_user_id &&
|
334
|
+
external_user_id_auth_hash == o.external_user_id_auth_hash &&
|
335
|
+
email_auth_hash == o.email_auth_hash &&
|
336
|
+
identifier == o.identifier &&
|
337
|
+
language == o.language &&
|
338
|
+
timezone == o.timezone &&
|
339
|
+
game_version == o.game_version &&
|
340
|
+
device_model == o.device_model &&
|
341
|
+
device_os == o.device_os &&
|
342
|
+
ad_id == o.ad_id &&
|
343
|
+
sdk == o.sdk &&
|
344
|
+
session_count == o.session_count &&
|
345
|
+
tags == o.tags &&
|
346
|
+
amount_spent == o.amount_spent &&
|
347
|
+
created_at == o.created_at &&
|
348
|
+
playtime == o.playtime &&
|
349
|
+
badge_count == o.badge_count &&
|
350
|
+
last_active == o.last_active &&
|
351
|
+
notification_types == o.notification_types &&
|
352
|
+
test_type == o.test_type &&
|
353
|
+
long == o.long &&
|
354
|
+
lat == o.lat &&
|
355
|
+
country == o.country
|
356
|
+
end
|
357
|
+
|
358
|
+
# @see the `==` method
|
359
|
+
# @param [Object] Object to be compared
|
360
|
+
def eql?(o)
|
361
|
+
self == o
|
362
|
+
end
|
363
|
+
|
364
|
+
# Calculates hash code according to all attributes.
|
365
|
+
# @return [Integer] Hash code
|
366
|
+
def hash
|
367
|
+
[id, invalid_identifier, app_id, device_type, external_user_id, external_user_id_auth_hash, email_auth_hash, identifier, language, timezone, game_version, device_model, device_os, ad_id, sdk, session_count, tags, amount_spent, created_at, playtime, badge_count, last_active, notification_types, test_type, long, lat, country].hash
|
368
|
+
end
|
369
|
+
|
370
|
+
# Builds the object from hash
|
371
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
372
|
+
# @return [Object] Returns the model itself
|
373
|
+
def self.build_from_hash(attributes)
|
374
|
+
new.build_from_hash(attributes)
|
18
375
|
end
|
19
376
|
|
20
|
-
|
21
|
-
|
377
|
+
# Builds the object from hash
|
378
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
379
|
+
# @return [Object] Returns the model itself
|
380
|
+
def build_from_hash(attributes)
|
381
|
+
return nil unless attributes.is_a?(Hash)
|
382
|
+
attributes = attributes.transform_keys(&:to_sym)
|
383
|
+
self.class.openapi_types.each_pair do |key, type|
|
384
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
385
|
+
self.send("#{key}=", nil)
|
386
|
+
elsif type =~ /\AArray<(.*)>/i
|
387
|
+
# check to ensure the input is an array given that the attribute
|
388
|
+
# is documented as an array but the input is not
|
389
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
390
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
391
|
+
end
|
392
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
393
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
394
|
+
end
|
395
|
+
end
|
396
|
+
|
397
|
+
self
|
22
398
|
end
|
399
|
+
|
400
|
+
# Deserializes the data based on type
|
401
|
+
# @param string type Data type
|
402
|
+
# @param string value Value to be deserialized
|
403
|
+
# @return [Object] Deserialized data
|
404
|
+
def _deserialize(type, value)
|
405
|
+
case type.to_sym
|
406
|
+
when :Time
|
407
|
+
Time.parse(value)
|
408
|
+
when :Date
|
409
|
+
Date.parse(value)
|
410
|
+
when :String
|
411
|
+
value.to_s
|
412
|
+
when :Integer
|
413
|
+
value.to_i
|
414
|
+
when :Float
|
415
|
+
value.to_f
|
416
|
+
when :Boolean
|
417
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
418
|
+
true
|
419
|
+
else
|
420
|
+
false
|
421
|
+
end
|
422
|
+
when :Object
|
423
|
+
# generic object (usually a Hash), return directly
|
424
|
+
value
|
425
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
426
|
+
inner_type = Regexp.last_match[:inner_type]
|
427
|
+
value.map { |v| _deserialize(inner_type, v) }
|
428
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
429
|
+
k_type = Regexp.last_match[:k_type]
|
430
|
+
v_type = Regexp.last_match[:v_type]
|
431
|
+
{}.tap do |hash|
|
432
|
+
value.each do |k, v|
|
433
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
434
|
+
end
|
435
|
+
end
|
436
|
+
else # model
|
437
|
+
# models (e.g. Pet) or oneOf
|
438
|
+
klass = OneSignal.const_get(type)
|
439
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
440
|
+
end
|
441
|
+
end
|
442
|
+
|
443
|
+
# Returns the string representation of the object
|
444
|
+
# @return [String] String presentation of the object
|
445
|
+
def to_s
|
446
|
+
to_hash.to_s
|
447
|
+
end
|
448
|
+
|
449
|
+
# to_body is an alias to to_hash (backward compatibility)
|
450
|
+
# @return [Hash] Returns the object in the form of hash
|
451
|
+
def to_body
|
452
|
+
to_hash
|
453
|
+
end
|
454
|
+
|
455
|
+
# Returns the object in the form of hash
|
456
|
+
# @return [Hash] Returns the object in the form of hash
|
457
|
+
def to_hash
|
458
|
+
hash = {}
|
459
|
+
self.class.attribute_map.each_pair do |attr, param|
|
460
|
+
value = self.send(attr)
|
461
|
+
if value.nil?
|
462
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
463
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
464
|
+
end
|
465
|
+
|
466
|
+
hash[param] = _to_hash(value)
|
467
|
+
end
|
468
|
+
hash
|
469
|
+
end
|
470
|
+
|
471
|
+
# Outputs non-array value in the form of hash
|
472
|
+
# For object, use to_hash. Otherwise, just return the value
|
473
|
+
# @param [Object] value Any valid value
|
474
|
+
# @return [Hash] Returns the value in the form of hash
|
475
|
+
def _to_hash(value)
|
476
|
+
if value.is_a?(Array)
|
477
|
+
value.compact.map { |v| _to_hash(v) }
|
478
|
+
elsif value.is_a?(Hash)
|
479
|
+
{}.tap do |hash|
|
480
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
481
|
+
end
|
482
|
+
elsif value.respond_to? :to_hash
|
483
|
+
value.to_hash
|
484
|
+
else
|
485
|
+
value
|
486
|
+
end
|
487
|
+
end
|
488
|
+
|
23
489
|
end
|
490
|
+
|
24
491
|
end
|