zyphr 0.1.44 → 0.1.45
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 +5 -0
- data/docs/ApplicationSelf.md +3 -1
- data/docs/AuthApplicationApi.md +77 -0
- data/docs/AuthUserProfileApi.md +75 -0
- data/docs/ChangePasswordRequest.md +20 -0
- data/docs/SetSelfApplicationTestRecipientsRequest.md +18 -0
- data/docs/WebhookDelivery.md +1 -1
- data/docs/WebhookDeliveryDetail.md +1 -1
- data/docs/WebhookEventType.md +15 -0
- data/docs/WebhookEventTypesResponseData.md +1 -1
- data/docs/WebhookTestEventResponseData.md +1 -1
- data/lib/zyphr/api/auth_application_api.rb +68 -0
- data/lib/zyphr/api/auth_user_profile_api.rb +68 -0
- data/lib/zyphr/models/application_self.rb +33 -4
- data/lib/zyphr/models/change_password_request.rb +265 -0
- data/lib/zyphr/models/set_self_application_test_recipients_request.rb +240 -0
- data/lib/zyphr/models/webhook_delivery.rb +1 -1
- data/lib/zyphr/models/webhook_delivery_detail.rb +1 -1
- data/lib/zyphr/models/webhook_event_type.rb +66 -0
- data/lib/zyphr/models/webhook_event_types_response_data.rb +1 -1
- data/lib/zyphr/models/webhook_test_event_response_data.rb +23 -1
- data/lib/zyphr.rb +3 -0
- data/spec/api/auth_application_api_spec.rb +12 -0
- data/spec/api/auth_user_profile_api_spec.rb +12 -0
- data/spec/models/application_self_spec.rb +6 -0
- data/spec/models/change_password_request_spec.rb +42 -0
- data/spec/models/set_self_application_test_recipients_request_spec.rb +36 -0
- data/spec/models/webhook_event_type_spec.rb +30 -0
- data/zyphr.gemspec +1 -1
- metadata +13 -1
|
@@ -0,0 +1,265 @@
|
|
|
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 ## Account Sending Status Every authenticated response carries the account's current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## 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 ChangePasswordRequest
|
|
18
|
+
# The user's current password, for verification.
|
|
19
|
+
attr_accessor :current_password
|
|
20
|
+
|
|
21
|
+
# The new password. Must satisfy the application's password policy.
|
|
22
|
+
attr_accessor :new_password
|
|
23
|
+
|
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
|
+
def self.attribute_map
|
|
26
|
+
{
|
|
27
|
+
:'current_password' => :'current_password',
|
|
28
|
+
:'new_password' => :'new_password'
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Returns attribute mapping this model knows about
|
|
33
|
+
def self.acceptable_attribute_map
|
|
34
|
+
attribute_map
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Returns all the JSON keys this model knows about
|
|
38
|
+
def self.acceptable_attributes
|
|
39
|
+
acceptable_attribute_map.values
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Attribute type mapping.
|
|
43
|
+
def self.openapi_types
|
|
44
|
+
{
|
|
45
|
+
:'current_password' => :'String',
|
|
46
|
+
:'new_password' => :'String'
|
|
47
|
+
}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# List of attributes with nullable: true
|
|
51
|
+
def self.openapi_nullable
|
|
52
|
+
Set.new([
|
|
53
|
+
])
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Initializes the object
|
|
57
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
58
|
+
def initialize(attributes = {})
|
|
59
|
+
if (!attributes.is_a?(Hash))
|
|
60
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::ChangePasswordRequest` initialize method"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
64
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
65
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
66
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
67
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::ChangePasswordRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
68
|
+
end
|
|
69
|
+
h[k.to_sym] = v
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if attributes.key?(:'current_password')
|
|
73
|
+
self.current_password = attributes[:'current_password']
|
|
74
|
+
else
|
|
75
|
+
self.current_password = nil
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
if attributes.key?(:'new_password')
|
|
79
|
+
self.new_password = attributes[:'new_password']
|
|
80
|
+
else
|
|
81
|
+
self.new_password = nil
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
86
|
+
# @return Array for valid properties with the reasons
|
|
87
|
+
def list_invalid_properties
|
|
88
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
89
|
+
invalid_properties = Array.new
|
|
90
|
+
if @current_password.nil?
|
|
91
|
+
invalid_properties.push('invalid value for "current_password", current_password cannot be nil.')
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if @new_password.nil?
|
|
95
|
+
invalid_properties.push('invalid value for "new_password", new_password cannot be nil.')
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
invalid_properties
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Check to see if the all the properties in the model are valid
|
|
102
|
+
# @return true if the model is valid
|
|
103
|
+
def valid?
|
|
104
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
105
|
+
return false if @current_password.nil?
|
|
106
|
+
return false if @new_password.nil?
|
|
107
|
+
true
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Custom attribute writer method with validation
|
|
111
|
+
# @param [Object] current_password Value to be assigned
|
|
112
|
+
def current_password=(current_password)
|
|
113
|
+
if current_password.nil?
|
|
114
|
+
fail ArgumentError, 'current_password cannot be nil'
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
@current_password = current_password
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Custom attribute writer method with validation
|
|
121
|
+
# @param [Object] new_password Value to be assigned
|
|
122
|
+
def new_password=(new_password)
|
|
123
|
+
if new_password.nil?
|
|
124
|
+
fail ArgumentError, 'new_password cannot be nil'
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
@new_password = new_password
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Checks equality by comparing each attribute.
|
|
131
|
+
# @param [Object] Object to be compared
|
|
132
|
+
def ==(o)
|
|
133
|
+
return true if self.equal?(o)
|
|
134
|
+
self.class == o.class &&
|
|
135
|
+
current_password == o.current_password &&
|
|
136
|
+
new_password == o.new_password
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# @see the `==` method
|
|
140
|
+
# @param [Object] Object to be compared
|
|
141
|
+
def eql?(o)
|
|
142
|
+
self == o
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Calculates hash code according to all attributes.
|
|
146
|
+
# @return [Integer] Hash code
|
|
147
|
+
def hash
|
|
148
|
+
[current_password, new_password].hash
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Builds the object from hash
|
|
152
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
153
|
+
# @return [Object] Returns the model itself
|
|
154
|
+
def self.build_from_hash(attributes)
|
|
155
|
+
return nil unless attributes.is_a?(Hash)
|
|
156
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
157
|
+
transformed_hash = {}
|
|
158
|
+
openapi_types.each_pair do |key, type|
|
|
159
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
160
|
+
transformed_hash["#{key}"] = nil
|
|
161
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
162
|
+
# check to ensure the input is an array given that the attribute
|
|
163
|
+
# is documented as an array but the input is not
|
|
164
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
165
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
166
|
+
end
|
|
167
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
168
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
new(transformed_hash)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Deserializes the data based on type
|
|
175
|
+
# @param string type Data type
|
|
176
|
+
# @param string value Value to be deserialized
|
|
177
|
+
# @return [Object] Deserialized data
|
|
178
|
+
def self._deserialize(type, value)
|
|
179
|
+
case type.to_sym
|
|
180
|
+
when :Time
|
|
181
|
+
Time.parse(value)
|
|
182
|
+
when :Date
|
|
183
|
+
Date.parse(value)
|
|
184
|
+
when :String
|
|
185
|
+
value.to_s
|
|
186
|
+
when :Integer
|
|
187
|
+
value.to_i
|
|
188
|
+
when :Float
|
|
189
|
+
value.to_f
|
|
190
|
+
when :Boolean
|
|
191
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
192
|
+
true
|
|
193
|
+
else
|
|
194
|
+
false
|
|
195
|
+
end
|
|
196
|
+
when :Object
|
|
197
|
+
# generic object (usually a Hash), return directly
|
|
198
|
+
value
|
|
199
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
200
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
201
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
202
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
203
|
+
k_type = Regexp.last_match[:k_type]
|
|
204
|
+
v_type = Regexp.last_match[:v_type]
|
|
205
|
+
{}.tap do |hash|
|
|
206
|
+
value.each do |k, v|
|
|
207
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
else # model
|
|
211
|
+
# models (e.g. Pet) or oneOf
|
|
212
|
+
klass = Zyphr.const_get(type)
|
|
213
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# Returns the string representation of the object
|
|
218
|
+
# @return [String] String presentation of the object
|
|
219
|
+
def to_s
|
|
220
|
+
to_hash.to_s
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
224
|
+
# @return [Hash] Returns the object in the form of hash
|
|
225
|
+
def to_body
|
|
226
|
+
to_hash
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
# Returns the object in the form of hash
|
|
230
|
+
# @return [Hash] Returns the object in the form of hash
|
|
231
|
+
def to_hash
|
|
232
|
+
hash = {}
|
|
233
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
234
|
+
value = self.send(attr)
|
|
235
|
+
if value.nil?
|
|
236
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
237
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
hash[param] = _to_hash(value)
|
|
241
|
+
end
|
|
242
|
+
hash
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# Outputs non-array value in the form of hash
|
|
246
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
247
|
+
# @param [Object] value Any valid value
|
|
248
|
+
# @return [Hash] Returns the value in the form of hash
|
|
249
|
+
def _to_hash(value)
|
|
250
|
+
if value.is_a?(Array)
|
|
251
|
+
value.compact.map { |v| _to_hash(v) }
|
|
252
|
+
elsif value.is_a?(Hash)
|
|
253
|
+
{}.tap do |hash|
|
|
254
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
255
|
+
end
|
|
256
|
+
elsif value.respond_to? :to_hash
|
|
257
|
+
value.to_hash
|
|
258
|
+
else
|
|
259
|
+
value
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
end
|
|
@@ -0,0 +1,240 @@
|
|
|
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 ## Account Sending Status Every authenticated response carries the account's current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## 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 SetSelfApplicationTestRecipientsRequest
|
|
18
|
+
# Email addresses allowed to receive auth emails. An empty array clears the allowlist (disables the gate).
|
|
19
|
+
attr_accessor :test_recipients
|
|
20
|
+
|
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
22
|
+
def self.attribute_map
|
|
23
|
+
{
|
|
24
|
+
:'test_recipients' => :'test_recipients'
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Returns attribute mapping this model knows about
|
|
29
|
+
def self.acceptable_attribute_map
|
|
30
|
+
attribute_map
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Returns all the JSON keys this model knows about
|
|
34
|
+
def self.acceptable_attributes
|
|
35
|
+
acceptable_attribute_map.values
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Attribute type mapping.
|
|
39
|
+
def self.openapi_types
|
|
40
|
+
{
|
|
41
|
+
:'test_recipients' => :'Array<String>'
|
|
42
|
+
}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# List of attributes with nullable: true
|
|
46
|
+
def self.openapi_nullable
|
|
47
|
+
Set.new([
|
|
48
|
+
])
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Initializes the object
|
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
53
|
+
def initialize(attributes = {})
|
|
54
|
+
if (!attributes.is_a?(Hash))
|
|
55
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::SetSelfApplicationTestRecipientsRequest` initialize method"
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
59
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
60
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
61
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
62
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::SetSelfApplicationTestRecipientsRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
63
|
+
end
|
|
64
|
+
h[k.to_sym] = v
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if attributes.key?(:'test_recipients')
|
|
68
|
+
if (value = attributes[:'test_recipients']).is_a?(Array)
|
|
69
|
+
self.test_recipients = value
|
|
70
|
+
end
|
|
71
|
+
else
|
|
72
|
+
self.test_recipients = nil
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
77
|
+
# @return Array for valid properties with the reasons
|
|
78
|
+
def list_invalid_properties
|
|
79
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
80
|
+
invalid_properties = Array.new
|
|
81
|
+
if @test_recipients.nil?
|
|
82
|
+
invalid_properties.push('invalid value for "test_recipients", test_recipients cannot be nil.')
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
invalid_properties
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Check to see if the all the properties in the model are valid
|
|
89
|
+
# @return true if the model is valid
|
|
90
|
+
def valid?
|
|
91
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
92
|
+
return false if @test_recipients.nil?
|
|
93
|
+
true
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Custom attribute writer method with validation
|
|
97
|
+
# @param [Object] test_recipients Value to be assigned
|
|
98
|
+
def test_recipients=(test_recipients)
|
|
99
|
+
if test_recipients.nil?
|
|
100
|
+
fail ArgumentError, 'test_recipients cannot be nil'
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
@test_recipients = test_recipients
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Checks equality by comparing each attribute.
|
|
107
|
+
# @param [Object] Object to be compared
|
|
108
|
+
def ==(o)
|
|
109
|
+
return true if self.equal?(o)
|
|
110
|
+
self.class == o.class &&
|
|
111
|
+
test_recipients == o.test_recipients
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# @see the `==` method
|
|
115
|
+
# @param [Object] Object to be compared
|
|
116
|
+
def eql?(o)
|
|
117
|
+
self == o
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Calculates hash code according to all attributes.
|
|
121
|
+
# @return [Integer] Hash code
|
|
122
|
+
def hash
|
|
123
|
+
[test_recipients].hash
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Builds the object from hash
|
|
127
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
128
|
+
# @return [Object] Returns the model itself
|
|
129
|
+
def self.build_from_hash(attributes)
|
|
130
|
+
return nil unless attributes.is_a?(Hash)
|
|
131
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
132
|
+
transformed_hash = {}
|
|
133
|
+
openapi_types.each_pair do |key, type|
|
|
134
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
135
|
+
transformed_hash["#{key}"] = nil
|
|
136
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
137
|
+
# check to ensure the input is an array given that the attribute
|
|
138
|
+
# is documented as an array but the input is not
|
|
139
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
140
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
141
|
+
end
|
|
142
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
143
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
new(transformed_hash)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Deserializes the data based on type
|
|
150
|
+
# @param string type Data type
|
|
151
|
+
# @param string value Value to be deserialized
|
|
152
|
+
# @return [Object] Deserialized data
|
|
153
|
+
def self._deserialize(type, value)
|
|
154
|
+
case type.to_sym
|
|
155
|
+
when :Time
|
|
156
|
+
Time.parse(value)
|
|
157
|
+
when :Date
|
|
158
|
+
Date.parse(value)
|
|
159
|
+
when :String
|
|
160
|
+
value.to_s
|
|
161
|
+
when :Integer
|
|
162
|
+
value.to_i
|
|
163
|
+
when :Float
|
|
164
|
+
value.to_f
|
|
165
|
+
when :Boolean
|
|
166
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
167
|
+
true
|
|
168
|
+
else
|
|
169
|
+
false
|
|
170
|
+
end
|
|
171
|
+
when :Object
|
|
172
|
+
# generic object (usually a Hash), return directly
|
|
173
|
+
value
|
|
174
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
175
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
176
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
177
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
178
|
+
k_type = Regexp.last_match[:k_type]
|
|
179
|
+
v_type = Regexp.last_match[:v_type]
|
|
180
|
+
{}.tap do |hash|
|
|
181
|
+
value.each do |k, v|
|
|
182
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
else # model
|
|
186
|
+
# models (e.g. Pet) or oneOf
|
|
187
|
+
klass = Zyphr.const_get(type)
|
|
188
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# Returns the string representation of the object
|
|
193
|
+
# @return [String] String presentation of the object
|
|
194
|
+
def to_s
|
|
195
|
+
to_hash.to_s
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
199
|
+
# @return [Hash] Returns the object in the form of hash
|
|
200
|
+
def to_body
|
|
201
|
+
to_hash
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# Returns the object in the form of hash
|
|
205
|
+
# @return [Hash] Returns the object in the form of hash
|
|
206
|
+
def to_hash
|
|
207
|
+
hash = {}
|
|
208
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
209
|
+
value = self.send(attr)
|
|
210
|
+
if value.nil?
|
|
211
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
212
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
hash[param] = _to_hash(value)
|
|
216
|
+
end
|
|
217
|
+
hash
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# Outputs non-array value in the form of hash
|
|
221
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
222
|
+
# @param [Object] value Any valid value
|
|
223
|
+
# @return [Hash] Returns the value in the form of hash
|
|
224
|
+
def _to_hash(value)
|
|
225
|
+
if value.is_a?(Array)
|
|
226
|
+
value.compact.map { |v| _to_hash(v) }
|
|
227
|
+
elsif value.is_a?(Hash)
|
|
228
|
+
{}.tap do |hash|
|
|
229
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
230
|
+
end
|
|
231
|
+
elsif value.respond_to? :to_hash
|
|
232
|
+
value.to_hash
|
|
233
|
+
else
|
|
234
|
+
value
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
end
|
|
@@ -107,7 +107,7 @@ module Zyphr
|
|
|
107
107
|
:'id' => :'String',
|
|
108
108
|
:'msg_id' => :'String',
|
|
109
109
|
:'event_id' => :'String',
|
|
110
|
-
:'event_type' => :'
|
|
110
|
+
:'event_type' => :'WebhookEventType',
|
|
111
111
|
:'status' => :'String',
|
|
112
112
|
:'attempts' => :'Integer',
|
|
113
113
|
:'max_attempts' => :'Integer',
|
|
@@ -120,7 +120,7 @@ module Zyphr
|
|
|
120
120
|
:'id' => :'String',
|
|
121
121
|
:'msg_id' => :'String',
|
|
122
122
|
:'event_id' => :'String',
|
|
123
|
-
:'event_type' => :'
|
|
123
|
+
:'event_type' => :'WebhookEventType',
|
|
124
124
|
:'status' => :'String',
|
|
125
125
|
:'attempts' => :'Integer',
|
|
126
126
|
:'max_attempts' => :'Integer',
|
|
@@ -0,0 +1,66 @@
|
|
|
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 ## Account Sending Status Every authenticated response carries the account's current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## 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 WebhookEventType
|
|
18
|
+
EMAIL_QUEUED = "email.queued".freeze
|
|
19
|
+
EMAIL_SENT = "email.sent".freeze
|
|
20
|
+
EMAIL_DELIVERED = "email.delivered".freeze
|
|
21
|
+
EMAIL_BOUNCED = "email.bounced".freeze
|
|
22
|
+
EMAIL_SOFT_BOUNCED = "email.soft_bounced".freeze
|
|
23
|
+
EMAIL_COMPLAINED = "email.complained".freeze
|
|
24
|
+
EMAIL_OPENED = "email.opened".freeze
|
|
25
|
+
EMAIL_CLICKED = "email.clicked".freeze
|
|
26
|
+
EMAIL_FAILED = "email.failed".freeze
|
|
27
|
+
EMAIL_RECEIVED = "email.received".freeze
|
|
28
|
+
PUSH_SENT = "push.sent".freeze
|
|
29
|
+
PUSH_DELIVERED = "push.delivered".freeze
|
|
30
|
+
PUSH_FAILED = "push.failed".freeze
|
|
31
|
+
PUSH_EXPIRED = "push.expired".freeze
|
|
32
|
+
USER_CREATED = "user.created".freeze
|
|
33
|
+
USER_LOGIN = "user.login".freeze
|
|
34
|
+
USER_LOGOUT = "user.logout".freeze
|
|
35
|
+
USER_PASSWORD_CHANGED = "user.password_changed".freeze
|
|
36
|
+
USER_PASSWORD_RESET_REQUESTED = "user.password_reset_requested".freeze
|
|
37
|
+
USER_EMAIL_VERIFIED = "user.email_verified".freeze
|
|
38
|
+
USER_PHONE_VERIFIED = "user.phone_verified".freeze
|
|
39
|
+
USER_DELETED = "user.deleted".freeze
|
|
40
|
+
USER_SESSION_REVOKED = "user.session_revoked".freeze
|
|
41
|
+
USER_MFA_ENABLED = "user.mfa_enabled".freeze
|
|
42
|
+
USER_MFA_DISABLED = "user.mfa_disabled".freeze
|
|
43
|
+
USER_IMPERSONATED = "user.impersonated".freeze
|
|
44
|
+
DOMAIN_VERIFIED = "domain.verified".freeze
|
|
45
|
+
DOMAIN_VERIFICATION_FAILED = "domain.verification_failed".freeze
|
|
46
|
+
|
|
47
|
+
def self.all_vars
|
|
48
|
+
@all_vars ||= [EMAIL_QUEUED, EMAIL_SENT, EMAIL_DELIVERED, EMAIL_BOUNCED, EMAIL_SOFT_BOUNCED, EMAIL_COMPLAINED, EMAIL_OPENED, EMAIL_CLICKED, EMAIL_FAILED, EMAIL_RECEIVED, PUSH_SENT, PUSH_DELIVERED, PUSH_FAILED, PUSH_EXPIRED, USER_CREATED, USER_LOGIN, USER_LOGOUT, USER_PASSWORD_CHANGED, USER_PASSWORD_RESET_REQUESTED, USER_EMAIL_VERIFIED, USER_PHONE_VERIFIED, USER_DELETED, USER_SESSION_REVOKED, USER_MFA_ENABLED, USER_MFA_DISABLED, USER_IMPERSONATED, DOMAIN_VERIFIED, DOMAIN_VERIFICATION_FAILED].freeze
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Builds the enum from string
|
|
52
|
+
# @param [String] The enum value in the form of the string
|
|
53
|
+
# @return [String] The enum value
|
|
54
|
+
def self.build_from_hash(value)
|
|
55
|
+
new.build_from_hash(value)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Builds the enum from string
|
|
59
|
+
# @param [String] The enum value in the form of the string
|
|
60
|
+
# @return [String] The enum value
|
|
61
|
+
def build_from_hash(value)
|
|
62
|
+
return value if WebhookEventType.all_vars.include?(value)
|
|
63
|
+
raise "Invalid ENUM value #{value} for class #WebhookEventType"
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -46,7 +46,7 @@ module Zyphr
|
|
|
46
46
|
# Attribute type mapping.
|
|
47
47
|
def self.openapi_types
|
|
48
48
|
{
|
|
49
|
-
:'event_types' => :'Array<
|
|
49
|
+
:'event_types' => :'Array<WebhookEventType>',
|
|
50
50
|
:'registry' => :'Array<Object>',
|
|
51
51
|
:'categories' => :'Array<String>',
|
|
52
52
|
:'api_version' => :'String'
|
|
@@ -23,6 +23,28 @@ module Zyphr
|
|
|
23
23
|
|
|
24
24
|
attr_accessor :status
|
|
25
25
|
|
|
26
|
+
class EnumAttributeValidator
|
|
27
|
+
attr_reader :datatype
|
|
28
|
+
attr_reader :allowable_values
|
|
29
|
+
|
|
30
|
+
def initialize(datatype, allowable_values)
|
|
31
|
+
@allowable_values = allowable_values.map do |value|
|
|
32
|
+
case datatype.to_s
|
|
33
|
+
when /Integer/i
|
|
34
|
+
value.to_i
|
|
35
|
+
when /Float/i
|
|
36
|
+
value.to_f
|
|
37
|
+
else
|
|
38
|
+
value
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def valid?(value)
|
|
44
|
+
!value || allowable_values.include?(value)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
26
48
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
27
49
|
def self.attribute_map
|
|
28
50
|
{
|
|
@@ -47,7 +69,7 @@ module Zyphr
|
|
|
47
69
|
def self.openapi_types
|
|
48
70
|
{
|
|
49
71
|
:'delivery_id' => :'String',
|
|
50
|
-
:'event_type' => :'
|
|
72
|
+
:'event_type' => :'WebhookEventType',
|
|
51
73
|
:'payload' => :'Object',
|
|
52
74
|
:'status' => :'String'
|
|
53
75
|
}
|
data/lib/zyphr.rb
CHANGED
|
@@ -65,6 +65,7 @@ require 'zyphr/models/bulk_upsert_auth_email_templates_response'
|
|
|
65
65
|
require 'zyphr/models/category'
|
|
66
66
|
require 'zyphr/models/category_list_response'
|
|
67
67
|
require 'zyphr/models/category_response'
|
|
68
|
+
require 'zyphr/models/change_password_request'
|
|
68
69
|
require 'zyphr/models/close_waa_s_endpoint_circuit200_response'
|
|
69
70
|
require 'zyphr/models/close_waa_s_endpoint_circuit200_response_data'
|
|
70
71
|
require 'zyphr/models/confirm_email_verification_request'
|
|
@@ -344,6 +345,7 @@ require 'zyphr/models/set_end_user_claims200_response_data'
|
|
|
344
345
|
require 'zyphr/models/set_end_user_claims_request'
|
|
345
346
|
require 'zyphr/models/set_preferences_request'
|
|
346
347
|
require 'zyphr/models/set_preferences_request_preferences_inner'
|
|
348
|
+
require 'zyphr/models/set_self_application_test_recipients_request'
|
|
347
349
|
require 'zyphr/models/sign_in_anonymously_request'
|
|
348
350
|
require 'zyphr/models/sign_in_with_game_center_request'
|
|
349
351
|
require 'zyphr/models/sign_in_with_google_play_games_request'
|
|
@@ -481,6 +483,7 @@ require 'zyphr/models/webhook_delivery_list_response'
|
|
|
481
483
|
require 'zyphr/models/webhook_delivery_response'
|
|
482
484
|
require 'zyphr/models/webhook_delivery_retry_response'
|
|
483
485
|
require 'zyphr/models/webhook_delivery_retry_response_data'
|
|
486
|
+
require 'zyphr/models/webhook_event_type'
|
|
484
487
|
require 'zyphr/models/webhook_event_types_response'
|
|
485
488
|
require 'zyphr/models/webhook_event_types_response_data'
|
|
486
489
|
require 'zyphr/models/webhook_ips_response'
|
|
@@ -43,4 +43,16 @@ describe 'AuthApplicationApi' do
|
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
+
# unit tests for set_self_application_test_recipients
|
|
47
|
+
# Set the authenticating application's auth-email test allowlist
|
|
48
|
+
# Set `test_recipients` — the per-application auth-email allowlist — on the application whose credentials authenticated this request. When non-empty, this allowlist gates ALL auth emails (only listed addresses receive them); an EMPTY array clears it and disables the gate. Lets an integrator manage the allowlist from their own infrastructure config instead of the dashboard. Application-SECRET scoped (server-side write): requires X-Application-Key AND X-Application-Secret. Mutates ONLY the authenticating application — it never takes an application id from the request, so there is no cross-tenant write path. The response mirrors GET /auth/application exactly (never returns secrets).
|
|
49
|
+
# @param set_self_application_test_recipients_request
|
|
50
|
+
# @param [Hash] opts the optional parameters
|
|
51
|
+
# @return [ApplicationSelfResponse]
|
|
52
|
+
describe 'set_self_application_test_recipients test' do
|
|
53
|
+
it 'should work' do
|
|
54
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
46
58
|
end
|