onesignal_sdk 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +31 -0
  3. data/Gemfile +9 -0
  4. data/LICENSE +24 -0
  5. data/README.md +210 -0
  6. data/RELEASE_INSTRUCTIONS.md +11 -0
  7. data/Rakefile +10 -0
  8. data/docs/App.md +84 -0
  9. data/docs/BasicNotification.md +228 -0
  10. data/docs/BasicNotificationAllOf.md +200 -0
  11. data/docs/BasicNotificationAllOfAndroidBackgroundLayout.md +22 -0
  12. data/docs/BeginLiveActivityRequest.md +20 -0
  13. data/docs/Button.md +22 -0
  14. data/docs/CancelNotificationSuccessResponse.md +18 -0
  15. data/docs/CreateNotificationSuccessResponse.md +24 -0
  16. data/docs/CreatePlayerSuccessResponse.md +20 -0
  17. data/docs/CreateSegmentConflictResponse.md +20 -0
  18. data/docs/CreateSegmentSuccessResponse.md +20 -0
  19. data/docs/CreateSubscriptionRequestBody.md +20 -0
  20. data/docs/CreateUserConflictResponse.md +18 -0
  21. data/docs/CreateUserConflictResponseErrorsInner.md +22 -0
  22. data/docs/CreateUserConflictResponseErrorsItemsMeta.md +18 -0
  23. data/docs/DefaultApi.md +2713 -0
  24. data/docs/DeletePlayerNotFoundResponse.md +18 -0
  25. data/docs/DeletePlayerSuccessResponse.md +18 -0
  26. data/docs/DeleteSegmentNotFoundResponse.md +18 -0
  27. data/docs/DeleteSegmentSuccessResponse.md +18 -0
  28. data/docs/DeliveryData.md +26 -0
  29. data/docs/ExportEventsSuccessResponse.md +18 -0
  30. data/docs/ExportPlayersRequestBody.md +22 -0
  31. data/docs/ExportPlayersSuccessResponse.md +18 -0
  32. data/docs/Filter.md +24 -0
  33. data/docs/FilterExpressions.md +26 -0
  34. data/docs/GenericError.md +18 -0
  35. data/docs/GenericErrorErrorsInner.md +20 -0
  36. data/docs/GetNotificationRequestBody.md +22 -0
  37. data/docs/InlineResponse200.md +18 -0
  38. data/docs/InlineResponse2003.md +18 -0
  39. data/docs/InlineResponse201.md +18 -0
  40. data/docs/InlineResponse202.md +18 -0
  41. data/docs/InvalidIdentifierError.md +20 -0
  42. data/docs/Notification.md +230 -0
  43. data/docs/Notification200Errors.md +49 -0
  44. data/docs/NotificationAllOf.md +18 -0
  45. data/docs/NotificationHistorySuccessResponse.md +20 -0
  46. data/docs/NotificationSlice.md +24 -0
  47. data/docs/NotificationTarget.md +44 -0
  48. data/docs/NotificationWithMeta.md +250 -0
  49. data/docs/NotificationWithMetaAllOf.md +38 -0
  50. data/docs/Operator.md +18 -0
  51. data/docs/OutcomeData.md +22 -0
  52. data/docs/OutcomesData.md +18 -0
  53. data/docs/PlatformDeliveryData.md +32 -0
  54. data/docs/PlatformDeliveryDataEmailAllOf.md +30 -0
  55. data/docs/PlatformDeliveryDataSmsAllOf.md +22 -0
  56. data/docs/Player.md +70 -0
  57. data/docs/PlayerNotificationTarget.md +40 -0
  58. data/docs/PlayerNotificationTargetIncludeAliases.md +18 -0
  59. data/docs/PlayerSlice.md +24 -0
  60. data/docs/PropertiesDeltas.md +22 -0
  61. data/docs/PropertiesObject.md +38 -0
  62. data/docs/Purchase.md +24 -0
  63. data/docs/RateLimiterError.md +18 -0
  64. data/docs/Segment.md +22 -0
  65. data/docs/SegmentNotificationTarget.md +20 -0
  66. data/docs/StringMap.md +102 -0
  67. data/docs/SubscriptionObject.md +50 -0
  68. data/docs/TransferSubscriptionRequestBody.md +18 -0
  69. data/docs/UpdateLiveActivityRequest.md +24 -0
  70. data/docs/UpdateLiveActivitySuccessResponse.md +20 -0
  71. data/docs/UpdatePlayerSuccessResponse.md +18 -0
  72. data/docs/UpdatePlayerTagsRequestBody.md +18 -0
  73. data/docs/UpdatePlayerTagsSuccessResponse.md +18 -0
  74. data/docs/UpdateSubscriptionRequestBody.md +18 -0
  75. data/docs/UpdateUserRequest.md +22 -0
  76. data/docs/User.md +24 -0
  77. data/docs/UserIdentityRequestBody.md +18 -0
  78. data/docs/UserIdentityResponse.md +18 -0
  79. data/docs/UserSubscriptionOptions.md +18 -0
  80. data/lib/onesignal/api/default_api.rb +2727 -0
  81. data/lib/onesignal/api_client.rb +393 -0
  82. data/lib/onesignal/api_error.rb +57 -0
  83. data/lib/onesignal/configuration.rb +245 -0
  84. data/lib/onesignal/models/app.rb +586 -0
  85. data/lib/onesignal/models/basic_notification.rb +1431 -0
  86. data/lib/onesignal/models/basic_notification_all_of.rb +1241 -0
  87. data/lib/onesignal/models/basic_notification_all_of_android_background_layout.rb +241 -0
  88. data/lib/onesignal/models/begin_live_activity_request.rb +238 -0
  89. data/lib/onesignal/models/button.rb +242 -0
  90. data/lib/onesignal/models/cancel_notification_success_response.rb +219 -0
  91. data/lib/onesignal/models/create_notification_success_response.rb +248 -0
  92. data/lib/onesignal/models/create_player_success_response.rb +228 -0
  93. data/lib/onesignal/models/create_segment_conflict_response.rb +230 -0
  94. data/lib/onesignal/models/create_segment_success_response.rb +229 -0
  95. data/lib/onesignal/models/create_subscription_request_body.rb +228 -0
  96. data/lib/onesignal/models/create_user_conflict_response.rb +221 -0
  97. data/lib/onesignal/models/create_user_conflict_response_errors_inner.rb +237 -0
  98. data/lib/onesignal/models/create_user_conflict_response_errors_items_meta.rb +219 -0
  99. data/lib/onesignal/models/delete_player_not_found_response.rb +219 -0
  100. data/lib/onesignal/models/delete_player_success_response.rb +219 -0
  101. data/lib/onesignal/models/delete_segment_not_found_response.rb +219 -0
  102. data/lib/onesignal/models/delete_segment_success_response.rb +219 -0
  103. data/lib/onesignal/models/delivery_data.rb +265 -0
  104. data/lib/onesignal/models/export_events_success_response.rb +219 -0
  105. data/lib/onesignal/models/export_players_request_body.rb +242 -0
  106. data/lib/onesignal/models/export_players_success_response.rb +219 -0
  107. data/lib/onesignal/models/filter.rb +294 -0
  108. data/lib/onesignal/models/filter_expressions.rb +336 -0
  109. data/lib/onesignal/models/generic_error.rb +221 -0
  110. data/lib/onesignal/models/generic_error_errors_inner.rb +228 -0
  111. data/lib/onesignal/models/get_notification_request_body.rb +273 -0
  112. data/lib/onesignal/models/inline_response200.rb +221 -0
  113. data/lib/onesignal/models/inline_response2003.rb +221 -0
  114. data/lib/onesignal/models/inline_response201.rb +219 -0
  115. data/lib/onesignal/models/inline_response202.rb +219 -0
  116. data/lib/onesignal/models/invalid_identifier_error.rb +234 -0
  117. data/lib/onesignal/models/notification.rb +1442 -0
  118. data/lib/onesignal/models/notification200_errors.rb +105 -0
  119. data/lib/onesignal/models/notification_all_of.rb +221 -0
  120. data/lib/onesignal/models/notification_history_success_response.rb +228 -0
  121. data/lib/onesignal/models/notification_slice.rb +248 -0
  122. data/lib/onesignal/models/notification_target.rb +429 -0
  123. data/lib/onesignal/models/notification_with_meta.rb +1546 -0
  124. data/lib/onesignal/models/notification_with_meta_all_of.rb +323 -0
  125. data/lib/onesignal/models/operator.rb +254 -0
  126. data/lib/onesignal/models/outcome_data.rb +286 -0
  127. data/lib/onesignal/models/outcomes_data.rb +221 -0
  128. data/lib/onesignal/models/platform_delivery_data.rb +285 -0
  129. data/lib/onesignal/models/platform_delivery_data_email_all_of.rb +287 -0
  130. data/lib/onesignal/models/platform_delivery_data_sms_all_of.rb +243 -0
  131. data/lib/onesignal/models/player.rb +494 -0
  132. data/lib/onesignal/models/player_notification_target.rb +385 -0
  133. data/lib/onesignal/models/player_notification_target_include_aliases.rb +221 -0
  134. data/lib/onesignal/models/player_slice.rb +248 -0
  135. data/lib/onesignal/models/properties_deltas.rb +239 -0
  136. data/lib/onesignal/models/properties_object.rb +313 -0
  137. data/lib/onesignal/models/purchase.rb +264 -0
  138. data/lib/onesignal/models/rate_limiter_error.rb +221 -0
  139. data/lib/onesignal/models/segment.rb +252 -0
  140. data/lib/onesignal/models/segment_notification_target.rb +234 -0
  141. data/lib/onesignal/models/string_map.rb +640 -0
  142. data/lib/onesignal/models/subscription_object.rb +397 -0
  143. data/lib/onesignal/models/transfer_subscription_request_body.rb +221 -0
  144. data/lib/onesignal/models/update_live_activity_request.rb +309 -0
  145. data/lib/onesignal/models/update_live_activity_success_response.rb +228 -0
  146. data/lib/onesignal/models/update_player_success_response.rb +219 -0
  147. data/lib/onesignal/models/update_player_tags_request_body.rb +220 -0
  148. data/lib/onesignal/models/update_player_tags_success_response.rb +219 -0
  149. data/lib/onesignal/models/update_subscription_request_body.rb +219 -0
  150. data/lib/onesignal/models/update_user_request.rb +239 -0
  151. data/lib/onesignal/models/user.rb +250 -0
  152. data/lib/onesignal/models/user_identity_request_body.rb +221 -0
  153. data/lib/onesignal/models/user_identity_response.rb +221 -0
  154. data/lib/onesignal/models/user_subscription_options.rb +219 -0
  155. data/lib/onesignal/version.rb +15 -0
  156. data/lib/onesignal.rb +111 -0
  157. data/onesignal.gemspec +38 -0
  158. data/spec/api/default_api_spec.rb +522 -0
  159. data/spec/api_client_spec.rb +226 -0
  160. data/spec/configuration_spec.rb +42 -0
  161. data/spec/models/app_spec.rb +236 -0
  162. data/spec/models/basic_notification_all_of_android_background_layout_spec.rb +46 -0
  163. data/spec/models/basic_notification_all_of_spec.rb +584 -0
  164. data/spec/models/basic_notification_spec.rb +672 -0
  165. data/spec/models/begin_live_activity_request_spec.rb +40 -0
  166. data/spec/models/button_spec.rb +46 -0
  167. data/spec/models/cancel_notification_success_response_spec.rb +34 -0
  168. data/spec/models/create_notification_success_response_spec.rb +52 -0
  169. data/spec/models/create_player_success_response_spec.rb +40 -0
  170. data/spec/models/create_segment_conflict_response_spec.rb +40 -0
  171. data/spec/models/create_segment_success_response_spec.rb +40 -0
  172. data/spec/models/create_subscription_request_body_spec.rb +40 -0
  173. data/spec/models/create_user_conflict_response_errors_inner_spec.rb +46 -0
  174. data/spec/models/create_user_conflict_response_errors_items_meta_spec.rb +34 -0
  175. data/spec/models/create_user_conflict_response_spec.rb +34 -0
  176. data/spec/models/delete_player_not_found_response_spec.rb +34 -0
  177. data/spec/models/delete_player_success_response_spec.rb +34 -0
  178. data/spec/models/delete_segment_not_found_response_spec.rb +34 -0
  179. data/spec/models/delete_segment_success_response_spec.rb +34 -0
  180. data/spec/models/delivery_data_spec.rb +58 -0
  181. data/spec/models/export_events_success_response_spec.rb +34 -0
  182. data/spec/models/export_players_request_body_spec.rb +46 -0
  183. data/spec/models/export_players_success_response_spec.rb +34 -0
  184. data/spec/models/filter_expressions_spec.rb +66 -0
  185. data/spec/models/filter_spec.rb +56 -0
  186. data/spec/models/generic_error_errors_inner_spec.rb +40 -0
  187. data/spec/models/generic_error_spec.rb +34 -0
  188. data/spec/models/get_notification_request_body_spec.rb +50 -0
  189. data/spec/models/inline_response2003_spec.rb +34 -0
  190. data/spec/models/inline_response200_spec.rb +34 -0
  191. data/spec/models/inline_response201_spec.rb +34 -0
  192. data/spec/models/inline_response202_spec.rb +34 -0
  193. data/spec/models/invalid_identifier_error_spec.rb +40 -0
  194. data/spec/models/notification200_errors_spec.rb +31 -0
  195. data/spec/models/notification_all_of_spec.rb +34 -0
  196. data/spec/models/notification_history_success_response_spec.rb +40 -0
  197. data/spec/models/notification_slice_spec.rb +52 -0
  198. data/spec/models/notification_spec.rb +678 -0
  199. data/spec/models/notification_target_spec.rb +116 -0
  200. data/spec/models/notification_with_meta_all_of_spec.rb +94 -0
  201. data/spec/models/notification_with_meta_spec.rb +738 -0
  202. data/spec/models/operator_spec.rb +38 -0
  203. data/spec/models/outcome_data_spec.rb +50 -0
  204. data/spec/models/outcomes_data_spec.rb +34 -0
  205. data/spec/models/platform_delivery_data_email_all_of_spec.rb +70 -0
  206. data/spec/models/platform_delivery_data_sms_all_of_spec.rb +46 -0
  207. data/spec/models/platform_delivery_data_spec.rb +76 -0
  208. data/spec/models/player_notification_target_include_aliases_spec.rb +34 -0
  209. data/spec/models/player_notification_target_spec.rb +104 -0
  210. data/spec/models/player_slice_spec.rb +52 -0
  211. data/spec/models/player_spec.rb +190 -0
  212. data/spec/models/properties_deltas_spec.rb +46 -0
  213. data/spec/models/properties_object_spec.rb +94 -0
  214. data/spec/models/purchase_spec.rb +52 -0
  215. data/spec/models/rate_limiter_error_spec.rb +34 -0
  216. data/spec/models/segment_notification_target_spec.rb +40 -0
  217. data/spec/models/segment_spec.rb +46 -0
  218. data/spec/models/string_map_spec.rb +286 -0
  219. data/spec/models/subscription_object_spec.rb +134 -0
  220. data/spec/models/transfer_subscription_request_body_spec.rb +34 -0
  221. data/spec/models/update_live_activity_request_spec.rb +60 -0
  222. data/spec/models/update_live_activity_success_response_spec.rb +40 -0
  223. data/spec/models/update_player_success_response_spec.rb +34 -0
  224. data/spec/models/update_player_tags_request_body_spec.rb +34 -0
  225. data/spec/models/update_player_tags_success_response_spec.rb +34 -0
  226. data/spec/models/update_subscription_request_body_spec.rb +34 -0
  227. data/spec/models/update_user_request_spec.rb +46 -0
  228. data/spec/models/user_identity_request_body_spec.rb +34 -0
  229. data/spec/models/user_identity_response_spec.rb +34 -0
  230. data/spec/models/user_spec.rb +52 -0
  231. data/spec/models/user_subscription_options_spec.rb +34 -0
  232. data/spec/spec_helper.rb +111 -0
  233. metadata +389 -0
@@ -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.2.2
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 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
52
+
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
+ }
129
+ end
130
+
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
+ :'external_user_id',
173
+ :'identifier',
174
+ :'timezone',
175
+ :'game_version',
176
+ :'device_model',
177
+ :'device_os',
178
+ :'ad_id',
179
+ :'sdk',
180
+ :'tags',
181
+ :'test_type',
182
+ ])
183
+ end
184
+
185
+ # Initializes the object
186
+ # @param [Hash] attributes Model attributes in the form of hash
187
+ def initialize(attributes = {})
188
+ if (!attributes.is_a?(Hash))
189
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::Player` initialize method"
190
+ end
191
+
192
+ # check to see if the attribute exists and convert string to symbol for hash key
193
+ attributes = attributes.each_with_object({}) { |(k, v), h|
194
+ if (!self.class.attribute_map.key?(k.to_sym))
195
+ 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
196
+ end
197
+ h[k.to_sym] = v
198
+ }
199
+
200
+ if attributes.key?(:'id')
201
+ self.id = attributes[:'id']
202
+ end
203
+
204
+ if attributes.key?(:'invalid_identifier')
205
+ self.invalid_identifier = attributes[:'invalid_identifier']
206
+ end
207
+
208
+ if attributes.key?(:'app_id')
209
+ self.app_id = attributes[:'app_id']
210
+ end
211
+
212
+ if attributes.key?(:'device_type')
213
+ self.device_type = attributes[:'device_type']
214
+ end
215
+
216
+ if attributes.key?(:'external_user_id')
217
+ self.external_user_id = attributes[:'external_user_id']
218
+ end
219
+
220
+ if attributes.key?(:'external_user_id_auth_hash')
221
+ self.external_user_id_auth_hash = attributes[:'external_user_id_auth_hash']
222
+ end
223
+
224
+ if attributes.key?(:'email_auth_hash')
225
+ self.email_auth_hash = attributes[:'email_auth_hash']
226
+ end
227
+
228
+ if attributes.key?(:'identifier')
229
+ self.identifier = attributes[:'identifier']
230
+ end
231
+
232
+ if attributes.key?(:'language')
233
+ self.language = attributes[:'language']
234
+ end
235
+
236
+ if attributes.key?(:'timezone')
237
+ self.timezone = attributes[:'timezone']
238
+ end
239
+
240
+ if attributes.key?(:'game_version')
241
+ self.game_version = attributes[:'game_version']
242
+ end
243
+
244
+ if attributes.key?(:'device_model')
245
+ self.device_model = attributes[:'device_model']
246
+ end
247
+
248
+ if attributes.key?(:'device_os')
249
+ self.device_os = attributes[:'device_os']
250
+ end
251
+
252
+ if attributes.key?(:'ad_id')
253
+ self.ad_id = attributes[:'ad_id']
254
+ end
255
+
256
+ if attributes.key?(:'sdk')
257
+ self.sdk = attributes[:'sdk']
258
+ end
259
+
260
+ if attributes.key?(:'session_count')
261
+ self.session_count = attributes[:'session_count']
262
+ end
263
+
264
+ if attributes.key?(:'tags')
265
+ self.tags = attributes[:'tags']
266
+ end
267
+
268
+ if attributes.key?(:'amount_spent')
269
+ self.amount_spent = attributes[:'amount_spent']
270
+ end
271
+
272
+ if attributes.key?(:'created_at')
273
+ self.created_at = attributes[:'created_at']
274
+ end
275
+
276
+ if attributes.key?(:'playtime')
277
+ self.playtime = attributes[:'playtime']
278
+ end
279
+
280
+ if attributes.key?(:'badge_count')
281
+ self.badge_count = attributes[:'badge_count']
282
+ end
283
+
284
+ if attributes.key?(:'last_active')
285
+ self.last_active = attributes[:'last_active']
286
+ end
287
+
288
+ if attributes.key?(:'notification_types')
289
+ self.notification_types = attributes[:'notification_types']
290
+ end
291
+
292
+ if attributes.key?(:'test_type')
293
+ self.test_type = attributes[:'test_type']
294
+ end
295
+
296
+ if attributes.key?(:'long')
297
+ self.long = attributes[:'long']
298
+ end
299
+
300
+ if attributes.key?(:'lat')
301
+ self.lat = attributes[:'lat']
302
+ end
303
+
304
+ if attributes.key?(:'country')
305
+ self.country = attributes[:'country']
306
+ end
307
+ end
308
+
309
+ # Show invalid properties with the reasons. Usually used together with valid?
310
+ # @return Array for valid properties with the reasons
311
+ def list_invalid_properties
312
+ invalid_properties = Array.new
313
+ if @device_type.nil?
314
+ invalid_properties.push('invalid value for "device_type", device_type cannot be nil.')
315
+ end
316
+
317
+ invalid_properties
318
+ end
319
+
320
+ # Check to see if the all the properties in the model are valid
321
+ # @return true if the model is valid
322
+ def valid?
323
+ return false if @device_type.nil?
324
+ true
325
+ end
326
+
327
+ # Checks equality by comparing each attribute.
328
+ # @param [Object] Object to be compared
329
+ def ==(o)
330
+ return true if self.equal?(o)
331
+ self.class == o.class &&
332
+ id == o.id &&
333
+ invalid_identifier == o.invalid_identifier &&
334
+ app_id == o.app_id &&
335
+ device_type == o.device_type &&
336
+ external_user_id == o.external_user_id &&
337
+ external_user_id_auth_hash == o.external_user_id_auth_hash &&
338
+ email_auth_hash == o.email_auth_hash &&
339
+ identifier == o.identifier &&
340
+ language == o.language &&
341
+ timezone == o.timezone &&
342
+ game_version == o.game_version &&
343
+ device_model == o.device_model &&
344
+ device_os == o.device_os &&
345
+ ad_id == o.ad_id &&
346
+ sdk == o.sdk &&
347
+ session_count == o.session_count &&
348
+ tags == o.tags &&
349
+ amount_spent == o.amount_spent &&
350
+ created_at == o.created_at &&
351
+ playtime == o.playtime &&
352
+ badge_count == o.badge_count &&
353
+ last_active == o.last_active &&
354
+ notification_types == o.notification_types &&
355
+ test_type == o.test_type &&
356
+ long == o.long &&
357
+ lat == o.lat &&
358
+ country == o.country
359
+ end
360
+
361
+ # @see the `==` method
362
+ # @param [Object] Object to be compared
363
+ def eql?(o)
364
+ self == o
365
+ end
366
+
367
+ # Calculates hash code according to all attributes.
368
+ # @return [Integer] Hash code
369
+ def hash
370
+ [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
371
+ end
372
+
373
+ # Builds the object from hash
374
+ # @param [Hash] attributes Model attributes in the form of hash
375
+ # @return [Object] Returns the model itself
376
+ def self.build_from_hash(attributes)
377
+ new.build_from_hash(attributes)
378
+ end
379
+
380
+ # Builds the object from hash
381
+ # @param [Hash] attributes Model attributes in the form of hash
382
+ # @return [Object] Returns the model itself
383
+ def build_from_hash(attributes)
384
+ return nil unless attributes.is_a?(Hash)
385
+ attributes = attributes.transform_keys(&:to_sym)
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