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
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Zyphr API
|
|
3
|
+
|
|
4
|
+
#Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: support@zyphr.dev
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.12.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Zyphr
|
|
17
|
+
class PushMessageDetailAllOfActionButtons
|
|
18
|
+
attr_accessor :id
|
|
19
|
+
|
|
20
|
+
attr_accessor :title
|
|
21
|
+
|
|
22
|
+
attr_accessor :action
|
|
23
|
+
|
|
24
|
+
attr_accessor :deep_link
|
|
25
|
+
|
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
27
|
+
def self.attribute_map
|
|
28
|
+
{
|
|
29
|
+
:'id' => :'id',
|
|
30
|
+
:'title' => :'title',
|
|
31
|
+
:'action' => :'action',
|
|
32
|
+
:'deep_link' => :'deep_link'
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Returns attribute mapping this model knows about
|
|
37
|
+
def self.acceptable_attribute_map
|
|
38
|
+
attribute_map
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Returns all the JSON keys this model knows about
|
|
42
|
+
def self.acceptable_attributes
|
|
43
|
+
acceptable_attribute_map.values
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Attribute type mapping.
|
|
47
|
+
def self.openapi_types
|
|
48
|
+
{
|
|
49
|
+
:'id' => :'String',
|
|
50
|
+
:'title' => :'String',
|
|
51
|
+
:'action' => :'String',
|
|
52
|
+
:'deep_link' => :'String'
|
|
53
|
+
}
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# List of attributes with nullable: true
|
|
57
|
+
def self.openapi_nullable
|
|
58
|
+
Set.new([
|
|
59
|
+
])
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Initializes the object
|
|
63
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
64
|
+
def initialize(attributes = {})
|
|
65
|
+
if (!attributes.is_a?(Hash))
|
|
66
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::PushMessageDetailAllOfActionButtons` initialize method"
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
70
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
71
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
72
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
73
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::PushMessageDetailAllOfActionButtons`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
74
|
+
end
|
|
75
|
+
h[k.to_sym] = v
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if attributes.key?(:'id')
|
|
79
|
+
self.id = attributes[:'id']
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
if attributes.key?(:'title')
|
|
83
|
+
self.title = attributes[:'title']
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
if attributes.key?(:'action')
|
|
87
|
+
self.action = attributes[:'action']
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
if attributes.key?(:'deep_link')
|
|
91
|
+
self.deep_link = attributes[:'deep_link']
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
96
|
+
# @return Array for valid properties with the reasons
|
|
97
|
+
def list_invalid_properties
|
|
98
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
99
|
+
invalid_properties = Array.new
|
|
100
|
+
invalid_properties
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Check to see if the all the properties in the model are valid
|
|
104
|
+
# @return true if the model is valid
|
|
105
|
+
def valid?
|
|
106
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
107
|
+
true
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Checks equality by comparing each attribute.
|
|
111
|
+
# @param [Object] Object to be compared
|
|
112
|
+
def ==(o)
|
|
113
|
+
return true if self.equal?(o)
|
|
114
|
+
self.class == o.class &&
|
|
115
|
+
id == o.id &&
|
|
116
|
+
title == o.title &&
|
|
117
|
+
action == o.action &&
|
|
118
|
+
deep_link == o.deep_link
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# @see the `==` method
|
|
122
|
+
# @param [Object] Object to be compared
|
|
123
|
+
def eql?(o)
|
|
124
|
+
self == o
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Calculates hash code according to all attributes.
|
|
128
|
+
# @return [Integer] Hash code
|
|
129
|
+
def hash
|
|
130
|
+
[id, title, action, deep_link].hash
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Builds the object from hash
|
|
134
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
135
|
+
# @return [Object] Returns the model itself
|
|
136
|
+
def self.build_from_hash(attributes)
|
|
137
|
+
return nil unless attributes.is_a?(Hash)
|
|
138
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
139
|
+
transformed_hash = {}
|
|
140
|
+
openapi_types.each_pair do |key, type|
|
|
141
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
142
|
+
transformed_hash["#{key}"] = nil
|
|
143
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
144
|
+
# check to ensure the input is an array given that the attribute
|
|
145
|
+
# is documented as an array but the input is not
|
|
146
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
147
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
148
|
+
end
|
|
149
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
150
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
new(transformed_hash)
|
|
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 self._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 = Zyphr.const_get(type)
|
|
195
|
+
klass.respond_to?(:openapi_any_of) || 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
|
|
@@ -15,25 +15,16 @@ require 'time'
|
|
|
15
15
|
|
|
16
16
|
module Zyphr
|
|
17
17
|
class RegisterDeviceRequest
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
# External ID to look up subscriber
|
|
21
|
-
attr_accessor :external_user_id
|
|
18
|
+
# User or subscriber ID to associate with the device
|
|
19
|
+
attr_accessor :user_id
|
|
22
20
|
|
|
23
21
|
attr_accessor :platform
|
|
24
22
|
|
|
25
23
|
# Push notification token from the device
|
|
26
24
|
attr_accessor :token
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
attr_accessor :device_model
|
|
31
|
-
|
|
32
|
-
attr_accessor :os_version
|
|
33
|
-
|
|
34
|
-
attr_accessor :timezone
|
|
35
|
-
|
|
36
|
-
attr_accessor :locale
|
|
26
|
+
# Additional device metadata
|
|
27
|
+
attr_accessor :metadata
|
|
37
28
|
|
|
38
29
|
class EnumAttributeValidator
|
|
39
30
|
attr_reader :datatype
|
|
@@ -60,15 +51,10 @@ module Zyphr
|
|
|
60
51
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
61
52
|
def self.attribute_map
|
|
62
53
|
{
|
|
63
|
-
:'
|
|
64
|
-
:'external_user_id' => :'external_user_id',
|
|
54
|
+
:'user_id' => :'user_id',
|
|
65
55
|
:'platform' => :'platform',
|
|
66
56
|
:'token' => :'token',
|
|
67
|
-
:'
|
|
68
|
-
:'device_model' => :'device_model',
|
|
69
|
-
:'os_version' => :'os_version',
|
|
70
|
-
:'timezone' => :'timezone',
|
|
71
|
-
:'locale' => :'locale'
|
|
57
|
+
:'metadata' => :'metadata'
|
|
72
58
|
}
|
|
73
59
|
end
|
|
74
60
|
|
|
@@ -85,15 +71,10 @@ module Zyphr
|
|
|
85
71
|
# Attribute type mapping.
|
|
86
72
|
def self.openapi_types
|
|
87
73
|
{
|
|
88
|
-
:'
|
|
89
|
-
:'external_user_id' => :'String',
|
|
74
|
+
:'user_id' => :'String',
|
|
90
75
|
:'platform' => :'String',
|
|
91
76
|
:'token' => :'String',
|
|
92
|
-
:'
|
|
93
|
-
:'device_model' => :'String',
|
|
94
|
-
:'os_version' => :'String',
|
|
95
|
-
:'timezone' => :'String',
|
|
96
|
-
:'locale' => :'String'
|
|
77
|
+
:'metadata' => :'Hash<String, Object>'
|
|
97
78
|
}
|
|
98
79
|
end
|
|
99
80
|
|
|
@@ -119,12 +100,10 @@ module Zyphr
|
|
|
119
100
|
h[k.to_sym] = v
|
|
120
101
|
}
|
|
121
102
|
|
|
122
|
-
if attributes.key?(:'
|
|
123
|
-
self.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if attributes.key?(:'external_user_id')
|
|
127
|
-
self.external_user_id = attributes[:'external_user_id']
|
|
103
|
+
if attributes.key?(:'user_id')
|
|
104
|
+
self.user_id = attributes[:'user_id']
|
|
105
|
+
else
|
|
106
|
+
self.user_id = nil
|
|
128
107
|
end
|
|
129
108
|
|
|
130
109
|
if attributes.key?(:'platform')
|
|
@@ -139,24 +118,10 @@ module Zyphr
|
|
|
139
118
|
self.token = nil
|
|
140
119
|
end
|
|
141
120
|
|
|
142
|
-
if attributes.key?(:'
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if attributes.key?(:'device_model')
|
|
147
|
-
self.device_model = attributes[:'device_model']
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
if attributes.key?(:'os_version')
|
|
151
|
-
self.os_version = attributes[:'os_version']
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
if attributes.key?(:'timezone')
|
|
155
|
-
self.timezone = attributes[:'timezone']
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
if attributes.key?(:'locale')
|
|
159
|
-
self.locale = attributes[:'locale']
|
|
121
|
+
if attributes.key?(:'metadata')
|
|
122
|
+
if (value = attributes[:'metadata']).is_a?(Hash)
|
|
123
|
+
self.metadata = value
|
|
124
|
+
end
|
|
160
125
|
end
|
|
161
126
|
end
|
|
162
127
|
|
|
@@ -165,6 +130,10 @@ module Zyphr
|
|
|
165
130
|
def list_invalid_properties
|
|
166
131
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
167
132
|
invalid_properties = Array.new
|
|
133
|
+
if @user_id.nil?
|
|
134
|
+
invalid_properties.push('invalid value for "user_id", user_id cannot be nil.')
|
|
135
|
+
end
|
|
136
|
+
|
|
168
137
|
if @platform.nil?
|
|
169
138
|
invalid_properties.push('invalid value for "platform", platform cannot be nil.')
|
|
170
139
|
end
|
|
@@ -173,6 +142,10 @@ module Zyphr
|
|
|
173
142
|
invalid_properties.push('invalid value for "token", token cannot be nil.')
|
|
174
143
|
end
|
|
175
144
|
|
|
145
|
+
if @token.to_s.length > 4096
|
|
146
|
+
invalid_properties.push('invalid value for "token", the character length must be smaller than or equal to 4096.')
|
|
147
|
+
end
|
|
148
|
+
|
|
176
149
|
invalid_properties
|
|
177
150
|
end
|
|
178
151
|
|
|
@@ -180,13 +153,25 @@ module Zyphr
|
|
|
180
153
|
# @return true if the model is valid
|
|
181
154
|
def valid?
|
|
182
155
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
156
|
+
return false if @user_id.nil?
|
|
183
157
|
return false if @platform.nil?
|
|
184
158
|
platform_validator = EnumAttributeValidator.new('String', ["ios", "android", "web"])
|
|
185
159
|
return false unless platform_validator.valid?(@platform)
|
|
186
160
|
return false if @token.nil?
|
|
161
|
+
return false if @token.to_s.length > 4096
|
|
187
162
|
true
|
|
188
163
|
end
|
|
189
164
|
|
|
165
|
+
# Custom attribute writer method with validation
|
|
166
|
+
# @param [Object] user_id Value to be assigned
|
|
167
|
+
def user_id=(user_id)
|
|
168
|
+
if user_id.nil?
|
|
169
|
+
fail ArgumentError, 'user_id cannot be nil'
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
@user_id = user_id
|
|
173
|
+
end
|
|
174
|
+
|
|
190
175
|
# Custom attribute writer method checking allowed values (enum).
|
|
191
176
|
# @param [Object] platform Object to be assigned
|
|
192
177
|
def platform=(platform)
|
|
@@ -204,6 +189,10 @@ module Zyphr
|
|
|
204
189
|
fail ArgumentError, 'token cannot be nil'
|
|
205
190
|
end
|
|
206
191
|
|
|
192
|
+
if token.to_s.length > 4096
|
|
193
|
+
fail ArgumentError, 'invalid value for "token", the character length must be smaller than or equal to 4096.'
|
|
194
|
+
end
|
|
195
|
+
|
|
207
196
|
@token = token
|
|
208
197
|
end
|
|
209
198
|
|
|
@@ -212,15 +201,10 @@ module Zyphr
|
|
|
212
201
|
def ==(o)
|
|
213
202
|
return true if self.equal?(o)
|
|
214
203
|
self.class == o.class &&
|
|
215
|
-
|
|
216
|
-
external_user_id == o.external_user_id &&
|
|
204
|
+
user_id == o.user_id &&
|
|
217
205
|
platform == o.platform &&
|
|
218
206
|
token == o.token &&
|
|
219
|
-
|
|
220
|
-
device_model == o.device_model &&
|
|
221
|
-
os_version == o.os_version &&
|
|
222
|
-
timezone == o.timezone &&
|
|
223
|
-
locale == o.locale
|
|
207
|
+
metadata == o.metadata
|
|
224
208
|
end
|
|
225
209
|
|
|
226
210
|
# @see the `==` method
|
|
@@ -232,7 +216,7 @@ module Zyphr
|
|
|
232
216
|
# Calculates hash code according to all attributes.
|
|
233
217
|
# @return [Integer] Hash code
|
|
234
218
|
def hash
|
|
235
|
-
[
|
|
219
|
+
[user_id, platform, token, metadata].hash
|
|
236
220
|
end
|
|
237
221
|
|
|
238
222
|
# Builds the object from hash
|