onesignal 1.0.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +74 -0
  3. data/README.md +112 -88
  4. data/docs/App.md +9 -1
  5. data/docs/BasicNotification.md +230 -0
  6. data/docs/BasicNotificationAllOf.md +202 -0
  7. data/docs/{NotificationAllOfAndroidBackgroundLayout.md → BasicNotificationAllOfAndroidBackgroundLayout.md} +2 -2
  8. data/docs/BeginLiveActivityRequest.md +20 -0
  9. data/docs/CancelNotificationSuccessResponse.md +18 -0
  10. data/docs/CreateNotificationSuccessResponse.md +24 -0
  11. data/docs/{InlineResponse2005.md → CreatePlayerSuccessResponse.md} +2 -2
  12. data/docs/{InlineResponse4002.md → CreateSegmentConflictResponse.md} +2 -2
  13. data/docs/CreateSegmentSuccessResponse.md +20 -0
  14. data/docs/CreateSubscriptionRequestBody.md +20 -0
  15. data/docs/CreateUserConflictResponse.md +18 -0
  16. data/docs/CreateUserConflictResponseErrorsInner.md +22 -0
  17. data/docs/CreateUserConflictResponseErrorsItemsMeta.md +18 -0
  18. data/docs/DefaultApi.md +1591 -266
  19. data/docs/DeletePlayerNotFoundResponse.md +18 -0
  20. data/docs/{InlineResponse2001.md → DeletePlayerSuccessResponse.md} +2 -2
  21. data/docs/DeleteSegmentNotFoundResponse.md +18 -0
  22. data/docs/DeleteSegmentSuccessResponse.md +18 -0
  23. data/docs/DeliveryData.md +5 -5
  24. data/docs/{InlineResponse2008.md → ExportEventsSuccessResponse.md} +2 -2
  25. data/docs/ExportPlayersRequestBody.md +2 -2
  26. data/docs/ExportPlayersSuccessResponse.md +18 -0
  27. data/docs/Filter.md +1 -1
  28. data/docs/FilterExpressions.md +1 -1
  29. data/docs/GenericError.md +18 -0
  30. data/docs/GenericErrorErrorsInner.md +20 -0
  31. data/docs/InlineResponse200.md +2 -8
  32. data/docs/InlineResponse2003.md +18 -0
  33. data/docs/InlineResponse201.md +2 -4
  34. data/docs/InlineResponse202.md +18 -0
  35. data/docs/Notification.md +22 -30
  36. data/docs/NotificationAllOf.md +1 -175
  37. data/docs/{InlineResponse2002.md → NotificationHistorySuccessResponse.md} +2 -2
  38. data/docs/NotificationTarget.md +5 -25
  39. data/docs/NotificationWithMeta.md +21 -29
  40. data/docs/PlatformDeliveryData.md +5 -1
  41. data/docs/PlatformDeliveryDataEmailAllOf.md +30 -0
  42. data/docs/PlatformDeliveryDataSmsAllOf.md +22 -0
  43. data/docs/Player.md +1 -1
  44. data/docs/PlayerNotificationTarget.md +5 -1
  45. data/docs/PlayerNotificationTargetIncludeAliases.md +18 -0
  46. data/docs/PropertiesDeltas.md +22 -0
  47. data/docs/PropertiesObject.md +38 -0
  48. data/docs/Purchase.md +4 -2
  49. data/docs/RateLimiterError.md +18 -0
  50. data/docs/SubscriptionObject.md +50 -0
  51. data/docs/TransferSubscriptionRequestBody.md +18 -0
  52. data/docs/UpdateLiveActivityRequest.md +24 -0
  53. data/docs/UpdateLiveActivitySuccessResponse.md +20 -0
  54. data/docs/{InlineResponse2007.md → UpdatePlayerSuccessResponse.md} +3 -3
  55. data/docs/UpdatePlayerTagsSuccessResponse.md +18 -0
  56. data/docs/UpdateSubscriptionRequestBody.md +18 -0
  57. data/docs/UpdateUserRequest.md +22 -0
  58. data/docs/User.md +24 -0
  59. data/docs/UserIdentityRequestBody.md +18 -0
  60. data/docs/UserIdentityResponse.md +18 -0
  61. data/docs/UserSubscriptionOptions.md +18 -0
  62. data/lib/onesignal/api/default_api.rb +1583 -221
  63. data/lib/onesignal/api_client.rb +2 -2
  64. data/lib/onesignal/api_error.rb +1 -1
  65. data/lib/onesignal/configuration.rb +6 -6
  66. data/lib/onesignal/models/app.rb +57 -7
  67. data/lib/onesignal/models/basic_notification.rb +1442 -0
  68. data/lib/onesignal/models/basic_notification_all_of.rb +1252 -0
  69. data/lib/onesignal/models/{notification_all_of_android_background_layout.rb → basic_notification_all_of_android_background_layout.rb} +4 -4
  70. data/lib/onesignal/models/begin_live_activity_request.rb +238 -0
  71. data/lib/onesignal/models/button.rb +1 -1
  72. data/lib/onesignal/models/cancel_notification_success_response.rb +219 -0
  73. data/lib/onesignal/models/create_notification_success_response.rb +248 -0
  74. data/lib/onesignal/models/{inline_response2005.rb → create_player_success_response.rb} +4 -4
  75. data/lib/onesignal/models/{inline_response4002.rb → create_segment_conflict_response.rb} +4 -4
  76. data/lib/onesignal/models/create_segment_success_response.rb +229 -0
  77. data/lib/onesignal/models/create_subscription_request_body.rb +228 -0
  78. data/lib/onesignal/models/{inline_response4001.rb → create_user_conflict_response.rb} +6 -15
  79. data/lib/onesignal/models/create_user_conflict_response_errors_inner.rb +237 -0
  80. data/lib/onesignal/models/create_user_conflict_response_errors_items_meta.rb +219 -0
  81. data/lib/onesignal/models/delete_player_not_found_response.rb +219 -0
  82. data/lib/onesignal/models/{inline_response2001.rb → delete_player_success_response.rb} +4 -4
  83. data/lib/onesignal/models/delete_segment_not_found_response.rb +219 -0
  84. data/lib/onesignal/models/delete_segment_success_response.rb +219 -0
  85. data/lib/onesignal/models/delivery_data.rb +6 -1
  86. data/lib/onesignal/models/{inline_response2008.rb → export_events_success_response.rb} +4 -4
  87. data/lib/onesignal/models/export_players_request_body.rb +3 -3
  88. data/lib/onesignal/models/export_players_success_response.rb +219 -0
  89. data/lib/onesignal/models/filter.rb +2 -2
  90. data/lib/onesignal/models/filter_expressions.rb +2 -2
  91. data/lib/onesignal/models/{inline_response400.rb → generic_error.rb} +5 -5
  92. data/lib/onesignal/models/generic_error_errors_inner.rb +228 -0
  93. data/lib/onesignal/models/get_notification_request_body.rb +1 -1
  94. data/lib/onesignal/models/inline_response200.rb +10 -46
  95. data/lib/onesignal/models/{inline_response4003.rb → inline_response2003.rb} +12 -12
  96. data/lib/onesignal/models/inline_response201.rb +8 -18
  97. data/lib/onesignal/models/inline_response202.rb +219 -0
  98. data/lib/onesignal/models/invalid_identifier_error.rb +1 -1
  99. data/lib/onesignal/models/notification.rb +173 -141
  100. data/lib/onesignal/models/notification200_errors.rb +1 -1
  101. data/lib/onesignal/models/notification_all_of.rb +6 -929
  102. data/lib/onesignal/models/{inline_response2002.rb → notification_history_success_response.rb} +4 -4
  103. data/lib/onesignal/models/notification_slice.rb +1 -1
  104. data/lib/onesignal/models/notification_target.rb +60 -126
  105. data/lib/onesignal/models/notification_with_meta.rb +168 -137
  106. data/lib/onesignal/models/notification_with_meta_all_of.rb +2 -1
  107. data/lib/onesignal/models/operator.rb +1 -1
  108. data/lib/onesignal/models/outcome_data.rb +1 -1
  109. data/lib/onesignal/models/outcomes_data.rb +1 -1
  110. data/lib/onesignal/models/platform_delivery_data.rb +25 -5
  111. data/lib/onesignal/models/platform_delivery_data_email_all_of.rb +287 -0
  112. data/lib/onesignal/models/platform_delivery_data_sms_all_of.rb +243 -0
  113. data/lib/onesignal/models/player.rb +9 -6
  114. data/lib/onesignal/models/player_notification_target.rb +60 -5
  115. data/lib/onesignal/models/player_notification_target_include_aliases.rb +221 -0
  116. data/lib/onesignal/models/player_slice.rb +1 -1
  117. data/lib/onesignal/models/properties_deltas.rb +239 -0
  118. data/lib/onesignal/models/properties_object.rb +313 -0
  119. data/lib/onesignal/models/purchase.rb +15 -6
  120. data/lib/onesignal/models/rate_limiter_error.rb +221 -0
  121. data/lib/onesignal/models/segment.rb +1 -1
  122. data/lib/onesignal/models/segment_notification_target.rb +1 -1
  123. data/lib/onesignal/models/string_map.rb +1 -1
  124. data/lib/onesignal/models/{filter_notification_target.rb → subscription_object.rb} +145 -78
  125. data/lib/onesignal/models/transfer_subscription_request_body.rb +221 -0
  126. data/lib/onesignal/models/update_live_activity_request.rb +309 -0
  127. data/lib/onesignal/models/update_live_activity_success_response.rb +228 -0
  128. data/lib/onesignal/models/{inline_response2007.rb → update_player_success_response.rb} +5 -5
  129. data/lib/onesignal/models/update_player_tags_request_body.rb +1 -1
  130. data/lib/onesignal/models/update_player_tags_success_response.rb +219 -0
  131. data/lib/onesignal/models/update_subscription_request_body.rb +219 -0
  132. data/lib/onesignal/models/update_user_request.rb +239 -0
  133. data/lib/onesignal/models/user.rb +250 -0
  134. data/lib/onesignal/models/user_identity_request_body.rb +221 -0
  135. data/lib/onesignal/models/user_identity_response.rb +221 -0
  136. data/lib/onesignal/models/user_subscription_options.rb +219 -0
  137. data/lib/onesignal/version.rb +2 -2
  138. data/lib/onesignal.rb +43 -12
  139. data/onesignal.gemspec +1 -1
  140. data/spec/api/default_api_spec.rb +249 -12
  141. data/spec/api_client_spec.rb +1 -1
  142. data/spec/configuration_spec.rb +4 -4
  143. data/spec/models/app_spec.rb +25 -1
  144. data/spec/models/{notification_all_of_android_background_layout_spec.rb → basic_notification_all_of_android_background_layout_spec.rb} +7 -7
  145. data/spec/models/basic_notification_all_of_spec.rb +590 -0
  146. data/spec/models/basic_notification_spec.rb +678 -0
  147. data/spec/models/begin_live_activity_request_spec.rb +40 -0
  148. data/spec/models/button_spec.rb +1 -1
  149. data/spec/models/cancel_notification_success_response_spec.rb +34 -0
  150. data/spec/models/create_notification_success_response_spec.rb +52 -0
  151. data/spec/models/{inline_response2005_spec.rb → create_player_success_response_spec.rb} +7 -7
  152. data/spec/models/{inline_response4001_spec.rb → create_segment_conflict_response_spec.rb} +7 -7
  153. data/spec/models/{inline_response4002_spec.rb → create_segment_success_response_spec.rb} +8 -8
  154. data/spec/models/create_subscription_request_body_spec.rb +40 -0
  155. data/spec/models/create_user_conflict_response_errors_inner_spec.rb +46 -0
  156. data/spec/models/create_user_conflict_response_errors_items_meta_spec.rb +34 -0
  157. data/spec/models/create_user_conflict_response_spec.rb +34 -0
  158. data/spec/models/delete_player_not_found_response_spec.rb +34 -0
  159. data/spec/models/{inline_response2001_spec.rb → delete_player_success_response_spec.rb} +7 -7
  160. data/spec/models/delete_segment_not_found_response_spec.rb +34 -0
  161. data/spec/models/delete_segment_success_response_spec.rb +34 -0
  162. data/spec/models/delivery_data_spec.rb +1 -1
  163. data/spec/models/{inline_response2008_spec.rb → export_events_success_response_spec.rb} +7 -7
  164. data/spec/models/export_players_request_body_spec.rb +1 -1
  165. data/spec/models/export_players_success_response_spec.rb +34 -0
  166. data/spec/models/filter_expressions_spec.rb +1 -1
  167. data/spec/models/filter_spec.rb +1 -1
  168. data/spec/models/generic_error_errors_inner_spec.rb +40 -0
  169. data/spec/models/{inline_response4003_spec.rb → generic_error_spec.rb} +8 -8
  170. data/spec/models/get_notification_request_body_spec.rb +1 -1
  171. data/spec/models/{inline_response2007_spec.rb → inline_response2003_spec.rb} +8 -8
  172. data/spec/models/inline_response200_spec.rb +2 -20
  173. data/spec/models/inline_response201_spec.rb +2 -8
  174. data/spec/models/{inline_response400_spec.rb → inline_response202_spec.rb} +8 -8
  175. data/spec/models/invalid_identifier_error_spec.rb +1 -1
  176. data/spec/models/notification200_errors_spec.rb +1 -1
  177. data/spec/models/notification_all_of_spec.rb +1 -527
  178. data/spec/models/{inline_response2002_spec.rb → notification_history_success_response_spec.rb} +7 -7
  179. data/spec/models/notification_slice_spec.rb +1 -1
  180. data/spec/models/notification_spec.rb +56 -76
  181. data/spec/models/notification_target_spec.rb +17 -73
  182. data/spec/models/notification_with_meta_all_of_spec.rb +1 -1
  183. data/spec/models/notification_with_meta_spec.rb +56 -76
  184. data/spec/models/operator_spec.rb +1 -1
  185. data/spec/models/outcome_data_spec.rb +1 -1
  186. data/spec/models/outcomes_data_spec.rb +1 -1
  187. data/spec/models/platform_delivery_data_email_all_of_spec.rb +70 -0
  188. data/spec/models/platform_delivery_data_sms_all_of_spec.rb +46 -0
  189. data/spec/models/platform_delivery_data_spec.rb +13 -1
  190. data/spec/models/player_notification_target_include_aliases_spec.rb +34 -0
  191. data/spec/models/player_notification_target_spec.rb +17 -1
  192. data/spec/models/player_slice_spec.rb +1 -1
  193. data/spec/models/player_spec.rb +1 -1
  194. data/spec/models/properties_deltas_spec.rb +46 -0
  195. data/spec/models/{filter_notification_target_spec.rb → properties_object_spec.rb} +18 -24
  196. data/spec/models/purchase_spec.rb +7 -1
  197. data/spec/models/rate_limiter_error_spec.rb +34 -0
  198. data/spec/models/segment_notification_target_spec.rb +1 -1
  199. data/spec/models/segment_spec.rb +1 -1
  200. data/spec/models/string_map_spec.rb +1 -1
  201. data/spec/models/subscription_object_spec.rb +134 -0
  202. data/spec/models/transfer_subscription_request_body_spec.rb +34 -0
  203. data/spec/models/update_live_activity_request_spec.rb +60 -0
  204. data/spec/models/update_live_activity_success_response_spec.rb +40 -0
  205. data/spec/models/update_player_success_response_spec.rb +34 -0
  206. data/spec/models/update_player_tags_request_body_spec.rb +1 -1
  207. data/spec/models/update_player_tags_success_response_spec.rb +34 -0
  208. data/spec/models/update_subscription_request_body_spec.rb +34 -0
  209. data/spec/models/update_user_request_spec.rb +46 -0
  210. data/spec/models/user_identity_request_body_spec.rb +34 -0
  211. data/spec/models/user_identity_response_spec.rb +34 -0
  212. data/spec/models/user_spec.rb +52 -0
  213. data/spec/models/user_subscription_options_spec.rb +34 -0
  214. data/spec/spec_helper.rb +1 -1
  215. metadata +178 -53
  216. data/docs/FilterNotificationTarget.md +0 -40
  217. data/docs/InlineResponse400.md +0 -18
  218. data/docs/InlineResponse4001.md +0 -20
  219. data/docs/InlineResponse4003.md +0 -18
@@ -3,7 +3,7 @@
3
3
 
4
4
  #A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
5
5
 
6
- The version of the OpenAPI document: 1.0.1
6
+ The version of the OpenAPI document: 1.4.0
7
7
  Contact: devrel@onesignal.com
8
8
  Generated by: https://openapi-generator.tech
9
9
  OpenAPI Generator version: 6.0.0-SNAPSHOT
@@ -14,58 +14,83 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module OneSignal
17
- class FilterNotificationTarget
18
- # relation = \">\" or \"<\" hours_ago = number of hours before or after the users last session. Example: \"1.1\"
19
- attr_accessor :last_session
17
+ class SubscriptionObject
18
+ attr_accessor :id
20
19
 
21
- # relation = \">\" or \"<\" hours_ago = number of hours before or after the users first session. Example: \"1.1\"
22
- attr_accessor :first_session
20
+ attr_accessor :type
23
21
 
24
- # relation = \">\", \"<\", \"=\" or \"!=\" value = number sessions. Example: \"1\"
25
- attr_accessor :session_count
22
+ attr_accessor :token
23
+
24
+ attr_accessor :enabled
25
+
26
+ attr_accessor :notification_types
26
27
 
27
- # relation = \">\", \"<\", \"=\" or \"!=\" value = Time in seconds the user has been in your app. Example: \"3600\"
28
28
  attr_accessor :session_time
29
29
 
30
- # relation = \">\", \"<\", or \"=\" value = Amount in USD a user has spent on IAP (In App Purchases). Example: \"0.99\"
31
- attr_accessor :amount_spent
30
+ attr_accessor :session_count
31
+
32
+ attr_accessor :sdk
32
33
 
33
- # 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\"
34
- attr_accessor :bought_sku
34
+ attr_accessor :device_model
35
35
 
36
- # 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
37
- attr_accessor :tag
36
+ attr_accessor :device_os
38
37
 
39
- # relation = \"=\" or \"!=\" value = 2 character language code. Example: \"en\". For a list of all language codes see Language & Localization.
40
- attr_accessor :language
38
+ attr_accessor :rooted
39
+
40
+ attr_accessor :test_type
41
41
 
42
- # relation = \">\", \"<\", \"=\" or \"!=\" value = app version. Example: \"1.0.0\"
43
42
  attr_accessor :app_version
44
43
 
45
- # radius = in meters lat = latitude long = longitude
46
- attr_accessor :location
44
+ attr_accessor :net_type
45
+
46
+ attr_accessor :carrier
47
+
48
+ attr_accessor :web_auth
49
+
50
+ attr_accessor :web_p256
47
51
 
48
- # 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
49
- attr_accessor :email
52
+ class EnumAttributeValidator
53
+ attr_reader :datatype
54
+ attr_reader :allowable_values
50
55
 
51
- # relation = \"=\" value = 2-digit Country code Example: \"field\": \"country\", \"relation\": \"=\", \"value\", \"US\"
52
- attr_accessor :country
56
+ def initialize(datatype, allowable_values)
57
+ @allowable_values = allowable_values.map do |value|
58
+ case datatype.to_s
59
+ when /Integer/i
60
+ value.to_i
61
+ when /Float/i
62
+ value.to_f
63
+ else
64
+ value
65
+ end
66
+ end
67
+ end
68
+
69
+ def valid?(value)
70
+ !value || allowable_values.include?(value)
71
+ end
72
+ end
53
73
 
54
74
  # Attribute mapping from ruby-style variable name to JSON key.
55
75
  def self.attribute_map
56
76
  {
57
- :'last_session' => :'last_session',
58
- :'first_session' => :'first_session',
59
- :'session_count' => :'session_count',
77
+ :'id' => :'id',
78
+ :'type' => :'type',
79
+ :'token' => :'token',
80
+ :'enabled' => :'enabled',
81
+ :'notification_types' => :'notification_types',
60
82
  :'session_time' => :'session_time',
61
- :'amount_spent' => :'amount_spent',
62
- :'bought_sku' => :'bought_sku',
63
- :'tag' => :'tag',
64
- :'language' => :'language',
83
+ :'session_count' => :'session_count',
84
+ :'sdk' => :'sdk',
85
+ :'device_model' => :'device_model',
86
+ :'device_os' => :'device_os',
87
+ :'rooted' => :'rooted',
88
+ :'test_type' => :'test_type',
65
89
  :'app_version' => :'app_version',
66
- :'location' => :'location',
67
- :'email' => :'email',
68
- :'country' => :'country'
90
+ :'net_type' => :'net_type',
91
+ :'carrier' => :'carrier',
92
+ :'web_auth' => :'web_auth',
93
+ :'web_p256' => :'web_p256'
69
94
  }
70
95
  end
71
96
 
@@ -77,18 +102,23 @@ module OneSignal
77
102
  # Attribute type mapping.
78
103
  def self.openapi_types
79
104
  {
80
- :'last_session' => :'String',
81
- :'first_session' => :'String',
82
- :'session_count' => :'String',
83
- :'session_time' => :'String',
84
- :'amount_spent' => :'String',
85
- :'bought_sku' => :'String',
86
- :'tag' => :'String',
87
- :'language' => :'String',
105
+ :'id' => :'String',
106
+ :'type' => :'String',
107
+ :'token' => :'String',
108
+ :'enabled' => :'Boolean',
109
+ :'notification_types' => :'Float',
110
+ :'session_time' => :'Float',
111
+ :'session_count' => :'Float',
112
+ :'sdk' => :'String',
113
+ :'device_model' => :'String',
114
+ :'device_os' => :'String',
115
+ :'rooted' => :'Boolean',
116
+ :'test_type' => :'Float',
88
117
  :'app_version' => :'String',
89
- :'location' => :'String',
90
- :'email' => :'String',
91
- :'country' => :'String'
118
+ :'net_type' => :'Float',
119
+ :'carrier' => :'String',
120
+ :'web_auth' => :'String',
121
+ :'web_p256' => :'String'
92
122
  }
93
123
  end
94
124
 
@@ -102,63 +132,83 @@ module OneSignal
102
132
  # @param [Hash] attributes Model attributes in the form of hash
103
133
  def initialize(attributes = {})
104
134
  if (!attributes.is_a?(Hash))
105
- fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::FilterNotificationTarget` initialize method"
135
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::SubscriptionObject` initialize method"
106
136
  end
107
137
 
108
138
  # check to see if the attribute exists and convert string to symbol for hash key
109
139
  attributes = attributes.each_with_object({}) { |(k, v), h|
110
140
  if (!self.class.attribute_map.key?(k.to_sym))
111
- fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::FilterNotificationTarget`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
141
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::SubscriptionObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
112
142
  end
113
143
  h[k.to_sym] = v
114
144
  }
115
145
 
116
- if attributes.key?(:'last_session')
117
- self.last_session = attributes[:'last_session']
146
+ if attributes.key?(:'id')
147
+ self.id = attributes[:'id']
118
148
  end
119
149
 
120
- if attributes.key?(:'first_session')
121
- self.first_session = attributes[:'first_session']
150
+ if attributes.key?(:'type')
151
+ self.type = attributes[:'type']
122
152
  end
123
153
 
124
- if attributes.key?(:'session_count')
125
- self.session_count = attributes[:'session_count']
154
+ if attributes.key?(:'token')
155
+ self.token = attributes[:'token']
156
+ end
157
+
158
+ if attributes.key?(:'enabled')
159
+ self.enabled = attributes[:'enabled']
160
+ end
161
+
162
+ if attributes.key?(:'notification_types')
163
+ self.notification_types = attributes[:'notification_types']
126
164
  end
127
165
 
128
166
  if attributes.key?(:'session_time')
129
167
  self.session_time = attributes[:'session_time']
130
168
  end
131
169
 
132
- if attributes.key?(:'amount_spent')
133
- self.amount_spent = attributes[:'amount_spent']
170
+ if attributes.key?(:'session_count')
171
+ self.session_count = attributes[:'session_count']
172
+ end
173
+
174
+ if attributes.key?(:'sdk')
175
+ self.sdk = attributes[:'sdk']
134
176
  end
135
177
 
136
- if attributes.key?(:'bought_sku')
137
- self.bought_sku = attributes[:'bought_sku']
178
+ if attributes.key?(:'device_model')
179
+ self.device_model = attributes[:'device_model']
138
180
  end
139
181
 
140
- if attributes.key?(:'tag')
141
- self.tag = attributes[:'tag']
182
+ if attributes.key?(:'device_os')
183
+ self.device_os = attributes[:'device_os']
142
184
  end
143
185
 
144
- if attributes.key?(:'language')
145
- self.language = attributes[:'language']
186
+ if attributes.key?(:'rooted')
187
+ self.rooted = attributes[:'rooted']
188
+ end
189
+
190
+ if attributes.key?(:'test_type')
191
+ self.test_type = attributes[:'test_type']
146
192
  end
147
193
 
148
194
  if attributes.key?(:'app_version')
149
195
  self.app_version = attributes[:'app_version']
150
196
  end
151
197
 
152
- if attributes.key?(:'location')
153
- self.location = attributes[:'location']
198
+ if attributes.key?(:'net_type')
199
+ self.net_type = attributes[:'net_type']
154
200
  end
155
201
 
156
- if attributes.key?(:'email')
157
- self.email = attributes[:'email']
202
+ if attributes.key?(:'carrier')
203
+ self.carrier = attributes[:'carrier']
158
204
  end
159
205
 
160
- if attributes.key?(:'country')
161
- self.country = attributes[:'country']
206
+ if attributes.key?(:'web_auth')
207
+ self.web_auth = attributes[:'web_auth']
208
+ end
209
+
210
+ if attributes.key?(:'web_p256')
211
+ self.web_p256 = attributes[:'web_p256']
162
212
  end
163
213
  end
164
214
 
@@ -172,26 +222,43 @@ module OneSignal
172
222
  # Check to see if the all the properties in the model are valid
173
223
  # @return true if the model is valid
174
224
  def valid?
225
+ type_validator = EnumAttributeValidator.new('String', ["iOSPush", "AndroidPush", "FireOSPush", "ChromeExtensionPush", "ChromePush", "WindowsPush", "SafariLegacyPush", "FirefoxPush", "macOSPush", "HuaweiPush", "SafariPush", "Email", "SMS"])
226
+ return false unless type_validator.valid?(@type)
175
227
  true
176
228
  end
177
229
 
230
+ # Custom attribute writer method checking allowed values (enum).
231
+ # @param [Object] type Object to be assigned
232
+ def type=(type)
233
+ validator = EnumAttributeValidator.new('String', ["iOSPush", "AndroidPush", "FireOSPush", "ChromeExtensionPush", "ChromePush", "WindowsPush", "SafariLegacyPush", "FirefoxPush", "macOSPush", "HuaweiPush", "SafariPush", "Email", "SMS"])
234
+ unless validator.valid?(type)
235
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
236
+ end
237
+ @type = type
238
+ end
239
+
178
240
  # Checks equality by comparing each attribute.
179
241
  # @param [Object] Object to be compared
180
242
  def ==(o)
181
243
  return true if self.equal?(o)
182
244
  self.class == o.class &&
183
- last_session == o.last_session &&
184
- first_session == o.first_session &&
185
- session_count == o.session_count &&
245
+ id == o.id &&
246
+ type == o.type &&
247
+ token == o.token &&
248
+ enabled == o.enabled &&
249
+ notification_types == o.notification_types &&
186
250
  session_time == o.session_time &&
187
- amount_spent == o.amount_spent &&
188
- bought_sku == o.bought_sku &&
189
- tag == o.tag &&
190
- language == o.language &&
251
+ session_count == o.session_count &&
252
+ sdk == o.sdk &&
253
+ device_model == o.device_model &&
254
+ device_os == o.device_os &&
255
+ rooted == o.rooted &&
256
+ test_type == o.test_type &&
191
257
  app_version == o.app_version &&
192
- location == o.location &&
193
- email == o.email &&
194
- country == o.country
258
+ net_type == o.net_type &&
259
+ carrier == o.carrier &&
260
+ web_auth == o.web_auth &&
261
+ web_p256 == o.web_p256
195
262
  end
196
263
 
197
264
  # @see the `==` method
@@ -203,7 +270,7 @@ module OneSignal
203
270
  # Calculates hash code according to all attributes.
204
271
  # @return [Integer] Hash code
205
272
  def hash
206
- [last_session, first_session, session_count, session_time, amount_spent, bought_sku, tag, language, app_version, location, email, country].hash
273
+ [id, type, token, enabled, notification_types, session_time, session_count, sdk, device_model, device_os, rooted, test_type, app_version, net_type, carrier, web_auth, web_p256].hash
207
274
  end
208
275
 
209
276
  # Builds the object from hash
@@ -0,0 +1,221 @@
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.4.0
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 TransferSubscriptionRequestBody
18
+ attr_accessor :identity
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'identity' => :'identity'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'identity' => :'Hash<String, Object>'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::TransferSubscriptionRequestBody` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::TransferSubscriptionRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'identity')
61
+ if (value = attributes[:'identity']).is_a?(Hash)
62
+ self.identity = value
63
+ end
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = Array.new
71
+ invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ identity == o.identity
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Integer] Hash code
96
+ def hash
97
+ [identity].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def self.build_from_hash(attributes)
104
+ new.build_from_hash(attributes)
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ attributes = attributes.transform_keys(&:to_sym)
113
+ self.class.openapi_types.each_pair do |key, type|
114
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
115
+ self.send("#{key}=", nil)
116
+ elsif type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :Time
137
+ Time.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ # models (e.g. Pet) or oneOf
168
+ klass = OneSignal.const_get(type)
169
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ if value.nil?
192
+ is_nullable = self.class.openapi_nullable.include?(attr)
193
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
+ end
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ # Outputs non-array value in the form of hash
202
+ # For object, use to_hash. Otherwise, just return the value
203
+ # @param [Object] value Any valid value
204
+ # @return [Hash] Returns the value in the form of hash
205
+ def _to_hash(value)
206
+ if value.is_a?(Array)
207
+ value.compact.map { |v| _to_hash(v) }
208
+ elsif value.is_a?(Hash)
209
+ {}.tap do |hash|
210
+ value.each { |k, v| hash[k] = _to_hash(v) }
211
+ end
212
+ elsif value.respond_to? :to_hash
213
+ value.to_hash
214
+ else
215
+ value
216
+ end
217
+ end
218
+
219
+ end
220
+
221
+ end