onesignal 0.3.0 → 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +6 -1
- data/README.md +126 -111
- data/Rakefile +8 -8
- data/docs/App.md +76 -0
- data/docs/Button.md +22 -0
- data/docs/DefaultApi.md +1394 -0
- data/docs/DeliveryData.md +26 -0
- data/docs/ExportPlayersRequestBody.md +22 -0
- data/docs/Filter.md +24 -0
- data/docs/FilterExpressions.md +26 -0
- data/docs/FilterNotificationTarget.md +40 -0
- data/docs/GetNotificationRequestBody.md +22 -0
- data/docs/InlineResponse200.md +24 -0
- data/docs/InlineResponse2001.md +18 -0
- data/docs/InlineResponse2002.md +20 -0
- data/docs/InlineResponse2003.md +18 -0
- data/docs/InlineResponse2004.md +20 -0
- data/docs/InlineResponse2005.md +18 -0
- data/docs/InlineResponse201.md +20 -0
- data/docs/InlineResponse400.md +18 -0
- data/docs/InlineResponse4001.md +20 -0
- data/docs/InlineResponse4002.md +18 -0
- data/docs/InlineResponse409.md +20 -0
- data/docs/Notification.md +240 -0
- data/docs/NotificationAllOf.md +192 -0
- data/docs/NotificationAllOfAndroidBackgroundLayout.md +22 -0
- data/docs/NotificationSlice.md +24 -0
- data/docs/NotificationTarget.md +64 -0
- data/docs/Operator.md +18 -0
- data/docs/OutcomeData.md +22 -0
- data/docs/PlatformDeliveryData.md +28 -0
- data/docs/Player.md +70 -0
- data/docs/PlayerNotificationTarget.md +36 -0
- data/docs/PlayerSlice.md +24 -0
- data/docs/Purchase.md +22 -0
- data/docs/Segment.md +22 -0
- data/docs/SegmentNotificationTarget.md +20 -0
- data/docs/StringMap.md +102 -0
- data/docs/UpdatePlayerTagsRequestBody.md +18 -0
- data/git_push.sh +58 -0
- data/lib/OneSignal.rb +75 -0
- data/lib/onesignal/api/default_api.rb +1338 -0
- data/lib/onesignal/api_client.rb +391 -0
- data/lib/onesignal/api_error.rb +57 -0
- data/lib/onesignal/configuration.rb +242 -0
- data/lib/onesignal/models/app.rb +519 -13
- data/lib/onesignal/models/button.rb +241 -0
- data/lib/onesignal/models/delivery_data.rb +254 -0
- data/lib/onesignal/models/export_players_request_body.rb +241 -0
- data/lib/onesignal/models/filter.rb +293 -0
- data/lib/onesignal/models/filter_expressions.rb +335 -0
- data/lib/onesignal/models/filter_notification_target.rb +329 -0
- data/lib/onesignal/models/get_notification_request_body.rb +272 -0
- data/lib/onesignal/models/inline_response200.rb +256 -0
- data/lib/onesignal/models/inline_response2001.rb +218 -0
- data/lib/onesignal/models/inline_response2002.rb +227 -0
- data/lib/onesignal/models/inline_response2003.rb +218 -0
- data/lib/onesignal/models/inline_response2004.rb +227 -0
- data/lib/onesignal/models/inline_response2005.rb +218 -0
- data/lib/onesignal/models/inline_response201.rb +228 -0
- data/lib/onesignal/models/inline_response400.rb +220 -0
- data/lib/onesignal/models/inline_response4001.rb +229 -0
- data/lib/onesignal/models/inline_response4002.rb +220 -0
- data/lib/onesignal/models/inline_response409.rb +229 -0
- data/lib/onesignal/models/notification.rb +1395 -5
- data/lib/onesignal/models/notification_all_of.rb +1124 -0
- data/lib/onesignal/models/notification_all_of_android_background_layout.rb +240 -0
- data/lib/onesignal/models/notification_slice.rb +247 -0
- data/lib/onesignal/models/notification_target.rb +494 -0
- data/lib/onesignal/models/operator.rb +253 -0
- data/lib/onesignal/models/outcome_data.rb +285 -0
- data/lib/onesignal/models/platform_delivery_data.rb +264 -0
- data/lib/onesignal/models/player.rb +483 -9
- data/lib/onesignal/models/player_notification_target.rb +329 -0
- data/lib/onesignal/models/player_slice.rb +247 -0
- data/lib/onesignal/models/purchase.rb +254 -0
- data/lib/onesignal/models/segment.rb +251 -0
- data/lib/onesignal/models/segment_notification_target.rb +233 -0
- data/lib/onesignal/models/string_map.rb +644 -0
- data/lib/onesignal/models/update_player_tags_request_body.rb +219 -0
- data/lib/onesignal/version.rb +13 -1
- data/onesignal.gemspec +36 -27
- data/spec/api/default_api_spec.rb +285 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/app_spec.rb +212 -0
- data/spec/models/button_spec.rb +46 -0
- data/spec/models/delivery_data_spec.rb +58 -0
- data/spec/models/export_players_request_body_spec.rb +46 -0
- data/spec/models/filter_expressions_spec.rb +66 -0
- data/spec/models/filter_notification_target_spec.rb +100 -0
- data/spec/models/filter_spec.rb +56 -0
- data/spec/models/get_notification_request_body_spec.rb +50 -0
- data/spec/models/inline_response2001_spec.rb +34 -0
- data/spec/models/inline_response2002_spec.rb +40 -0
- data/spec/models/inline_response2003_spec.rb +34 -0
- data/spec/models/inline_response2004_spec.rb +40 -0
- data/spec/models/inline_response2005_spec.rb +34 -0
- data/spec/models/inline_response200_spec.rb +52 -0
- data/spec/models/inline_response201_spec.rb +40 -0
- data/spec/models/inline_response4001_spec.rb +40 -0
- data/spec/models/inline_response4002_spec.rb +34 -0
- data/spec/models/inline_response400_spec.rb +34 -0
- data/spec/models/inline_response409_spec.rb +40 -0
- data/spec/models/notification_all_of_android_background_layout_spec.rb +46 -0
- data/spec/models/notification_all_of_spec.rb +560 -0
- data/spec/models/notification_slice_spec.rb +52 -0
- data/spec/models/notification_spec.rb +704 -0
- data/spec/models/notification_target_spec.rb +172 -0
- data/spec/models/operator_spec.rb +38 -0
- data/spec/models/outcome_data_spec.rb +50 -0
- data/spec/models/platform_delivery_data_spec.rb +64 -0
- data/spec/models/player_notification_target_spec.rb +88 -0
- data/spec/models/player_slice_spec.rb +52 -0
- data/spec/models/player_spec.rb +190 -0
- data/spec/models/purchase_spec.rb +46 -0
- data/spec/models/segment_notification_target_spec.rb +40 -0
- data/spec/models/segment_spec.rb +46 -0
- data/spec/models/string_map_spec.rb +286 -0
- data/spec/models/update_player_tags_request_body_spec.rb +34 -0
- data/spec/spec_helper.rb +111 -0
- metadata +182 -65
- data/.gitignore +0 -10
- data/.rubocop.yml +0 -17
- data/.travis.yml +0 -16
- data/CHANGELOG.md +0 -22
- data/CODE_OF_CONDUCT.md +0 -49
- data/LICENSE +0 -21
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/onesignal/app_id_missing_error.rb +0 -7
- data/lib/onesignal/client.rb +0 -44
- data/lib/onesignal/models/base_model.rb +0 -40
- data/lib/onesignal/request.rb +0 -94
- data/lib/onesignal/request_error.rb +0 -21
- data/lib/onesignal/resources/app_resource.rb +0 -27
- data/lib/onesignal/resources/base_resource.rb +0 -35
- data/lib/onesignal/resources/notification_resource.rb +0 -33
- data/lib/onesignal/resources/player_resource.rb +0 -53
- data/lib/onesignal.rb +0 -23
@@ -0,0 +1,329 @@
|
|
1
|
+
=begin
|
2
|
+
#OneSignal
|
3
|
+
|
4
|
+
#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: devrel@onesignal.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.2.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module OneSignal
|
17
|
+
class PlayerNotificationTarget
|
18
|
+
# Specific playerids to send your notification to. _Does not require API Auth Key. Do not combine with other targeting parameters. Not compatible with any other targeting parameters. Example: [\"1dd608f2-c6a1-11e3-851d-000c2940e62c\"] Limit of 2,000 entries per REST API call
|
19
|
+
attr_accessor :include_player_ids
|
20
|
+
|
21
|
+
# Target specific devices by custom user IDs assigned via API. Not compatible with any other targeting parameters Example: [“custom-id-assigned-by-api”] REQUIRED: REST API Key Authentication Limit of 2,000 entries per REST API call. Note: If targeting push, email, or sms subscribers with same ids, use with channel_for_external_user_ids to indicate you are sending a push or email or sms.
|
22
|
+
attr_accessor :include_external_user_ids
|
23
|
+
|
24
|
+
# Recommended for Sending Emails - Target specific email addresses. If an email does not correspond to an existing user, a new user will be created. Example: nick@catfac.ts Limit of 2,000 entries per REST API call
|
25
|
+
attr_accessor :include_email_tokens
|
26
|
+
|
27
|
+
# Recommended for Sending SMS - Target specific phone numbers. The phone number should be in the E.164 format. Phone number should be an existing subscriber on OneSignal. Refer our docs to learn how to add phone numbers to OneSignal. Example phone number: +1999999999 Limit of 2,000 entries per REST API call
|
28
|
+
attr_accessor :include_phone_numbers
|
29
|
+
|
30
|
+
# Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using iOS device tokens. Warning: Only works with Production tokens. All non-alphanumeric characters must be removed from each token. If a token does not correspond to an existing user, a new user will be created. Example: ce777617da7f548fe7a9ab6febb56cf39fba6d38203... Limit of 2,000 entries per REST API call
|
31
|
+
attr_accessor :include_ios_tokens
|
32
|
+
|
33
|
+
# Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Windows URIs. If a token does not correspond to an existing user, a new user will be created. Example: http://s.notify.live.net/u/1/bn1/HmQAAACPaLDr-... Limit of 2,000 entries per REST API call
|
34
|
+
attr_accessor :include_wp_wns_uris
|
35
|
+
|
36
|
+
# Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Amazon ADM registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: amzn1.adm-registration.v1.XpvSSUk0Rc3hTVVV... Limit of 2,000 entries per REST API call
|
37
|
+
attr_accessor :include_amazon_reg_ids
|
38
|
+
|
39
|
+
# Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Chrome App registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call
|
40
|
+
attr_accessor :include_chrome_reg_ids
|
41
|
+
|
42
|
+
# Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Chrome Web Push registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call
|
43
|
+
attr_accessor :include_chrome_web_reg_ids
|
44
|
+
|
45
|
+
# Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Android device registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call
|
46
|
+
attr_accessor :include_android_reg_ids
|
47
|
+
|
48
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
49
|
+
def self.attribute_map
|
50
|
+
{
|
51
|
+
:'include_player_ids' => :'include_player_ids',
|
52
|
+
:'include_external_user_ids' => :'include_external_user_ids',
|
53
|
+
:'include_email_tokens' => :'include_email_tokens',
|
54
|
+
:'include_phone_numbers' => :'include_phone_numbers',
|
55
|
+
:'include_ios_tokens' => :'include_ios_tokens',
|
56
|
+
:'include_wp_wns_uris' => :'include_wp_wns_uris',
|
57
|
+
:'include_amazon_reg_ids' => :'include_amazon_reg_ids',
|
58
|
+
:'include_chrome_reg_ids' => :'include_chrome_reg_ids',
|
59
|
+
:'include_chrome_web_reg_ids' => :'include_chrome_web_reg_ids',
|
60
|
+
:'include_android_reg_ids' => :'include_android_reg_ids'
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Returns all the JSON keys this model knows about
|
65
|
+
def self.acceptable_attributes
|
66
|
+
attribute_map.values
|
67
|
+
end
|
68
|
+
|
69
|
+
# Attribute type mapping.
|
70
|
+
def self.openapi_types
|
71
|
+
{
|
72
|
+
:'include_player_ids' => :'Array<String>',
|
73
|
+
:'include_external_user_ids' => :'Array<String>',
|
74
|
+
:'include_email_tokens' => :'Array<String>',
|
75
|
+
:'include_phone_numbers' => :'Array<String>',
|
76
|
+
:'include_ios_tokens' => :'Array<String>',
|
77
|
+
:'include_wp_wns_uris' => :'Array<String>',
|
78
|
+
:'include_amazon_reg_ids' => :'Array<String>',
|
79
|
+
:'include_chrome_reg_ids' => :'Array<String>',
|
80
|
+
:'include_chrome_web_reg_ids' => :'Array<String>',
|
81
|
+
:'include_android_reg_ids' => :'Array<String>'
|
82
|
+
}
|
83
|
+
end
|
84
|
+
|
85
|
+
# List of attributes with nullable: true
|
86
|
+
def self.openapi_nullable
|
87
|
+
Set.new([
|
88
|
+
])
|
89
|
+
end
|
90
|
+
|
91
|
+
# Initializes the object
|
92
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
93
|
+
def initialize(attributes = {})
|
94
|
+
if (!attributes.is_a?(Hash))
|
95
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::PlayerNotificationTarget` initialize method"
|
96
|
+
end
|
97
|
+
|
98
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
99
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
100
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
101
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::PlayerNotificationTarget`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
102
|
+
end
|
103
|
+
h[k.to_sym] = v
|
104
|
+
}
|
105
|
+
|
106
|
+
if attributes.key?(:'include_player_ids')
|
107
|
+
if (value = attributes[:'include_player_ids']).is_a?(Array)
|
108
|
+
self.include_player_ids = value
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
if attributes.key?(:'include_external_user_ids')
|
113
|
+
if (value = attributes[:'include_external_user_ids']).is_a?(Array)
|
114
|
+
self.include_external_user_ids = value
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.key?(:'include_email_tokens')
|
119
|
+
if (value = attributes[:'include_email_tokens']).is_a?(Array)
|
120
|
+
self.include_email_tokens = value
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.key?(:'include_phone_numbers')
|
125
|
+
if (value = attributes[:'include_phone_numbers']).is_a?(Array)
|
126
|
+
self.include_phone_numbers = value
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.key?(:'include_ios_tokens')
|
131
|
+
if (value = attributes[:'include_ios_tokens']).is_a?(Array)
|
132
|
+
self.include_ios_tokens = value
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.key?(:'include_wp_wns_uris')
|
137
|
+
if (value = attributes[:'include_wp_wns_uris']).is_a?(Array)
|
138
|
+
self.include_wp_wns_uris = value
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
if attributes.key?(:'include_amazon_reg_ids')
|
143
|
+
if (value = attributes[:'include_amazon_reg_ids']).is_a?(Array)
|
144
|
+
self.include_amazon_reg_ids = value
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.key?(:'include_chrome_reg_ids')
|
149
|
+
if (value = attributes[:'include_chrome_reg_ids']).is_a?(Array)
|
150
|
+
self.include_chrome_reg_ids = value
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
if attributes.key?(:'include_chrome_web_reg_ids')
|
155
|
+
if (value = attributes[:'include_chrome_web_reg_ids']).is_a?(Array)
|
156
|
+
self.include_chrome_web_reg_ids = value
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
if attributes.key?(:'include_android_reg_ids')
|
161
|
+
if (value = attributes[:'include_android_reg_ids']).is_a?(Array)
|
162
|
+
self.include_android_reg_ids = value
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
168
|
+
# @return Array for valid properties with the reasons
|
169
|
+
def list_invalid_properties
|
170
|
+
invalid_properties = Array.new
|
171
|
+
invalid_properties
|
172
|
+
end
|
173
|
+
|
174
|
+
# Check to see if the all the properties in the model are valid
|
175
|
+
# @return true if the model is valid
|
176
|
+
def valid?
|
177
|
+
true
|
178
|
+
end
|
179
|
+
|
180
|
+
# Checks equality by comparing each attribute.
|
181
|
+
# @param [Object] Object to be compared
|
182
|
+
def ==(o)
|
183
|
+
return true if self.equal?(o)
|
184
|
+
self.class == o.class &&
|
185
|
+
include_player_ids == o.include_player_ids &&
|
186
|
+
include_external_user_ids == o.include_external_user_ids &&
|
187
|
+
include_email_tokens == o.include_email_tokens &&
|
188
|
+
include_phone_numbers == o.include_phone_numbers &&
|
189
|
+
include_ios_tokens == o.include_ios_tokens &&
|
190
|
+
include_wp_wns_uris == o.include_wp_wns_uris &&
|
191
|
+
include_amazon_reg_ids == o.include_amazon_reg_ids &&
|
192
|
+
include_chrome_reg_ids == o.include_chrome_reg_ids &&
|
193
|
+
include_chrome_web_reg_ids == o.include_chrome_web_reg_ids &&
|
194
|
+
include_android_reg_ids == o.include_android_reg_ids
|
195
|
+
end
|
196
|
+
|
197
|
+
# @see the `==` method
|
198
|
+
# @param [Object] Object to be compared
|
199
|
+
def eql?(o)
|
200
|
+
self == o
|
201
|
+
end
|
202
|
+
|
203
|
+
# Calculates hash code according to all attributes.
|
204
|
+
# @return [Integer] Hash code
|
205
|
+
def hash
|
206
|
+
[include_player_ids, include_external_user_ids, include_email_tokens, include_phone_numbers, include_ios_tokens, include_wp_wns_uris, include_amazon_reg_ids, include_chrome_reg_ids, include_chrome_web_reg_ids, include_android_reg_ids].hash
|
207
|
+
end
|
208
|
+
|
209
|
+
# Builds the object from hash
|
210
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
211
|
+
# @return [Object] Returns the model itself
|
212
|
+
def self.build_from_hash(attributes)
|
213
|
+
new.build_from_hash(attributes)
|
214
|
+
end
|
215
|
+
|
216
|
+
# Builds the object from hash
|
217
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
218
|
+
# @return [Object] Returns the model itself
|
219
|
+
def build_from_hash(attributes)
|
220
|
+
return nil unless attributes.is_a?(Hash)
|
221
|
+
self.class.openapi_types.each_pair do |key, type|
|
222
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
223
|
+
self.send("#{key}=", nil)
|
224
|
+
elsif type =~ /\AArray<(.*)>/i
|
225
|
+
# check to ensure the input is an array given that the attribute
|
226
|
+
# is documented as an array but the input is not
|
227
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
228
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
229
|
+
end
|
230
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
231
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
self
|
236
|
+
end
|
237
|
+
|
238
|
+
# Deserializes the data based on type
|
239
|
+
# @param string type Data type
|
240
|
+
# @param string value Value to be deserialized
|
241
|
+
# @return [Object] Deserialized data
|
242
|
+
def _deserialize(type, value)
|
243
|
+
case type.to_sym
|
244
|
+
when :Time
|
245
|
+
Time.parse(value)
|
246
|
+
when :Date
|
247
|
+
Date.parse(value)
|
248
|
+
when :String
|
249
|
+
value.to_s
|
250
|
+
when :Integer
|
251
|
+
value.to_i
|
252
|
+
when :Float
|
253
|
+
value.to_f
|
254
|
+
when :Boolean
|
255
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
256
|
+
true
|
257
|
+
else
|
258
|
+
false
|
259
|
+
end
|
260
|
+
when :Object
|
261
|
+
# generic object (usually a Hash), return directly
|
262
|
+
value
|
263
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
264
|
+
inner_type = Regexp.last_match[:inner_type]
|
265
|
+
value.map { |v| _deserialize(inner_type, v) }
|
266
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
267
|
+
k_type = Regexp.last_match[:k_type]
|
268
|
+
v_type = Regexp.last_match[:v_type]
|
269
|
+
{}.tap do |hash|
|
270
|
+
value.each do |k, v|
|
271
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
272
|
+
end
|
273
|
+
end
|
274
|
+
else # model
|
275
|
+
# models (e.g. Pet) or oneOf
|
276
|
+
klass = OneSignal.const_get(type)
|
277
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
# Returns the string representation of the object
|
282
|
+
# @return [String] String presentation of the object
|
283
|
+
def to_s
|
284
|
+
to_hash.to_s
|
285
|
+
end
|
286
|
+
|
287
|
+
# to_body is an alias to to_hash (backward compatibility)
|
288
|
+
# @return [Hash] Returns the object in the form of hash
|
289
|
+
def to_body
|
290
|
+
to_hash
|
291
|
+
end
|
292
|
+
|
293
|
+
# Returns the object in the form of hash
|
294
|
+
# @return [Hash] Returns the object in the form of hash
|
295
|
+
def to_hash
|
296
|
+
hash = {}
|
297
|
+
self.class.attribute_map.each_pair do |attr, param|
|
298
|
+
value = self.send(attr)
|
299
|
+
if value.nil?
|
300
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
301
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
302
|
+
end
|
303
|
+
|
304
|
+
hash[param] = _to_hash(value)
|
305
|
+
end
|
306
|
+
hash
|
307
|
+
end
|
308
|
+
|
309
|
+
# Outputs non-array value in the form of hash
|
310
|
+
# For object, use to_hash. Otherwise, just return the value
|
311
|
+
# @param [Object] value Any valid value
|
312
|
+
# @return [Hash] Returns the value in the form of hash
|
313
|
+
def _to_hash(value)
|
314
|
+
if value.is_a?(Array)
|
315
|
+
value.compact.map { |v| _to_hash(v) }
|
316
|
+
elsif value.is_a?(Hash)
|
317
|
+
{}.tap do |hash|
|
318
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
319
|
+
end
|
320
|
+
elsif value.respond_to? :to_hash
|
321
|
+
value.to_hash
|
322
|
+
else
|
323
|
+
value
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
end
|
328
|
+
|
329
|
+
end
|
@@ -0,0 +1,247 @@
|
|
1
|
+
=begin
|
2
|
+
#OneSignal
|
3
|
+
|
4
|
+
#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: devrel@onesignal.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.2.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module OneSignal
|
17
|
+
class PlayerSlice
|
18
|
+
attr_accessor :total_count
|
19
|
+
|
20
|
+
attr_accessor :offset
|
21
|
+
|
22
|
+
attr_accessor :limit
|
23
|
+
|
24
|
+
attr_accessor :players
|
25
|
+
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
+
def self.attribute_map
|
28
|
+
{
|
29
|
+
:'total_count' => :'total_count',
|
30
|
+
:'offset' => :'offset',
|
31
|
+
:'limit' => :'limit',
|
32
|
+
:'players' => :'players'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Returns all the JSON keys this model knows about
|
37
|
+
def self.acceptable_attributes
|
38
|
+
attribute_map.values
|
39
|
+
end
|
40
|
+
|
41
|
+
# Attribute type mapping.
|
42
|
+
def self.openapi_types
|
43
|
+
{
|
44
|
+
:'total_count' => :'Integer',
|
45
|
+
:'offset' => :'Integer',
|
46
|
+
:'limit' => :'Integer',
|
47
|
+
:'players' => :'Array<Player>'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# List of attributes with nullable: true
|
52
|
+
def self.openapi_nullable
|
53
|
+
Set.new([
|
54
|
+
])
|
55
|
+
end
|
56
|
+
|
57
|
+
# Initializes the object
|
58
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
59
|
+
def initialize(attributes = {})
|
60
|
+
if (!attributes.is_a?(Hash))
|
61
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::PlayerSlice` initialize method"
|
62
|
+
end
|
63
|
+
|
64
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
65
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
66
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
67
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::PlayerSlice`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
68
|
+
end
|
69
|
+
h[k.to_sym] = v
|
70
|
+
}
|
71
|
+
|
72
|
+
if attributes.key?(:'total_count')
|
73
|
+
self.total_count = attributes[:'total_count']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.key?(:'offset')
|
77
|
+
self.offset = attributes[:'offset']
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.key?(:'limit')
|
81
|
+
self.limit = attributes[:'limit']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.key?(:'players')
|
85
|
+
if (value = attributes[:'players']).is_a?(Array)
|
86
|
+
self.players = value
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
92
|
+
# @return Array for valid properties with the reasons
|
93
|
+
def list_invalid_properties
|
94
|
+
invalid_properties = Array.new
|
95
|
+
invalid_properties
|
96
|
+
end
|
97
|
+
|
98
|
+
# Check to see if the all the properties in the model are valid
|
99
|
+
# @return true if the model is valid
|
100
|
+
def valid?
|
101
|
+
true
|
102
|
+
end
|
103
|
+
|
104
|
+
# Checks equality by comparing each attribute.
|
105
|
+
# @param [Object] Object to be compared
|
106
|
+
def ==(o)
|
107
|
+
return true if self.equal?(o)
|
108
|
+
self.class == o.class &&
|
109
|
+
total_count == o.total_count &&
|
110
|
+
offset == o.offset &&
|
111
|
+
limit == o.limit &&
|
112
|
+
players == o.players
|
113
|
+
end
|
114
|
+
|
115
|
+
# @see the `==` method
|
116
|
+
# @param [Object] Object to be compared
|
117
|
+
def eql?(o)
|
118
|
+
self == o
|
119
|
+
end
|
120
|
+
|
121
|
+
# Calculates hash code according to all attributes.
|
122
|
+
# @return [Integer] Hash code
|
123
|
+
def hash
|
124
|
+
[total_count, offset, limit, players].hash
|
125
|
+
end
|
126
|
+
|
127
|
+
# Builds the object from hash
|
128
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
129
|
+
# @return [Object] Returns the model itself
|
130
|
+
def self.build_from_hash(attributes)
|
131
|
+
new.build_from_hash(attributes)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Builds the object from hash
|
135
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
136
|
+
# @return [Object] Returns the model itself
|
137
|
+
def build_from_hash(attributes)
|
138
|
+
return nil unless attributes.is_a?(Hash)
|
139
|
+
self.class.openapi_types.each_pair do |key, type|
|
140
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
141
|
+
self.send("#{key}=", nil)
|
142
|
+
elsif type =~ /\AArray<(.*)>/i
|
143
|
+
# check to ensure the input is an array given that the attribute
|
144
|
+
# is documented as an array but the input is not
|
145
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
146
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
147
|
+
end
|
148
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
149
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
self
|
154
|
+
end
|
155
|
+
|
156
|
+
# Deserializes the data based on type
|
157
|
+
# @param string type Data type
|
158
|
+
# @param string value Value to be deserialized
|
159
|
+
# @return [Object] Deserialized data
|
160
|
+
def _deserialize(type, value)
|
161
|
+
case type.to_sym
|
162
|
+
when :Time
|
163
|
+
Time.parse(value)
|
164
|
+
when :Date
|
165
|
+
Date.parse(value)
|
166
|
+
when :String
|
167
|
+
value.to_s
|
168
|
+
when :Integer
|
169
|
+
value.to_i
|
170
|
+
when :Float
|
171
|
+
value.to_f
|
172
|
+
when :Boolean
|
173
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
174
|
+
true
|
175
|
+
else
|
176
|
+
false
|
177
|
+
end
|
178
|
+
when :Object
|
179
|
+
# generic object (usually a Hash), return directly
|
180
|
+
value
|
181
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
182
|
+
inner_type = Regexp.last_match[:inner_type]
|
183
|
+
value.map { |v| _deserialize(inner_type, v) }
|
184
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
185
|
+
k_type = Regexp.last_match[:k_type]
|
186
|
+
v_type = Regexp.last_match[:v_type]
|
187
|
+
{}.tap do |hash|
|
188
|
+
value.each do |k, v|
|
189
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
else # model
|
193
|
+
# models (e.g. Pet) or oneOf
|
194
|
+
klass = OneSignal.const_get(type)
|
195
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
# Returns the string representation of the object
|
200
|
+
# @return [String] String presentation of the object
|
201
|
+
def to_s
|
202
|
+
to_hash.to_s
|
203
|
+
end
|
204
|
+
|
205
|
+
# to_body is an alias to to_hash (backward compatibility)
|
206
|
+
# @return [Hash] Returns the object in the form of hash
|
207
|
+
def to_body
|
208
|
+
to_hash
|
209
|
+
end
|
210
|
+
|
211
|
+
# Returns the object in the form of hash
|
212
|
+
# @return [Hash] Returns the object in the form of hash
|
213
|
+
def to_hash
|
214
|
+
hash = {}
|
215
|
+
self.class.attribute_map.each_pair do |attr, param|
|
216
|
+
value = self.send(attr)
|
217
|
+
if value.nil?
|
218
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
219
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
220
|
+
end
|
221
|
+
|
222
|
+
hash[param] = _to_hash(value)
|
223
|
+
end
|
224
|
+
hash
|
225
|
+
end
|
226
|
+
|
227
|
+
# Outputs non-array value in the form of hash
|
228
|
+
# For object, use to_hash. Otherwise, just return the value
|
229
|
+
# @param [Object] value Any valid value
|
230
|
+
# @return [Hash] Returns the value in the form of hash
|
231
|
+
def _to_hash(value)
|
232
|
+
if value.is_a?(Array)
|
233
|
+
value.compact.map { |v| _to_hash(v) }
|
234
|
+
elsif value.is_a?(Hash)
|
235
|
+
{}.tap do |hash|
|
236
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
237
|
+
end
|
238
|
+
elsif value.respond_to? :to_hash
|
239
|
+
value.to_hash
|
240
|
+
else
|
241
|
+
value
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
end
|
246
|
+
|
247
|
+
end
|