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
@@ -0,0 +1,219 @@
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 UpdatePlayerTagsSuccessResponse
18
+ attr_accessor :success
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'success' => :'success'
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
+ :'success' => :'Boolean'
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::UpdatePlayerTagsSuccessResponse` 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::UpdatePlayerTagsSuccessResponse`. 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?(:'success')
61
+ self.success = attributes[:'success']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ success == o.success
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Integer] Hash code
94
+ def hash
95
+ [success].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def self.build_from_hash(attributes)
102
+ new.build_from_hash(attributes)
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ attributes = attributes.transform_keys(&:to_sym)
111
+ self.class.openapi_types.each_pair do |key, type|
112
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
113
+ self.send("#{key}=", nil)
114
+ elsif type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
+ end
120
+ elsif !attributes[self.class.attribute_map[key]].nil?
121
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
+ end
123
+ end
124
+
125
+ self
126
+ end
127
+
128
+ # Deserializes the data based on type
129
+ # @param string type Data type
130
+ # @param string value Value to be deserialized
131
+ # @return [Object] Deserialized data
132
+ def _deserialize(type, value)
133
+ case type.to_sym
134
+ when :Time
135
+ Time.parse(value)
136
+ when :Date
137
+ Date.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :Boolean
145
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ # models (e.g. Pet) or oneOf
166
+ klass = OneSignal.const_get(type)
167
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+
217
+ end
218
+
219
+ end
@@ -0,0 +1,219 @@
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 UpdateSubscriptionRequestBody
18
+ attr_accessor :subscription
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'subscription' => :'subscription'
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
+ :'subscription' => :'SubscriptionObject'
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::UpdateSubscriptionRequestBody` 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::UpdateSubscriptionRequestBody`. 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?(:'subscription')
61
+ self.subscription = attributes[:'subscription']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ subscription == o.subscription
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Integer] Hash code
94
+ def hash
95
+ [subscription].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def self.build_from_hash(attributes)
102
+ new.build_from_hash(attributes)
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ attributes = attributes.transform_keys(&:to_sym)
111
+ self.class.openapi_types.each_pair do |key, type|
112
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
113
+ self.send("#{key}=", nil)
114
+ elsif type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
+ end
120
+ elsif !attributes[self.class.attribute_map[key]].nil?
121
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
+ end
123
+ end
124
+
125
+ self
126
+ end
127
+
128
+ # Deserializes the data based on type
129
+ # @param string type Data type
130
+ # @param string value Value to be deserialized
131
+ # @return [Object] Deserialized data
132
+ def _deserialize(type, value)
133
+ case type.to_sym
134
+ when :Time
135
+ Time.parse(value)
136
+ when :Date
137
+ Date.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :Boolean
145
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ # models (e.g. Pet) or oneOf
166
+ klass = OneSignal.const_get(type)
167
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+
217
+ end
218
+
219
+ end
@@ -0,0 +1,239 @@
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 UpdateUserRequest
18
+ attr_accessor :properties
19
+
20
+ attr_accessor :refresh_device_metadata
21
+
22
+ attr_accessor :deltas
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'properties' => :'properties',
28
+ :'refresh_device_metadata' => :'refresh_device_metadata',
29
+ :'deltas' => :'deltas'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'properties' => :'PropertiesObject',
42
+ :'refresh_device_metadata' => :'Boolean',
43
+ :'deltas' => :'PropertiesDeltas'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ ])
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::UpdateUserRequest` initialize method"
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::UpdateUserRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
64
+ end
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'properties')
69
+ self.properties = attributes[:'properties']
70
+ end
71
+
72
+ if attributes.key?(:'refresh_device_metadata')
73
+ self.refresh_device_metadata = attributes[:'refresh_device_metadata']
74
+ else
75
+ self.refresh_device_metadata = false
76
+ end
77
+
78
+ if attributes.key?(:'deltas')
79
+ self.deltas = attributes[:'deltas']
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = Array.new
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ properties == o.properties &&
102
+ refresh_device_metadata == o.refresh_device_metadata &&
103
+ deltas == o.deltas
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Integer] Hash code
114
+ def hash
115
+ [properties, refresh_device_metadata, deltas].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def self.build_from_hash(attributes)
122
+ new.build_from_hash(attributes)
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ attributes = attributes.transform_keys(&:to_sym)
131
+ self.class.openapi_types.each_pair do |key, type|
132
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
133
+ self.send("#{key}=", nil)
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
138
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
139
+ end
140
+ elsif !attributes[self.class.attribute_map[key]].nil?
141
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
142
+ end
143
+ end
144
+
145
+ self
146
+ end
147
+
148
+ # Deserializes the data based on type
149
+ # @param string type Data type
150
+ # @param string value Value to be deserialized
151
+ # @return [Object] Deserialized data
152
+ def _deserialize(type, value)
153
+ case type.to_sym
154
+ when :Time
155
+ Time.parse(value)
156
+ when :Date
157
+ Date.parse(value)
158
+ when :String
159
+ value.to_s
160
+ when :Integer
161
+ value.to_i
162
+ when :Float
163
+ value.to_f
164
+ when :Boolean
165
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ true
167
+ else
168
+ false
169
+ end
170
+ when :Object
171
+ # generic object (usually a Hash), return directly
172
+ value
173
+ when /\AArray<(?<inner_type>.+)>\z/
174
+ inner_type = Regexp.last_match[:inner_type]
175
+ value.map { |v| _deserialize(inner_type, v) }
176
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ k_type = Regexp.last_match[:k_type]
178
+ v_type = Regexp.last_match[:v_type]
179
+ {}.tap do |hash|
180
+ value.each do |k, v|
181
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
+ end
183
+ end
184
+ else # model
185
+ # models (e.g. Pet) or oneOf
186
+ klass = OneSignal.const_get(type)
187
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+
237
+ end
238
+
239
+ end