onesignal 5.13.0 → 5.15.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/docs/BasicNotification.md +6 -2
- data/docs/BasicNotificationAllOf.md +5 -1
- data/docs/DefaultApi.md +77 -0
- data/docs/EmailWarmUp.md +24 -0
- data/docs/EmailWarmUpRequest.md +20 -0
- data/docs/EmailWarmUpStage.md +24 -0
- data/docs/EstimateNotificationRecipientsRequest.md +28 -0
- data/docs/EstimateNotificationRecipientsRequestAllOf.md +24 -0
- data/docs/EstimateNotificationRecipientsSuccessResponse.md +26 -0
- data/docs/Notification.md +6 -2
- data/docs/NotificationTarget.md +1 -1
- data/docs/NotificationWithMeta.md +6 -2
- data/docs/NotificationWithMetaAllOf.md +3 -1
- data/docs/SegmentNotificationTarget.md +1 -1
- data/lib/onesignal/api/default_api.rb +68 -0
- data/lib/onesignal/api_client.rb +1 -1
- data/lib/onesignal/models/basic_notification.rb +36 -3
- data/lib/onesignal/models/basic_notification_all_of.rb +35 -2
- data/lib/onesignal/models/email_warm_up.rb +298 -0
- data/lib/onesignal/models/email_warm_up_request.rb +272 -0
- data/lib/onesignal/models/email_warm_up_stage.rb +284 -0
- data/lib/onesignal/models/estimate_notification_recipients_request.rb +326 -0
- data/lib/onesignal/models/estimate_notification_recipients_request_all_of.rb +288 -0
- data/lib/onesignal/models/estimate_notification_recipients_success_response.rb +260 -0
- data/lib/onesignal/models/notification.rb +36 -3
- data/lib/onesignal/models/notification_target.rb +1 -1
- data/lib/onesignal/models/notification_with_meta.rb +35 -3
- data/lib/onesignal/models/notification_with_meta_all_of.rb +14 -5
- data/lib/onesignal/models/segment_notification_target.rb +1 -1
- data/lib/onesignal/version.rb +1 -1
- data/lib/onesignal.rb +6 -0
- data/spec/api/default_api_spec.rb +12 -0
- data/spec/models/basic_notification_all_of_spec.rb +16 -0
- data/spec/models/basic_notification_spec.rb +16 -0
- data/spec/models/email_warm_up_request_spec.rb +43 -0
- data/spec/models/email_warm_up_spec.rb +59 -0
- data/spec/models/email_warm_up_stage_spec.rb +51 -0
- data/spec/models/estimate_notification_recipients_request_all_of_spec.rb +55 -0
- data/spec/models/estimate_notification_recipients_request_spec.rb +67 -0
- data/spec/models/estimate_notification_recipients_success_response_spec.rb +57 -0
- data/spec/models/notification_spec.rb +16 -0
- data/spec/models/notification_with_meta_all_of_spec.rb +6 -0
- data/spec/models/notification_with_meta_spec.rb +16 -0
- metadata +26 -2
|
@@ -0,0 +1,326 @@
|
|
|
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
|
+
Contact: devrel@onesignal.com
|
|
7
|
+
Generated by: https://openapi-generator.tech
|
|
8
|
+
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
|
9
|
+
|
|
10
|
+
=end
|
|
11
|
+
|
|
12
|
+
require 'date'
|
|
13
|
+
require 'time'
|
|
14
|
+
|
|
15
|
+
module OneSignal
|
|
16
|
+
# The targeting subset of notification fields this endpoint honors. `included_segments` (or its `\"All\"` shorthand) is required. `excluded_segments`, `filters`, `include_aliases`, and `target_channel` narrow that segment-based audience further when present. Use `target_channel` to select which platforms to count. Other notification targeting fields (`include_subscription_ids` and the other raw subscription id/token fields, and the individual `isIos` / `isAndroid` / etc. platform flags) are not read by this endpoint. All non-targeting notification fields (content, delivery options, and so on) are accepted, but ignored.
|
|
17
|
+
class EstimateNotificationRecipientsRequest
|
|
18
|
+
# The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup.
|
|
19
|
+
attr_accessor :included_segments
|
|
20
|
+
|
|
21
|
+
# Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"]
|
|
22
|
+
attr_accessor :excluded_segments
|
|
23
|
+
|
|
24
|
+
# The OneSignal App ID for your app, which can be found in Keys & IDs.
|
|
25
|
+
attr_accessor :app_id
|
|
26
|
+
|
|
27
|
+
attr_accessor :filters
|
|
28
|
+
|
|
29
|
+
# Target specific users by aliases assigned via API. An alias can be an external_id, onesignal_id, or a custom alias. Accepts an object where keys are alias labels and values are arrays of alias IDs to include Example usage: { \"external_id\": [\"exId1\", \"extId2\"], \"internal_label\": [\"id1\", \"id2\"] } Keys must match API spellings exactly (for example the label for External ID is the string `external_id`; arbitrary keys such as camelCase variants are not aliases and may yield no recipients). Not compatible with any other targeting parameters. 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 target_channel to indicate you are sending a push or email or sms.
|
|
30
|
+
attr_accessor :include_aliases
|
|
31
|
+
|
|
32
|
+
# Which platforms to count recipients for. Selects the same default platforms Create notification would use for the channel. Individual platform flags (`isIos`, `isAndroid`, etc.) are not supported by this endpoint.
|
|
33
|
+
attr_accessor :target_channel
|
|
34
|
+
|
|
35
|
+
class EnumAttributeValidator
|
|
36
|
+
attr_reader :datatype
|
|
37
|
+
attr_reader :allowable_values
|
|
38
|
+
|
|
39
|
+
def initialize(datatype, allowable_values)
|
|
40
|
+
@allowable_values = allowable_values.map do |value|
|
|
41
|
+
case datatype.to_s
|
|
42
|
+
when /Integer/i
|
|
43
|
+
value.to_i
|
|
44
|
+
when /Float/i
|
|
45
|
+
value.to_f
|
|
46
|
+
else
|
|
47
|
+
value
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def valid?(value)
|
|
53
|
+
!value || allowable_values.include?(value)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
58
|
+
def self.attribute_map
|
|
59
|
+
{
|
|
60
|
+
:'included_segments' => :'included_segments',
|
|
61
|
+
:'excluded_segments' => :'excluded_segments',
|
|
62
|
+
:'app_id' => :'app_id',
|
|
63
|
+
:'filters' => :'filters',
|
|
64
|
+
:'include_aliases' => :'include_aliases',
|
|
65
|
+
:'target_channel' => :'target_channel'
|
|
66
|
+
}
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Returns all the JSON keys this model knows about
|
|
70
|
+
def self.acceptable_attributes
|
|
71
|
+
attribute_map.values
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Attribute type mapping.
|
|
75
|
+
def self.openapi_types
|
|
76
|
+
{
|
|
77
|
+
:'included_segments' => :'Array<String>',
|
|
78
|
+
:'excluded_segments' => :'Array<String>',
|
|
79
|
+
:'app_id' => :'String',
|
|
80
|
+
:'filters' => :'Array<FilterExpression>',
|
|
81
|
+
:'include_aliases' => :'Hash<String, Array<String>>',
|
|
82
|
+
:'target_channel' => :'String'
|
|
83
|
+
}
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# List of attributes with nullable: true
|
|
87
|
+
def self.openapi_nullable
|
|
88
|
+
Set.new([
|
|
89
|
+
:'filters',
|
|
90
|
+
:'include_aliases',
|
|
91
|
+
])
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# List of class defined in allOf (OpenAPI v3)
|
|
95
|
+
def self.openapi_all_of
|
|
96
|
+
[
|
|
97
|
+
:'EstimateNotificationRecipientsRequestAllOf',
|
|
98
|
+
:'SegmentNotificationTarget'
|
|
99
|
+
]
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Initializes the object
|
|
103
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
104
|
+
def initialize(attributes = {})
|
|
105
|
+
if (!attributes.is_a?(Hash))
|
|
106
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::EstimateNotificationRecipientsRequest` initialize method"
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
110
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
111
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
112
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::EstimateNotificationRecipientsRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
113
|
+
end
|
|
114
|
+
h[k.to_sym] = v
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if attributes.key?(:'included_segments')
|
|
118
|
+
if (value = attributes[:'included_segments']).is_a?(Array)
|
|
119
|
+
self.included_segments = value
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
if attributes.key?(:'excluded_segments')
|
|
124
|
+
if (value = attributes[:'excluded_segments']).is_a?(Array)
|
|
125
|
+
self.excluded_segments = value
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
if attributes.key?(:'app_id')
|
|
130
|
+
self.app_id = attributes[:'app_id']
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
if attributes.key?(:'filters')
|
|
134
|
+
if (value = attributes[:'filters']).is_a?(Array)
|
|
135
|
+
self.filters = value
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
if attributes.key?(:'include_aliases')
|
|
140
|
+
if (value = attributes[:'include_aliases']).is_a?(Hash)
|
|
141
|
+
self.include_aliases = value
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
if attributes.key?(:'target_channel')
|
|
146
|
+
self.target_channel = attributes[:'target_channel']
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
151
|
+
# @return Array for valid properties with the reasons
|
|
152
|
+
def list_invalid_properties
|
|
153
|
+
invalid_properties = Array.new
|
|
154
|
+
if @app_id.nil?
|
|
155
|
+
invalid_properties.push('invalid value for "app_id", app_id cannot be nil.')
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
invalid_properties
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Check to see if the all the properties in the model are valid
|
|
162
|
+
# @return true if the model is valid
|
|
163
|
+
def valid?
|
|
164
|
+
return false if @app_id.nil?
|
|
165
|
+
target_channel_validator = EnumAttributeValidator.new('String', ["push", "email", "sms"])
|
|
166
|
+
return false unless target_channel_validator.valid?(@target_channel)
|
|
167
|
+
true
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
171
|
+
# @param [Object] target_channel Object to be assigned
|
|
172
|
+
def target_channel=(target_channel)
|
|
173
|
+
validator = EnumAttributeValidator.new('String', ["push", "email", "sms"])
|
|
174
|
+
unless validator.valid?(target_channel)
|
|
175
|
+
fail ArgumentError, "invalid value for \"target_channel\", must be one of #{validator.allowable_values}."
|
|
176
|
+
end
|
|
177
|
+
@target_channel = target_channel
|
|
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
|
+
included_segments == o.included_segments &&
|
|
186
|
+
excluded_segments == o.excluded_segments &&
|
|
187
|
+
app_id == o.app_id &&
|
|
188
|
+
filters == o.filters &&
|
|
189
|
+
include_aliases == o.include_aliases &&
|
|
190
|
+
target_channel == o.target_channel
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# @see the `==` method
|
|
194
|
+
# @param [Object] Object to be compared
|
|
195
|
+
def eql?(o)
|
|
196
|
+
self == o
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Calculates hash code according to all attributes.
|
|
200
|
+
# @return [Integer] Hash code
|
|
201
|
+
def hash
|
|
202
|
+
[included_segments, excluded_segments, app_id, filters, include_aliases, target_channel].hash
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Builds the object from hash
|
|
206
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
207
|
+
# @return [Object] Returns the model itself
|
|
208
|
+
def self.build_from_hash(attributes)
|
|
209
|
+
new.build_from_hash(attributes)
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Builds the object from hash
|
|
213
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
214
|
+
# @return [Object] Returns the model itself
|
|
215
|
+
def build_from_hash(attributes)
|
|
216
|
+
return nil unless attributes.is_a?(Hash)
|
|
217
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
218
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
219
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
220
|
+
self.send("#{key}=", nil)
|
|
221
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
222
|
+
# check to ensure the input is an array given that the attribute
|
|
223
|
+
# is documented as an array but the input is not
|
|
224
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
225
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
226
|
+
end
|
|
227
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
228
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
self
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
# Deserializes the data based on type
|
|
236
|
+
# @param string type Data type
|
|
237
|
+
# @param string value Value to be deserialized
|
|
238
|
+
# @return [Object] Deserialized data
|
|
239
|
+
def _deserialize(type, value)
|
|
240
|
+
case type.to_sym
|
|
241
|
+
when :Time
|
|
242
|
+
Time.parse(value)
|
|
243
|
+
when :Date
|
|
244
|
+
Date.parse(value)
|
|
245
|
+
when :String
|
|
246
|
+
value.to_s
|
|
247
|
+
when :Integer
|
|
248
|
+
value.to_i
|
|
249
|
+
when :Float
|
|
250
|
+
value.to_f
|
|
251
|
+
when :Boolean
|
|
252
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
253
|
+
true
|
|
254
|
+
else
|
|
255
|
+
false
|
|
256
|
+
end
|
|
257
|
+
when :Object
|
|
258
|
+
# generic object (usually a Hash), return directly
|
|
259
|
+
value
|
|
260
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
261
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
262
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
263
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
264
|
+
k_type = Regexp.last_match[:k_type]
|
|
265
|
+
v_type = Regexp.last_match[:v_type]
|
|
266
|
+
{}.tap do |hash|
|
|
267
|
+
value.each do |k, v|
|
|
268
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
else # model
|
|
272
|
+
# models (e.g. Pet) or oneOf
|
|
273
|
+
klass = OneSignal.const_get(type)
|
|
274
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
275
|
+
end
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
# Returns the string representation of the object
|
|
279
|
+
# @return [String] String presentation of the object
|
|
280
|
+
def to_s
|
|
281
|
+
to_hash.to_s
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
285
|
+
# @return [Hash] Returns the object in the form of hash
|
|
286
|
+
def to_body
|
|
287
|
+
to_hash
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
# Returns the object in the form of hash
|
|
291
|
+
# @return [Hash] Returns the object in the form of hash
|
|
292
|
+
def to_hash
|
|
293
|
+
hash = {}
|
|
294
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
295
|
+
value = self.send(attr)
|
|
296
|
+
if value.nil?
|
|
297
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
298
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
hash[param] = _to_hash(value)
|
|
302
|
+
end
|
|
303
|
+
hash
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
# Outputs non-array value in the form of hash
|
|
307
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
308
|
+
# @param [Object] value Any valid value
|
|
309
|
+
# @return [Hash] Returns the value in the form of hash
|
|
310
|
+
def _to_hash(value)
|
|
311
|
+
if value.is_a?(Array)
|
|
312
|
+
value.compact.map { |v| _to_hash(v) }
|
|
313
|
+
elsif value.is_a?(Hash)
|
|
314
|
+
{}.tap do |hash|
|
|
315
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
316
|
+
end
|
|
317
|
+
elsif value.respond_to? :to_hash
|
|
318
|
+
value.to_hash
|
|
319
|
+
else
|
|
320
|
+
value
|
|
321
|
+
end
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
end
|
|
@@ -0,0 +1,288 @@
|
|
|
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
|
+
Contact: devrel@onesignal.com
|
|
7
|
+
Generated by: https://openapi-generator.tech
|
|
8
|
+
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
|
9
|
+
|
|
10
|
+
=end
|
|
11
|
+
|
|
12
|
+
require 'date'
|
|
13
|
+
require 'time'
|
|
14
|
+
|
|
15
|
+
module OneSignal
|
|
16
|
+
class EstimateNotificationRecipientsRequestAllOf
|
|
17
|
+
# The OneSignal App ID for your app, which can be found in Keys & IDs.
|
|
18
|
+
attr_accessor :app_id
|
|
19
|
+
|
|
20
|
+
attr_accessor :filters
|
|
21
|
+
|
|
22
|
+
# Target specific users by aliases assigned via API. An alias can be an external_id, onesignal_id, or a custom alias. Accepts an object where keys are alias labels and values are arrays of alias IDs to include Example usage: { \"external_id\": [\"exId1\", \"extId2\"], \"internal_label\": [\"id1\", \"id2\"] } Keys must match API spellings exactly (for example the label for External ID is the string `external_id`; arbitrary keys such as camelCase variants are not aliases and may yield no recipients). Not compatible with any other targeting parameters. 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 target_channel to indicate you are sending a push or email or sms.
|
|
23
|
+
attr_accessor :include_aliases
|
|
24
|
+
|
|
25
|
+
# Which platforms to count recipients for. Selects the same default platforms Create notification would use for the channel. Individual platform flags (`isIos`, `isAndroid`, etc.) are not supported by this endpoint.
|
|
26
|
+
attr_accessor :target_channel
|
|
27
|
+
|
|
28
|
+
class EnumAttributeValidator
|
|
29
|
+
attr_reader :datatype
|
|
30
|
+
attr_reader :allowable_values
|
|
31
|
+
|
|
32
|
+
def initialize(datatype, allowable_values)
|
|
33
|
+
@allowable_values = allowable_values.map do |value|
|
|
34
|
+
case datatype.to_s
|
|
35
|
+
when /Integer/i
|
|
36
|
+
value.to_i
|
|
37
|
+
when /Float/i
|
|
38
|
+
value.to_f
|
|
39
|
+
else
|
|
40
|
+
value
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def valid?(value)
|
|
46
|
+
!value || allowable_values.include?(value)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
51
|
+
def self.attribute_map
|
|
52
|
+
{
|
|
53
|
+
:'app_id' => :'app_id',
|
|
54
|
+
:'filters' => :'filters',
|
|
55
|
+
:'include_aliases' => :'include_aliases',
|
|
56
|
+
:'target_channel' => :'target_channel'
|
|
57
|
+
}
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Returns all the JSON keys this model knows about
|
|
61
|
+
def self.acceptable_attributes
|
|
62
|
+
attribute_map.values
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Attribute type mapping.
|
|
66
|
+
def self.openapi_types
|
|
67
|
+
{
|
|
68
|
+
:'app_id' => :'String',
|
|
69
|
+
:'filters' => :'Array<FilterExpression>',
|
|
70
|
+
:'include_aliases' => :'Hash<String, Array<String>>',
|
|
71
|
+
:'target_channel' => :'String'
|
|
72
|
+
}
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# List of attributes with nullable: true
|
|
76
|
+
def self.openapi_nullable
|
|
77
|
+
Set.new([
|
|
78
|
+
:'filters',
|
|
79
|
+
:'include_aliases',
|
|
80
|
+
])
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Initializes the object
|
|
84
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
85
|
+
def initialize(attributes = {})
|
|
86
|
+
if (!attributes.is_a?(Hash))
|
|
87
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::EstimateNotificationRecipientsRequestAllOf` initialize method"
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
91
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
92
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
93
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::EstimateNotificationRecipientsRequestAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
94
|
+
end
|
|
95
|
+
h[k.to_sym] = v
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if attributes.key?(:'app_id')
|
|
99
|
+
self.app_id = attributes[:'app_id']
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
if attributes.key?(:'filters')
|
|
103
|
+
if (value = attributes[:'filters']).is_a?(Array)
|
|
104
|
+
self.filters = value
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if attributes.key?(:'include_aliases')
|
|
109
|
+
if (value = attributes[:'include_aliases']).is_a?(Hash)
|
|
110
|
+
self.include_aliases = value
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
if attributes.key?(:'target_channel')
|
|
115
|
+
self.target_channel = attributes[:'target_channel']
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
120
|
+
# @return Array for valid properties with the reasons
|
|
121
|
+
def list_invalid_properties
|
|
122
|
+
invalid_properties = Array.new
|
|
123
|
+
invalid_properties
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Check to see if the all the properties in the model are valid
|
|
127
|
+
# @return true if the model is valid
|
|
128
|
+
def valid?
|
|
129
|
+
target_channel_validator = EnumAttributeValidator.new('String', ["push", "email", "sms"])
|
|
130
|
+
return false unless target_channel_validator.valid?(@target_channel)
|
|
131
|
+
true
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
135
|
+
# @param [Object] target_channel Object to be assigned
|
|
136
|
+
def target_channel=(target_channel)
|
|
137
|
+
validator = EnumAttributeValidator.new('String', ["push", "email", "sms"])
|
|
138
|
+
unless validator.valid?(target_channel)
|
|
139
|
+
fail ArgumentError, "invalid value for \"target_channel\", must be one of #{validator.allowable_values}."
|
|
140
|
+
end
|
|
141
|
+
@target_channel = target_channel
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Checks equality by comparing each attribute.
|
|
145
|
+
# @param [Object] Object to be compared
|
|
146
|
+
def ==(o)
|
|
147
|
+
return true if self.equal?(o)
|
|
148
|
+
self.class == o.class &&
|
|
149
|
+
app_id == o.app_id &&
|
|
150
|
+
filters == o.filters &&
|
|
151
|
+
include_aliases == o.include_aliases &&
|
|
152
|
+
target_channel == o.target_channel
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# @see the `==` method
|
|
156
|
+
# @param [Object] Object to be compared
|
|
157
|
+
def eql?(o)
|
|
158
|
+
self == o
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Calculates hash code according to all attributes.
|
|
162
|
+
# @return [Integer] Hash code
|
|
163
|
+
def hash
|
|
164
|
+
[app_id, filters, include_aliases, target_channel].hash
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Builds the object from hash
|
|
168
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
169
|
+
# @return [Object] Returns the model itself
|
|
170
|
+
def self.build_from_hash(attributes)
|
|
171
|
+
new.build_from_hash(attributes)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Builds the object from hash
|
|
175
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
176
|
+
# @return [Object] Returns the model itself
|
|
177
|
+
def build_from_hash(attributes)
|
|
178
|
+
return nil unless attributes.is_a?(Hash)
|
|
179
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
180
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
181
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
182
|
+
self.send("#{key}=", nil)
|
|
183
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
184
|
+
# check to ensure the input is an array given that the attribute
|
|
185
|
+
# is documented as an array but the input is not
|
|
186
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
187
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
188
|
+
end
|
|
189
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
190
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
self
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Deserializes the data based on type
|
|
198
|
+
# @param string type Data type
|
|
199
|
+
# @param string value Value to be deserialized
|
|
200
|
+
# @return [Object] Deserialized data
|
|
201
|
+
def _deserialize(type, value)
|
|
202
|
+
case type.to_sym
|
|
203
|
+
when :Time
|
|
204
|
+
Time.parse(value)
|
|
205
|
+
when :Date
|
|
206
|
+
Date.parse(value)
|
|
207
|
+
when :String
|
|
208
|
+
value.to_s
|
|
209
|
+
when :Integer
|
|
210
|
+
value.to_i
|
|
211
|
+
when :Float
|
|
212
|
+
value.to_f
|
|
213
|
+
when :Boolean
|
|
214
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
215
|
+
true
|
|
216
|
+
else
|
|
217
|
+
false
|
|
218
|
+
end
|
|
219
|
+
when :Object
|
|
220
|
+
# generic object (usually a Hash), return directly
|
|
221
|
+
value
|
|
222
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
223
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
224
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
225
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
226
|
+
k_type = Regexp.last_match[:k_type]
|
|
227
|
+
v_type = Regexp.last_match[:v_type]
|
|
228
|
+
{}.tap do |hash|
|
|
229
|
+
value.each do |k, v|
|
|
230
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
else # model
|
|
234
|
+
# models (e.g. Pet) or oneOf
|
|
235
|
+
klass = OneSignal.const_get(type)
|
|
236
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# Returns the string representation of the object
|
|
241
|
+
# @return [String] String presentation of the object
|
|
242
|
+
def to_s
|
|
243
|
+
to_hash.to_s
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
247
|
+
# @return [Hash] Returns the object in the form of hash
|
|
248
|
+
def to_body
|
|
249
|
+
to_hash
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# Returns the object in the form of hash
|
|
253
|
+
# @return [Hash] Returns the object in the form of hash
|
|
254
|
+
def to_hash
|
|
255
|
+
hash = {}
|
|
256
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
257
|
+
value = self.send(attr)
|
|
258
|
+
if value.nil?
|
|
259
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
260
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
hash[param] = _to_hash(value)
|
|
264
|
+
end
|
|
265
|
+
hash
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
# Outputs non-array value in the form of hash
|
|
269
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
270
|
+
# @param [Object] value Any valid value
|
|
271
|
+
# @return [Hash] Returns the value in the form of hash
|
|
272
|
+
def _to_hash(value)
|
|
273
|
+
if value.is_a?(Array)
|
|
274
|
+
value.compact.map { |v| _to_hash(v) }
|
|
275
|
+
elsif value.is_a?(Hash)
|
|
276
|
+
{}.tap do |hash|
|
|
277
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
278
|
+
end
|
|
279
|
+
elsif value.respond_to? :to_hash
|
|
280
|
+
value.to_hash
|
|
281
|
+
else
|
|
282
|
+
value
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
end
|