onesignal 5.11.2 → 5.12.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 +2 -0
- data/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/docs/CreateJourneyRequest.md +30 -0
- data/docs/DefaultApi.md +563 -0
- data/docs/Journey.md +48 -0
- data/docs/JourneyAudience.md +28 -0
- data/docs/JourneyBranch.md +24 -0
- data/docs/JourneyBranchStats.md +18 -0
- data/docs/JourneyCondition.md +34 -0
- data/docs/JourneyEarlyExit.md +20 -0
- data/docs/JourneyEarlyExitRules.md +24 -0
- data/docs/JourneyEarlyExitRulesOnEvent.md +18 -0
- data/docs/JourneyEarlyExitRulesOnSegment.md +18 -0
- data/docs/JourneyEventAttribute.md +22 -0
- data/docs/JourneyListAudience.md +18 -0
- data/docs/JourneyListItem.md +40 -0
- data/docs/JourneyListResponse.md +22 -0
- data/docs/JourneyMessageStats.md +18 -0
- data/docs/JourneyNode.md +50 -0
- data/docs/JourneyNodeStats.md +26 -0
- data/docs/JourneyReentryRules.md +18 -0
- data/docs/JourneySchedule.md +22 -0
- data/docs/JourneyStats.md +28 -0
- data/docs/JourneyTimePoint.md +20 -0
- data/docs/JourneyTimeWindow.md +22 -0
- data/docs/JourneyWaitUntilExpiration.md +20 -0
- data/docs/UpdateJourneyNodeRequest.md +48 -0
- data/docs/UpdateJourneyRequest.md +34 -0
- data/lib/onesignal/api/default_api.rb +524 -0
- data/lib/onesignal/api_client.rb +1 -1
- data/lib/onesignal/models/create_journey_request.rb +287 -0
- data/lib/onesignal/models/journey.rb +409 -0
- data/lib/onesignal/models/journey_audience.rb +316 -0
- data/lib/onesignal/models/journey_branch.rb +250 -0
- data/lib/onesignal/models/journey_branch_stats.rb +220 -0
- data/lib/onesignal/models/journey_condition.rb +360 -0
- data/lib/onesignal/models/journey_early_exit.rb +231 -0
- data/lib/onesignal/models/journey_early_exit_rules.rb +251 -0
- data/lib/onesignal/models/journey_early_exit_rules_on_event.rb +224 -0
- data/lib/onesignal/models/journey_early_exit_rules_on_segment.rb +221 -0
- data/lib/onesignal/models/journey_event_attribute.rb +283 -0
- data/lib/onesignal/models/journey_list_audience.rb +254 -0
- data/lib/onesignal/models/journey_list_item.rb +366 -0
- data/lib/onesignal/models/journey_list_response.rb +241 -0
- data/lib/onesignal/models/journey_message_stats.rb +222 -0
- data/lib/onesignal/models/journey_node.rb +480 -0
- data/lib/onesignal/models/journey_node_stats.rb +293 -0
- data/lib/onesignal/models/journey_reentry_rules.rb +236 -0
- data/lib/onesignal/models/journey_schedule.rb +243 -0
- data/lib/onesignal/models/journey_stats.rb +274 -0
- data/lib/onesignal/models/journey_time_point.rb +277 -0
- data/lib/onesignal/models/journey_time_window.rb +266 -0
- data/lib/onesignal/models/journey_wait_until_expiration.rb +256 -0
- data/lib/onesignal/models/update_journey_node_request.rb +454 -0
- data/lib/onesignal/models/update_journey_request.rb +337 -0
- data/lib/onesignal/version.rb +1 -1
- data/lib/onesignal.rb +25 -0
- data/spec/api/default_api_spec.rb +95 -0
- data/spec/models/create_journey_request_spec.rb +69 -0
- data/spec/models/journey_audience_spec.rb +67 -0
- data/spec/models/journey_branch_spec.rb +51 -0
- data/spec/models/journey_branch_stats_spec.rb +33 -0
- data/spec/models/journey_condition_spec.rb +89 -0
- data/spec/models/journey_early_exit_rules_on_event_spec.rb +33 -0
- data/spec/models/journey_early_exit_rules_on_segment_spec.rb +33 -0
- data/spec/models/journey_early_exit_rules_spec.rb +51 -0
- data/spec/models/journey_early_exit_spec.rb +39 -0
- data/spec/models/journey_event_attribute_spec.rb +49 -0
- data/spec/models/journey_list_audience_spec.rb +37 -0
- data/spec/models/journey_list_item_spec.rb +103 -0
- data/spec/models/journey_list_response_spec.rb +45 -0
- data/spec/models/journey_message_stats_spec.rb +33 -0
- data/spec/models/journey_node_spec.rb +137 -0
- data/spec/models/journey_node_stats_spec.rb +61 -0
- data/spec/models/journey_reentry_rules_spec.rb +33 -0
- data/spec/models/journey_schedule_spec.rb +45 -0
- data/spec/models/journey_spec.rb +127 -0
- data/spec/models/journey_stats_spec.rb +63 -0
- data/spec/models/journey_time_point_spec.rb +39 -0
- data/spec/models/journey_time_window_spec.rb +45 -0
- data/spec/models/journey_wait_until_expiration_spec.rb +39 -0
- data/spec/models/update_journey_node_request_spec.rb +127 -0
- data/spec/models/update_journey_request_spec.rb +85 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-13.0.0/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/date-3.5.1/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.9.2/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.9.2/mkmf.log +3 -3
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.4.0/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.8.1/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.2.0/gem_make.out +5 -5
- metadata +102 -2
|
@@ -0,0 +1,480 @@
|
|
|
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
|
+
# A journey node. The kind field selects which other fields apply. Branching nodes (split_range, yes_no, wait_until) nest their sub-graphs inline via branches[].nodes.
|
|
17
|
+
class JourneyNode
|
|
18
|
+
# Server-assigned node UUID. Returned on reads. Required on update to keep an existing node. Rejected on create with a 400 validation error.
|
|
19
|
+
attr_accessor :id
|
|
20
|
+
|
|
21
|
+
# Node kind. Selects which other fields apply.
|
|
22
|
+
attr_accessor :kind
|
|
23
|
+
|
|
24
|
+
# Optional client-assigned identifier, unique within the journey. Use it to reference this node from elsewhere in the same request. Persisted and returned on reads.
|
|
25
|
+
attr_accessor :client_node_id
|
|
26
|
+
|
|
27
|
+
# Optional free-text label, up to 255 characters. Stored and returned as-is with no effect on journey behavior.
|
|
28
|
+
attr_accessor :annotation
|
|
29
|
+
|
|
30
|
+
# wait nodes: seconds to hold the user. Minimum 60, maximum 31556952 (1 year).
|
|
31
|
+
attr_accessor :duration_seconds
|
|
32
|
+
|
|
33
|
+
# time_window nodes: schedule_in_timezone uses the configured windows; last_active_time holds relative to the user's last active time.
|
|
34
|
+
attr_accessor :relative_to
|
|
35
|
+
|
|
36
|
+
# time_window nodes: one or more time windows. A window with no day_of_week applies to every day. Required when relative_to is schedule_in_timezone; omit when it is last_active_time.
|
|
37
|
+
attr_accessor :windows
|
|
38
|
+
|
|
39
|
+
# time_window nodes: IANA timezone identifier used when the user's timezone is unavailable.
|
|
40
|
+
attr_accessor :time_zone
|
|
41
|
+
|
|
42
|
+
# time_window nodes: when true, uses the user's timezone if available.
|
|
43
|
+
attr_accessor :use_user_time_zone
|
|
44
|
+
|
|
45
|
+
# send_push, send_email, and send_sms nodes: UUID of the template to send.
|
|
46
|
+
attr_accessor :template_id
|
|
47
|
+
|
|
48
|
+
# send_iam nodes: UUID of the in-app message to send.
|
|
49
|
+
attr_accessor :iam_id
|
|
50
|
+
|
|
51
|
+
# send_iam nodes: optional time-to-live for the in-app message, in seconds.
|
|
52
|
+
attr_accessor :user_ttl_seconds
|
|
53
|
+
|
|
54
|
+
# send_webhook nodes: UUID of the webhook to send.
|
|
55
|
+
attr_accessor :webhook_id
|
|
56
|
+
|
|
57
|
+
# tag nodes: tag key-value pairs to assign. An empty string value removes the tag. Keys are limited to 255 characters and values to 1024.
|
|
58
|
+
attr_accessor :assignments
|
|
59
|
+
|
|
60
|
+
# split_range nodes: when true, assigns each user to a branch at random on entry. Defaults to false.
|
|
61
|
+
attr_accessor :randomize_on_entry
|
|
62
|
+
|
|
63
|
+
# Branching nodes: nested branches. split_range requires 2-20 weighted branches that sum to 100. yes_no requires exactly 2 branches. wait_until requires 1-10 condition branches.
|
|
64
|
+
attr_accessor :branches
|
|
65
|
+
|
|
66
|
+
attr_accessor :expiration
|
|
67
|
+
|
|
68
|
+
class EnumAttributeValidator
|
|
69
|
+
attr_reader :datatype
|
|
70
|
+
attr_reader :allowable_values
|
|
71
|
+
|
|
72
|
+
def initialize(datatype, allowable_values)
|
|
73
|
+
@allowable_values = allowable_values.map do |value|
|
|
74
|
+
case datatype.to_s
|
|
75
|
+
when /Integer/i
|
|
76
|
+
value.to_i
|
|
77
|
+
when /Float/i
|
|
78
|
+
value.to_f
|
|
79
|
+
else
|
|
80
|
+
value
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def valid?(value)
|
|
86
|
+
!value || allowable_values.include?(value)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
91
|
+
def self.attribute_map
|
|
92
|
+
{
|
|
93
|
+
:'id' => :'id',
|
|
94
|
+
:'kind' => :'kind',
|
|
95
|
+
:'client_node_id' => :'client_node_id',
|
|
96
|
+
:'annotation' => :'annotation',
|
|
97
|
+
:'duration_seconds' => :'duration_seconds',
|
|
98
|
+
:'relative_to' => :'relative_to',
|
|
99
|
+
:'windows' => :'windows',
|
|
100
|
+
:'time_zone' => :'time_zone',
|
|
101
|
+
:'use_user_time_zone' => :'use_user_time_zone',
|
|
102
|
+
:'template_id' => :'template_id',
|
|
103
|
+
:'iam_id' => :'iam_id',
|
|
104
|
+
:'user_ttl_seconds' => :'user_ttl_seconds',
|
|
105
|
+
:'webhook_id' => :'webhook_id',
|
|
106
|
+
:'assignments' => :'assignments',
|
|
107
|
+
:'randomize_on_entry' => :'randomize_on_entry',
|
|
108
|
+
:'branches' => :'branches',
|
|
109
|
+
:'expiration' => :'expiration'
|
|
110
|
+
}
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Returns all the JSON keys this model knows about
|
|
114
|
+
def self.acceptable_attributes
|
|
115
|
+
attribute_map.values
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Attribute type mapping.
|
|
119
|
+
def self.openapi_types
|
|
120
|
+
{
|
|
121
|
+
:'id' => :'String',
|
|
122
|
+
:'kind' => :'String',
|
|
123
|
+
:'client_node_id' => :'String',
|
|
124
|
+
:'annotation' => :'String',
|
|
125
|
+
:'duration_seconds' => :'Integer',
|
|
126
|
+
:'relative_to' => :'String',
|
|
127
|
+
:'windows' => :'Array<JourneyTimeWindow>',
|
|
128
|
+
:'time_zone' => :'String',
|
|
129
|
+
:'use_user_time_zone' => :'Boolean',
|
|
130
|
+
:'template_id' => :'String',
|
|
131
|
+
:'iam_id' => :'String',
|
|
132
|
+
:'user_ttl_seconds' => :'Integer',
|
|
133
|
+
:'webhook_id' => :'String',
|
|
134
|
+
:'assignments' => :'Hash<String, String>',
|
|
135
|
+
:'randomize_on_entry' => :'Boolean',
|
|
136
|
+
:'branches' => :'Array<JourneyBranch>',
|
|
137
|
+
:'expiration' => :'JourneyWaitUntilExpiration'
|
|
138
|
+
}
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# List of attributes with nullable: true
|
|
142
|
+
def self.openapi_nullable
|
|
143
|
+
Set.new([
|
|
144
|
+
:'duration_seconds',
|
|
145
|
+
:'use_user_time_zone',
|
|
146
|
+
:'user_ttl_seconds',
|
|
147
|
+
:'randomize_on_entry',
|
|
148
|
+
:'expiration'
|
|
149
|
+
])
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# Initializes the object
|
|
153
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
154
|
+
def initialize(attributes = {})
|
|
155
|
+
if (!attributes.is_a?(Hash))
|
|
156
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyNode` initialize method"
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
160
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
161
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
162
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyNode`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
163
|
+
end
|
|
164
|
+
h[k.to_sym] = v
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if attributes.key?(:'id')
|
|
168
|
+
self.id = attributes[:'id']
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
if attributes.key?(:'kind')
|
|
172
|
+
self.kind = attributes[:'kind']
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
if attributes.key?(:'client_node_id')
|
|
176
|
+
self.client_node_id = attributes[:'client_node_id']
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
if attributes.key?(:'annotation')
|
|
180
|
+
self.annotation = attributes[:'annotation']
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
if attributes.key?(:'duration_seconds')
|
|
184
|
+
self.duration_seconds = attributes[:'duration_seconds']
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
if attributes.key?(:'relative_to')
|
|
188
|
+
self.relative_to = attributes[:'relative_to']
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
if attributes.key?(:'windows')
|
|
192
|
+
if (value = attributes[:'windows']).is_a?(Array)
|
|
193
|
+
self.windows = value
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
if attributes.key?(:'time_zone')
|
|
198
|
+
self.time_zone = attributes[:'time_zone']
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
if attributes.key?(:'use_user_time_zone')
|
|
202
|
+
self.use_user_time_zone = attributes[:'use_user_time_zone']
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
if attributes.key?(:'template_id')
|
|
206
|
+
self.template_id = attributes[:'template_id']
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
if attributes.key?(:'iam_id')
|
|
210
|
+
self.iam_id = attributes[:'iam_id']
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
if attributes.key?(:'user_ttl_seconds')
|
|
214
|
+
self.user_ttl_seconds = attributes[:'user_ttl_seconds']
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
if attributes.key?(:'webhook_id')
|
|
218
|
+
self.webhook_id = attributes[:'webhook_id']
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
if attributes.key?(:'assignments')
|
|
222
|
+
if (value = attributes[:'assignments']).is_a?(Hash)
|
|
223
|
+
self.assignments = value
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
if attributes.key?(:'randomize_on_entry')
|
|
228
|
+
self.randomize_on_entry = attributes[:'randomize_on_entry']
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
if attributes.key?(:'branches')
|
|
232
|
+
if (value = attributes[:'branches']).is_a?(Array)
|
|
233
|
+
self.branches = value
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
if attributes.key?(:'expiration')
|
|
238
|
+
self.expiration = attributes[:'expiration']
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
243
|
+
# @return Array for valid properties with the reasons
|
|
244
|
+
def list_invalid_properties
|
|
245
|
+
invalid_properties = Array.new
|
|
246
|
+
if @kind.nil?
|
|
247
|
+
invalid_properties.push('invalid value for "kind", kind cannot be nil.')
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
if !@duration_seconds.nil? && @duration_seconds > 31556952
|
|
251
|
+
invalid_properties.push('invalid value for "duration_seconds", must be smaller than or equal to 31556952.')
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
if !@duration_seconds.nil? && @duration_seconds < 60
|
|
255
|
+
invalid_properties.push('invalid value for "duration_seconds", must be greater than or equal to 60.')
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
if !@user_ttl_seconds.nil? && @user_ttl_seconds < 1
|
|
259
|
+
invalid_properties.push('invalid value for "user_ttl_seconds", must be greater than or equal to 1.')
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
invalid_properties
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
# Check to see if the all the properties in the model are valid
|
|
266
|
+
# @return true if the model is valid
|
|
267
|
+
def valid?
|
|
268
|
+
return false if @kind.nil?
|
|
269
|
+
kind_validator = EnumAttributeValidator.new('String', ["wait", "time_window", "send_push", "send_email", "send_sms", "send_iam", "send_webhook", "tag", "split_range", "yes_no", "wait_until"])
|
|
270
|
+
return false unless kind_validator.valid?(@kind)
|
|
271
|
+
return false if !@duration_seconds.nil? && @duration_seconds > 31556952
|
|
272
|
+
return false if !@duration_seconds.nil? && @duration_seconds < 60
|
|
273
|
+
relative_to_validator = EnumAttributeValidator.new('String', ["schedule_in_timezone", "last_active_time"])
|
|
274
|
+
return false unless relative_to_validator.valid?(@relative_to)
|
|
275
|
+
return false if !@user_ttl_seconds.nil? && @user_ttl_seconds < 1
|
|
276
|
+
true
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
280
|
+
# @param [Object] kind Object to be assigned
|
|
281
|
+
def kind=(kind)
|
|
282
|
+
validator = EnumAttributeValidator.new('String', ["wait", "time_window", "send_push", "send_email", "send_sms", "send_iam", "send_webhook", "tag", "split_range", "yes_no", "wait_until"])
|
|
283
|
+
unless validator.valid?(kind)
|
|
284
|
+
fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}."
|
|
285
|
+
end
|
|
286
|
+
@kind = kind
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
# Custom attribute writer method with validation
|
|
290
|
+
# @param [Object] duration_seconds Value to be assigned
|
|
291
|
+
def duration_seconds=(duration_seconds)
|
|
292
|
+
if !duration_seconds.nil? && duration_seconds > 31556952
|
|
293
|
+
fail ArgumentError, 'invalid value for "duration_seconds", must be smaller than or equal to 31556952.'
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
if !duration_seconds.nil? && duration_seconds < 60
|
|
297
|
+
fail ArgumentError, 'invalid value for "duration_seconds", must be greater than or equal to 60.'
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
@duration_seconds = duration_seconds
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
304
|
+
# @param [Object] relative_to Object to be assigned
|
|
305
|
+
def relative_to=(relative_to)
|
|
306
|
+
validator = EnumAttributeValidator.new('String', ["schedule_in_timezone", "last_active_time"])
|
|
307
|
+
unless validator.valid?(relative_to)
|
|
308
|
+
fail ArgumentError, "invalid value for \"relative_to\", must be one of #{validator.allowable_values}."
|
|
309
|
+
end
|
|
310
|
+
@relative_to = relative_to
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
# Custom attribute writer method with validation
|
|
314
|
+
# @param [Object] user_ttl_seconds Value to be assigned
|
|
315
|
+
def user_ttl_seconds=(user_ttl_seconds)
|
|
316
|
+
if !user_ttl_seconds.nil? && user_ttl_seconds < 1
|
|
317
|
+
fail ArgumentError, 'invalid value for "user_ttl_seconds", must be greater than or equal to 1.'
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
@user_ttl_seconds = user_ttl_seconds
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
# Checks equality by comparing each attribute.
|
|
324
|
+
# @param [Object] Object to be compared
|
|
325
|
+
def ==(o)
|
|
326
|
+
return true if self.equal?(o)
|
|
327
|
+
self.class == o.class &&
|
|
328
|
+
id == o.id &&
|
|
329
|
+
kind == o.kind &&
|
|
330
|
+
client_node_id == o.client_node_id &&
|
|
331
|
+
annotation == o.annotation &&
|
|
332
|
+
duration_seconds == o.duration_seconds &&
|
|
333
|
+
relative_to == o.relative_to &&
|
|
334
|
+
windows == o.windows &&
|
|
335
|
+
time_zone == o.time_zone &&
|
|
336
|
+
use_user_time_zone == o.use_user_time_zone &&
|
|
337
|
+
template_id == o.template_id &&
|
|
338
|
+
iam_id == o.iam_id &&
|
|
339
|
+
user_ttl_seconds == o.user_ttl_seconds &&
|
|
340
|
+
webhook_id == o.webhook_id &&
|
|
341
|
+
assignments == o.assignments &&
|
|
342
|
+
randomize_on_entry == o.randomize_on_entry &&
|
|
343
|
+
branches == o.branches &&
|
|
344
|
+
expiration == o.expiration
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
# @see the `==` method
|
|
348
|
+
# @param [Object] Object to be compared
|
|
349
|
+
def eql?(o)
|
|
350
|
+
self == o
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
# Calculates hash code according to all attributes.
|
|
354
|
+
# @return [Integer] Hash code
|
|
355
|
+
def hash
|
|
356
|
+
[id, kind, client_node_id, annotation, duration_seconds, relative_to, windows, time_zone, use_user_time_zone, template_id, iam_id, user_ttl_seconds, webhook_id, assignments, randomize_on_entry, branches, expiration].hash
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
# Builds the object from hash
|
|
360
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
361
|
+
# @return [Object] Returns the model itself
|
|
362
|
+
def self.build_from_hash(attributes)
|
|
363
|
+
new.build_from_hash(attributes)
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
# Builds the object from hash
|
|
367
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
368
|
+
# @return [Object] Returns the model itself
|
|
369
|
+
def build_from_hash(attributes)
|
|
370
|
+
return nil unless attributes.is_a?(Hash)
|
|
371
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
372
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
373
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
374
|
+
self.send("#{key}=", nil)
|
|
375
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
376
|
+
# check to ensure the input is an array given that the attribute
|
|
377
|
+
# is documented as an array but the input is not
|
|
378
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
379
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
380
|
+
end
|
|
381
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
382
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
383
|
+
end
|
|
384
|
+
end
|
|
385
|
+
|
|
386
|
+
self
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
# Deserializes the data based on type
|
|
390
|
+
# @param string type Data type
|
|
391
|
+
# @param string value Value to be deserialized
|
|
392
|
+
# @return [Object] Deserialized data
|
|
393
|
+
def _deserialize(type, value)
|
|
394
|
+
case type.to_sym
|
|
395
|
+
when :Time
|
|
396
|
+
Time.parse(value)
|
|
397
|
+
when :Date
|
|
398
|
+
Date.parse(value)
|
|
399
|
+
when :String
|
|
400
|
+
value.to_s
|
|
401
|
+
when :Integer
|
|
402
|
+
value.to_i
|
|
403
|
+
when :Float
|
|
404
|
+
value.to_f
|
|
405
|
+
when :Boolean
|
|
406
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
407
|
+
true
|
|
408
|
+
else
|
|
409
|
+
false
|
|
410
|
+
end
|
|
411
|
+
when :Object
|
|
412
|
+
# generic object (usually a Hash), return directly
|
|
413
|
+
value
|
|
414
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
415
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
416
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
417
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
418
|
+
k_type = Regexp.last_match[:k_type]
|
|
419
|
+
v_type = Regexp.last_match[:v_type]
|
|
420
|
+
{}.tap do |hash|
|
|
421
|
+
value.each do |k, v|
|
|
422
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
423
|
+
end
|
|
424
|
+
end
|
|
425
|
+
else # model
|
|
426
|
+
# models (e.g. Pet) or oneOf
|
|
427
|
+
klass = OneSignal.const_get(type)
|
|
428
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
429
|
+
end
|
|
430
|
+
end
|
|
431
|
+
|
|
432
|
+
# Returns the string representation of the object
|
|
433
|
+
# @return [String] String presentation of the object
|
|
434
|
+
def to_s
|
|
435
|
+
to_hash.to_s
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
439
|
+
# @return [Hash] Returns the object in the form of hash
|
|
440
|
+
def to_body
|
|
441
|
+
to_hash
|
|
442
|
+
end
|
|
443
|
+
|
|
444
|
+
# Returns the object in the form of hash
|
|
445
|
+
# @return [Hash] Returns the object in the form of hash
|
|
446
|
+
def to_hash
|
|
447
|
+
hash = {}
|
|
448
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
449
|
+
value = self.send(attr)
|
|
450
|
+
if value.nil?
|
|
451
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
452
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
453
|
+
end
|
|
454
|
+
|
|
455
|
+
hash[param] = _to_hash(value)
|
|
456
|
+
end
|
|
457
|
+
hash
|
|
458
|
+
end
|
|
459
|
+
|
|
460
|
+
# Outputs non-array value in the form of hash
|
|
461
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
462
|
+
# @param [Object] value Any valid value
|
|
463
|
+
# @return [Hash] Returns the value in the form of hash
|
|
464
|
+
def _to_hash(value)
|
|
465
|
+
if value.is_a?(Array)
|
|
466
|
+
value.compact.map { |v| _to_hash(v) }
|
|
467
|
+
elsif value.is_a?(Hash)
|
|
468
|
+
{}.tap do |hash|
|
|
469
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
470
|
+
end
|
|
471
|
+
elsif value.respond_to? :to_hash
|
|
472
|
+
value.to_hash
|
|
473
|
+
else
|
|
474
|
+
value
|
|
475
|
+
end
|
|
476
|
+
end
|
|
477
|
+
|
|
478
|
+
end
|
|
479
|
+
|
|
480
|
+
end
|