zyphr 0.1.4 → 0.1.8
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/README.md +2 -1
- data/docs/Device.md +10 -12
- data/docs/DeviceStats.md +3 -1
- data/docs/DevicesApi.md +1 -1
- data/docs/PushApi.md +1 -1
- data/docs/PushMessage.md +13 -7
- data/docs/PushMessageDetail.md +17 -15
- data/docs/PushMessageDetailAllOfActionButtons.md +24 -0
- data/docs/RegisterDeviceRequest.md +4 -14
- data/docs/SendPushRequest.md +35 -15
- data/docs/SendPushRequestActionButtonsInner.md +24 -0
- data/lib/zyphr/models/device.rb +34 -57
- data/lib/zyphr/models/device_stats.rb +13 -4
- data/lib/zyphr/models/push_message.rb +67 -36
- data/lib/zyphr/models/push_message_detail.rb +88 -75
- data/lib/zyphr/models/push_message_detail_all_of_action_buttons.rb +247 -0
- data/lib/zyphr/models/register_device_request.rb +43 -59
- data/lib/zyphr/models/send_push_request.rb +278 -91
- data/lib/zyphr/models/{push_payload.rb → send_push_request_action_buttons_inner.rb} +72 -73
- data/lib/zyphr.rb +2 -1
- data/spec/models/device_spec.rb +5 -15
- data/spec/models/device_stats_spec.rb +6 -0
- data/spec/models/{push_payload_spec.rb → push_message_detail_all_of_action_buttons_spec.rb} +10 -34
- data/spec/models/push_message_detail_spec.rb +26 -20
- data/spec/models/push_message_spec.rb +26 -8
- data/spec/models/register_device_request_spec.rb +2 -32
- data/spec/models/send_push_request_action_buttons_inner_spec.rb +54 -0
- data/spec/models/send_push_request_spec.rb +67 -11
- data/zyphr.gemspec +1 -1
- metadata +325 -321
- data/docs/PushPayload.md +0 -32
|
@@ -15,64 +15,83 @@ require 'time'
|
|
|
15
15
|
|
|
16
16
|
module Zyphr
|
|
17
17
|
class SendPushRequest
|
|
18
|
-
# Send to
|
|
18
|
+
# Send to all devices for a user
|
|
19
|
+
attr_accessor :user_id
|
|
20
|
+
|
|
21
|
+
# Send to a specific device
|
|
19
22
|
attr_accessor :device_id
|
|
20
23
|
|
|
21
|
-
#
|
|
22
|
-
attr_accessor :
|
|
24
|
+
# Push notification title
|
|
25
|
+
attr_accessor :title
|
|
23
26
|
|
|
24
|
-
#
|
|
25
|
-
attr_accessor :
|
|
27
|
+
# Push notification body text
|
|
28
|
+
attr_accessor :body
|
|
29
|
+
|
|
30
|
+
# Custom data payload
|
|
31
|
+
attr_accessor :data
|
|
32
|
+
|
|
33
|
+
# Badge count (iOS)
|
|
34
|
+
attr_accessor :badge
|
|
26
35
|
|
|
27
|
-
#
|
|
28
|
-
attr_accessor :
|
|
36
|
+
# Notification sound
|
|
37
|
+
attr_accessor :sound
|
|
29
38
|
|
|
30
|
-
|
|
39
|
+
# Image URL for rich notifications
|
|
40
|
+
attr_accessor :image_url
|
|
31
41
|
|
|
32
|
-
|
|
42
|
+
# Silent/background push notification
|
|
43
|
+
attr_accessor :content_available
|
|
33
44
|
|
|
34
|
-
#
|
|
35
|
-
attr_accessor :
|
|
45
|
+
# Interactive notification buttons (max 3)
|
|
46
|
+
attr_accessor :action_buttons
|
|
47
|
+
|
|
48
|
+
attr_accessor :tags
|
|
49
|
+
|
|
50
|
+
attr_accessor :metadata
|
|
36
51
|
|
|
37
52
|
# Replace previous notification with same key
|
|
38
53
|
attr_accessor :collapse_key
|
|
39
54
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
class EnumAttributeValidator
|
|
43
|
-
attr_reader :datatype
|
|
44
|
-
attr_reader :allowable_values
|
|
45
|
-
|
|
46
|
-
def initialize(datatype, allowable_values)
|
|
47
|
-
@allowable_values = allowable_values.map do |value|
|
|
48
|
-
case datatype.to_s
|
|
49
|
-
when /Integer/i
|
|
50
|
-
value.to_i
|
|
51
|
-
when /Float/i
|
|
52
|
-
value.to_f
|
|
53
|
-
else
|
|
54
|
-
value
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
55
|
+
# Subscriber ID for preference checking
|
|
56
|
+
attr_accessor :subscriber_id
|
|
58
57
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
# Subscriber external ID for preference checking
|
|
59
|
+
attr_accessor :subscriber_external_id
|
|
60
|
+
|
|
61
|
+
# Notification category for preference checking
|
|
62
|
+
attr_accessor :category
|
|
63
|
+
|
|
64
|
+
# Skip subscriber preference checks
|
|
65
|
+
attr_accessor :force
|
|
66
|
+
|
|
67
|
+
# Schedule for future delivery (ISO 8601)
|
|
68
|
+
attr_accessor :send_at
|
|
69
|
+
|
|
70
|
+
# Delay in seconds before sending
|
|
71
|
+
attr_accessor :delay
|
|
63
72
|
|
|
64
73
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
65
74
|
def self.attribute_map
|
|
66
75
|
{
|
|
76
|
+
:'user_id' => :'user_id',
|
|
67
77
|
:'device_id' => :'device_id',
|
|
68
|
-
:'
|
|
69
|
-
:'
|
|
70
|
-
:'
|
|
71
|
-
:'
|
|
72
|
-
:'
|
|
73
|
-
:'
|
|
78
|
+
:'title' => :'title',
|
|
79
|
+
:'body' => :'body',
|
|
80
|
+
:'data' => :'data',
|
|
81
|
+
:'badge' => :'badge',
|
|
82
|
+
:'sound' => :'sound',
|
|
83
|
+
:'image_url' => :'image_url',
|
|
84
|
+
:'content_available' => :'content_available',
|
|
85
|
+
:'action_buttons' => :'action_buttons',
|
|
86
|
+
:'tags' => :'tags',
|
|
87
|
+
:'metadata' => :'metadata',
|
|
74
88
|
:'collapse_key' => :'collapse_key',
|
|
75
|
-
:'
|
|
89
|
+
:'subscriber_id' => :'subscriber_id',
|
|
90
|
+
:'subscriber_external_id' => :'subscriber_external_id',
|
|
91
|
+
:'category' => :'category',
|
|
92
|
+
:'force' => :'force',
|
|
93
|
+
:'send_at' => :'send_at',
|
|
94
|
+
:'delay' => :'delay'
|
|
76
95
|
}
|
|
77
96
|
end
|
|
78
97
|
|
|
@@ -89,15 +108,25 @@ module Zyphr
|
|
|
89
108
|
# Attribute type mapping.
|
|
90
109
|
def self.openapi_types
|
|
91
110
|
{
|
|
111
|
+
:'user_id' => :'String',
|
|
92
112
|
:'device_id' => :'String',
|
|
93
|
-
:'
|
|
94
|
-
:'
|
|
95
|
-
:'
|
|
96
|
-
:'
|
|
97
|
-
:'
|
|
98
|
-
:'
|
|
113
|
+
:'title' => :'String',
|
|
114
|
+
:'body' => :'String',
|
|
115
|
+
:'data' => :'Hash<String, Object>',
|
|
116
|
+
:'badge' => :'Integer',
|
|
117
|
+
:'sound' => :'String',
|
|
118
|
+
:'image_url' => :'String',
|
|
119
|
+
:'content_available' => :'Boolean',
|
|
120
|
+
:'action_buttons' => :'Array<SendPushRequestActionButtonsInner>',
|
|
121
|
+
:'tags' => :'Array<String>',
|
|
122
|
+
:'metadata' => :'Hash<String, Object>',
|
|
99
123
|
:'collapse_key' => :'String',
|
|
100
|
-
:'
|
|
124
|
+
:'subscriber_id' => :'String',
|
|
125
|
+
:'subscriber_external_id' => :'String',
|
|
126
|
+
:'category' => :'String',
|
|
127
|
+
:'force' => :'Boolean',
|
|
128
|
+
:'send_at' => :'Time',
|
|
129
|
+
:'delay' => :'Integer'
|
|
101
130
|
}
|
|
102
131
|
end
|
|
103
132
|
|
|
@@ -123,46 +152,88 @@ module Zyphr
|
|
|
123
152
|
h[k.to_sym] = v
|
|
124
153
|
}
|
|
125
154
|
|
|
155
|
+
if attributes.key?(:'user_id')
|
|
156
|
+
self.user_id = attributes[:'user_id']
|
|
157
|
+
end
|
|
158
|
+
|
|
126
159
|
if attributes.key?(:'device_id')
|
|
127
160
|
self.device_id = attributes[:'device_id']
|
|
128
161
|
end
|
|
129
162
|
|
|
130
|
-
if attributes.key?(:'
|
|
131
|
-
|
|
132
|
-
|
|
163
|
+
if attributes.key?(:'title')
|
|
164
|
+
self.title = attributes[:'title']
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
if attributes.key?(:'body')
|
|
168
|
+
self.body = attributes[:'body']
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
if attributes.key?(:'data')
|
|
172
|
+
if (value = attributes[:'data']).is_a?(Hash)
|
|
173
|
+
self.data = value
|
|
133
174
|
end
|
|
134
175
|
end
|
|
135
176
|
|
|
136
|
-
if attributes.key?(:'
|
|
137
|
-
self.
|
|
177
|
+
if attributes.key?(:'badge')
|
|
178
|
+
self.badge = attributes[:'badge']
|
|
138
179
|
end
|
|
139
180
|
|
|
140
|
-
if attributes.key?(:'
|
|
141
|
-
self.
|
|
181
|
+
if attributes.key?(:'sound')
|
|
182
|
+
self.sound = attributes[:'sound']
|
|
142
183
|
end
|
|
143
184
|
|
|
144
|
-
if attributes.key?(:'
|
|
145
|
-
self.
|
|
146
|
-
else
|
|
147
|
-
self.payload = nil
|
|
185
|
+
if attributes.key?(:'image_url')
|
|
186
|
+
self.image_url = attributes[:'image_url']
|
|
148
187
|
end
|
|
149
188
|
|
|
150
|
-
if attributes.key?(:'
|
|
151
|
-
self.
|
|
152
|
-
else
|
|
153
|
-
self.priority = 'normal'
|
|
189
|
+
if attributes.key?(:'content_available')
|
|
190
|
+
self.content_available = attributes[:'content_available']
|
|
154
191
|
end
|
|
155
192
|
|
|
156
|
-
if attributes.key?(:'
|
|
157
|
-
|
|
193
|
+
if attributes.key?(:'action_buttons')
|
|
194
|
+
if (value = attributes[:'action_buttons']).is_a?(Array)
|
|
195
|
+
self.action_buttons = value
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
if attributes.key?(:'tags')
|
|
200
|
+
if (value = attributes[:'tags']).is_a?(Array)
|
|
201
|
+
self.tags = value
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
if attributes.key?(:'metadata')
|
|
206
|
+
if (value = attributes[:'metadata']).is_a?(Hash)
|
|
207
|
+
self.metadata = value
|
|
208
|
+
end
|
|
158
209
|
end
|
|
159
210
|
|
|
160
211
|
if attributes.key?(:'collapse_key')
|
|
161
212
|
self.collapse_key = attributes[:'collapse_key']
|
|
162
213
|
end
|
|
163
214
|
|
|
164
|
-
if attributes.key?(:'
|
|
165
|
-
self.
|
|
215
|
+
if attributes.key?(:'subscriber_id')
|
|
216
|
+
self.subscriber_id = attributes[:'subscriber_id']
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
if attributes.key?(:'subscriber_external_id')
|
|
220
|
+
self.subscriber_external_id = attributes[:'subscriber_external_id']
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
if attributes.key?(:'category')
|
|
224
|
+
self.category = attributes[:'category']
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
if attributes.key?(:'force')
|
|
228
|
+
self.force = attributes[:'force']
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
if attributes.key?(:'send_at')
|
|
232
|
+
self.send_at = attributes[:'send_at']
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
if attributes.key?(:'delay')
|
|
236
|
+
self.delay = attributes[:'delay']
|
|
166
237
|
end
|
|
167
238
|
end
|
|
168
239
|
|
|
@@ -171,8 +242,32 @@ module Zyphr
|
|
|
171
242
|
def list_invalid_properties
|
|
172
243
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
173
244
|
invalid_properties = Array.new
|
|
174
|
-
if
|
|
175
|
-
invalid_properties.push('invalid value for "
|
|
245
|
+
if !@title.nil? && @title.to_s.length > 255
|
|
246
|
+
invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 255.')
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
if !@body.nil? && @body.to_s.length > 4096
|
|
250
|
+
invalid_properties.push('invalid value for "body", the character length must be smaller than or equal to 4096.')
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
if !@badge.nil? && @badge < 0
|
|
254
|
+
invalid_properties.push('invalid value for "badge", must be greater than or equal to 0.')
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
if !@sound.nil? && @sound.to_s.length > 255
|
|
258
|
+
invalid_properties.push('invalid value for "sound", the character length must be smaller than or equal to 255.')
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
if !@action_buttons.nil? && @action_buttons.length > 3
|
|
262
|
+
invalid_properties.push('invalid value for "action_buttons", number of items must be less than or equal to 3.')
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
if !@tags.nil? && @tags.length > 10
|
|
266
|
+
invalid_properties.push('invalid value for "tags", number of items must be less than or equal to 10.')
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
if !@delay.nil? && @delay < 0
|
|
270
|
+
invalid_properties.push('invalid value for "delay", must be greater than or equal to 0.')
|
|
176
271
|
end
|
|
177
272
|
|
|
178
273
|
invalid_properties
|
|
@@ -182,30 +277,112 @@ module Zyphr
|
|
|
182
277
|
# @return true if the model is valid
|
|
183
278
|
def valid?
|
|
184
279
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
185
|
-
return false if
|
|
186
|
-
|
|
187
|
-
return false
|
|
280
|
+
return false if !@title.nil? && @title.to_s.length > 255
|
|
281
|
+
return false if !@body.nil? && @body.to_s.length > 4096
|
|
282
|
+
return false if !@badge.nil? && @badge < 0
|
|
283
|
+
return false if !@sound.nil? && @sound.to_s.length > 255
|
|
284
|
+
return false if !@action_buttons.nil? && @action_buttons.length > 3
|
|
285
|
+
return false if !@tags.nil? && @tags.length > 10
|
|
286
|
+
return false if !@delay.nil? && @delay < 0
|
|
188
287
|
true
|
|
189
288
|
end
|
|
190
289
|
|
|
191
290
|
# Custom attribute writer method with validation
|
|
192
|
-
# @param [Object]
|
|
193
|
-
def
|
|
194
|
-
if
|
|
195
|
-
fail ArgumentError, '
|
|
291
|
+
# @param [Object] title Value to be assigned
|
|
292
|
+
def title=(title)
|
|
293
|
+
if title.nil?
|
|
294
|
+
fail ArgumentError, 'title cannot be nil'
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
if title.to_s.length > 255
|
|
298
|
+
fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 255.'
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
@title = title
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
# Custom attribute writer method with validation
|
|
305
|
+
# @param [Object] body Value to be assigned
|
|
306
|
+
def body=(body)
|
|
307
|
+
if body.nil?
|
|
308
|
+
fail ArgumentError, 'body cannot be nil'
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
if body.to_s.length > 4096
|
|
312
|
+
fail ArgumentError, 'invalid value for "body", the character length must be smaller than or equal to 4096.'
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
@body = body
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
# Custom attribute writer method with validation
|
|
319
|
+
# @param [Object] badge Value to be assigned
|
|
320
|
+
def badge=(badge)
|
|
321
|
+
if badge.nil?
|
|
322
|
+
fail ArgumentError, 'badge cannot be nil'
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
if badge < 0
|
|
326
|
+
fail ArgumentError, 'invalid value for "badge", must be greater than or equal to 0.'
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
@badge = badge
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
# Custom attribute writer method with validation
|
|
333
|
+
# @param [Object] sound Value to be assigned
|
|
334
|
+
def sound=(sound)
|
|
335
|
+
if sound.nil?
|
|
336
|
+
fail ArgumentError, 'sound cannot be nil'
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
if sound.to_s.length > 255
|
|
340
|
+
fail ArgumentError, 'invalid value for "sound", the character length must be smaller than or equal to 255.'
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
@sound = sound
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
# Custom attribute writer method with validation
|
|
347
|
+
# @param [Object] action_buttons Value to be assigned
|
|
348
|
+
def action_buttons=(action_buttons)
|
|
349
|
+
if action_buttons.nil?
|
|
350
|
+
fail ArgumentError, 'action_buttons cannot be nil'
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
if action_buttons.length > 3
|
|
354
|
+
fail ArgumentError, 'invalid value for "action_buttons", number of items must be less than or equal to 3.'
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
@action_buttons = action_buttons
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
# Custom attribute writer method with validation
|
|
361
|
+
# @param [Object] tags Value to be assigned
|
|
362
|
+
def tags=(tags)
|
|
363
|
+
if tags.nil?
|
|
364
|
+
fail ArgumentError, 'tags cannot be nil'
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
if tags.length > 10
|
|
368
|
+
fail ArgumentError, 'invalid value for "tags", number of items must be less than or equal to 10.'
|
|
196
369
|
end
|
|
197
370
|
|
|
198
|
-
@
|
|
371
|
+
@tags = tags
|
|
199
372
|
end
|
|
200
373
|
|
|
201
|
-
# Custom attribute writer method
|
|
202
|
-
# @param [Object]
|
|
203
|
-
def
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
374
|
+
# Custom attribute writer method with validation
|
|
375
|
+
# @param [Object] delay Value to be assigned
|
|
376
|
+
def delay=(delay)
|
|
377
|
+
if delay.nil?
|
|
378
|
+
fail ArgumentError, 'delay cannot be nil'
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
if delay < 0
|
|
382
|
+
fail ArgumentError, 'invalid value for "delay", must be greater than or equal to 0.'
|
|
207
383
|
end
|
|
208
|
-
|
|
384
|
+
|
|
385
|
+
@delay = delay
|
|
209
386
|
end
|
|
210
387
|
|
|
211
388
|
# Checks equality by comparing each attribute.
|
|
@@ -213,15 +390,25 @@ module Zyphr
|
|
|
213
390
|
def ==(o)
|
|
214
391
|
return true if self.equal?(o)
|
|
215
392
|
self.class == o.class &&
|
|
393
|
+
user_id == o.user_id &&
|
|
216
394
|
device_id == o.device_id &&
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
395
|
+
title == o.title &&
|
|
396
|
+
body == o.body &&
|
|
397
|
+
data == o.data &&
|
|
398
|
+
badge == o.badge &&
|
|
399
|
+
sound == o.sound &&
|
|
400
|
+
image_url == o.image_url &&
|
|
401
|
+
content_available == o.content_available &&
|
|
402
|
+
action_buttons == o.action_buttons &&
|
|
403
|
+
tags == o.tags &&
|
|
404
|
+
metadata == o.metadata &&
|
|
223
405
|
collapse_key == o.collapse_key &&
|
|
224
|
-
|
|
406
|
+
subscriber_id == o.subscriber_id &&
|
|
407
|
+
subscriber_external_id == o.subscriber_external_id &&
|
|
408
|
+
category == o.category &&
|
|
409
|
+
force == o.force &&
|
|
410
|
+
send_at == o.send_at &&
|
|
411
|
+
delay == o.delay
|
|
225
412
|
end
|
|
226
413
|
|
|
227
414
|
# @see the `==` method
|
|
@@ -233,7 +420,7 @@ module Zyphr
|
|
|
233
420
|
# Calculates hash code according to all attributes.
|
|
234
421
|
# @return [Integer] Hash code
|
|
235
422
|
def hash
|
|
236
|
-
[device_id,
|
|
423
|
+
[user_id, device_id, title, body, data, badge, sound, image_url, content_available, action_buttons, tags, metadata, collapse_key, subscriber_id, subscriber_external_id, category, force, send_at, delay].hash
|
|
237
424
|
end
|
|
238
425
|
|
|
239
426
|
# Builds the object from hash
|