zyphr 0.1.43 → 0.1.44
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 +17 -4
- data/docs/ApplicationSelf.md +24 -0
- data/docs/ApplicationSelfResponse.md +20 -0
- data/docs/AuthApplicationApi.md +81 -0
- data/docs/AuthEmailTemplateTestRequest.md +1 -1
- data/docs/AuthEmailTemplatesApi.md +1 -1
- data/docs/AuthMethods.md +28 -0
- data/docs/AuthUserDirectoryApi.md +77 -0
- data/docs/GetEndUserAuthMethods200Response.md +20 -0
- data/lib/zyphr/api/auth_application_api.rb +79 -0
- data/lib/zyphr/api/auth_email_templates_api.rb +2 -2
- data/lib/zyphr/api/auth_user_directory_api.rb +63 -0
- data/lib/zyphr/models/application_self.rb +342 -0
- data/lib/zyphr/models/application_self_response.rb +229 -0
- data/lib/zyphr/models/auth_email_template_test_request.rb +1 -1
- data/lib/zyphr/models/auth_methods.rb +376 -0
- data/lib/zyphr/models/get_end_user_auth_methods200_response.rb +229 -0
- data/lib/zyphr.rb +5 -0
- data/spec/api/auth_application_api_spec.rb +46 -0
- data/spec/api/auth_email_templates_api_spec.rb +1 -1
- data/spec/api/auth_user_directory_api_spec.rb +12 -0
- data/spec/models/application_self_response_spec.rb +42 -0
- data/spec/models/application_self_spec.rb +62 -0
- data/spec/models/auth_methods_spec.rb +66 -0
- data/spec/models/get_end_user_auth_methods200_response_spec.rb +42 -0
- data/zyphr.gemspec +1 -1
- metadata +21 -1
|
@@ -0,0 +1,342 @@
|
|
|
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
|
+
# Non-sensitive metadata about the authenticating application. Returned by GET /auth/application so an integrator can read their own application_id (the sole tenant discriminator embedded in end-user tokens) directly from the API. Never includes secrets, signing keys, or account-internal fields.
|
|
18
|
+
class ApplicationSelf
|
|
19
|
+
# The application's unique id (application_id).
|
|
20
|
+
attr_accessor :id
|
|
21
|
+
|
|
22
|
+
# Human-readable application name.
|
|
23
|
+
attr_accessor :name
|
|
24
|
+
|
|
25
|
+
# The environment mode of the credentials used to authenticate this request. `null` when the environment cannot be determined (e.g. a legacy application-level key that predates environment-scoped keys) — not defaulted to a guessed value.
|
|
26
|
+
attr_accessor :environment
|
|
27
|
+
|
|
28
|
+
# JWT signing algorithm for this application's end-user tokens.
|
|
29
|
+
attr_accessor :signing_algorithm
|
|
30
|
+
|
|
31
|
+
class EnumAttributeValidator
|
|
32
|
+
attr_reader :datatype
|
|
33
|
+
attr_reader :allowable_values
|
|
34
|
+
|
|
35
|
+
def initialize(datatype, allowable_values)
|
|
36
|
+
@allowable_values = allowable_values.map do |value|
|
|
37
|
+
case datatype.to_s
|
|
38
|
+
when /Integer/i
|
|
39
|
+
value.to_i
|
|
40
|
+
when /Float/i
|
|
41
|
+
value.to_f
|
|
42
|
+
else
|
|
43
|
+
value
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def valid?(value)
|
|
49
|
+
!value || allowable_values.include?(value)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
54
|
+
def self.attribute_map
|
|
55
|
+
{
|
|
56
|
+
:'id' => :'id',
|
|
57
|
+
:'name' => :'name',
|
|
58
|
+
:'environment' => :'environment',
|
|
59
|
+
:'signing_algorithm' => :'signing_algorithm'
|
|
60
|
+
}
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Returns attribute mapping this model knows about
|
|
64
|
+
def self.acceptable_attribute_map
|
|
65
|
+
attribute_map
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Returns all the JSON keys this model knows about
|
|
69
|
+
def self.acceptable_attributes
|
|
70
|
+
acceptable_attribute_map.values
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Attribute type mapping.
|
|
74
|
+
def self.openapi_types
|
|
75
|
+
{
|
|
76
|
+
:'id' => :'String',
|
|
77
|
+
:'name' => :'String',
|
|
78
|
+
:'environment' => :'String',
|
|
79
|
+
:'signing_algorithm' => :'String'
|
|
80
|
+
}
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# List of attributes with nullable: true
|
|
84
|
+
def self.openapi_nullable
|
|
85
|
+
Set.new([
|
|
86
|
+
:'environment',
|
|
87
|
+
])
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Initializes the object
|
|
91
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
92
|
+
def initialize(attributes = {})
|
|
93
|
+
if (!attributes.is_a?(Hash))
|
|
94
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::ApplicationSelf` initialize method"
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
98
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
99
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
100
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
101
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::ApplicationSelf`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
102
|
+
end
|
|
103
|
+
h[k.to_sym] = v
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if attributes.key?(:'id')
|
|
107
|
+
self.id = attributes[:'id']
|
|
108
|
+
else
|
|
109
|
+
self.id = nil
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
if attributes.key?(:'name')
|
|
113
|
+
self.name = attributes[:'name']
|
|
114
|
+
else
|
|
115
|
+
self.name = nil
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
if attributes.key?(:'environment')
|
|
119
|
+
self.environment = attributes[:'environment']
|
|
120
|
+
else
|
|
121
|
+
self.environment = nil
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
if attributes.key?(:'signing_algorithm')
|
|
125
|
+
self.signing_algorithm = attributes[:'signing_algorithm']
|
|
126
|
+
else
|
|
127
|
+
self.signing_algorithm = nil
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
132
|
+
# @return Array for valid properties with the reasons
|
|
133
|
+
def list_invalid_properties
|
|
134
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
135
|
+
invalid_properties = Array.new
|
|
136
|
+
if @id.nil?
|
|
137
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
if @name.nil?
|
|
141
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
if @signing_algorithm.nil?
|
|
145
|
+
invalid_properties.push('invalid value for "signing_algorithm", signing_algorithm cannot be nil.')
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
invalid_properties
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Check to see if the all the properties in the model are valid
|
|
152
|
+
# @return true if the model is valid
|
|
153
|
+
def valid?
|
|
154
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
155
|
+
return false if @id.nil?
|
|
156
|
+
return false if @name.nil?
|
|
157
|
+
environment_validator = EnumAttributeValidator.new('String', ["test", "live"])
|
|
158
|
+
return false unless environment_validator.valid?(@environment)
|
|
159
|
+
return false if @signing_algorithm.nil?
|
|
160
|
+
signing_algorithm_validator = EnumAttributeValidator.new('String', ["HS256", "RS256", "ES256"])
|
|
161
|
+
return false unless signing_algorithm_validator.valid?(@signing_algorithm)
|
|
162
|
+
true
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Custom attribute writer method with validation
|
|
166
|
+
# @param [Object] id Value to be assigned
|
|
167
|
+
def id=(id)
|
|
168
|
+
if id.nil?
|
|
169
|
+
fail ArgumentError, 'id cannot be nil'
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
@id = id
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Custom attribute writer method with validation
|
|
176
|
+
# @param [Object] name Value to be assigned
|
|
177
|
+
def name=(name)
|
|
178
|
+
if name.nil?
|
|
179
|
+
fail ArgumentError, 'name cannot be nil'
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
@name = name
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
186
|
+
# @param [Object] environment Object to be assigned
|
|
187
|
+
def environment=(environment)
|
|
188
|
+
validator = EnumAttributeValidator.new('String', ["test", "live"])
|
|
189
|
+
unless validator.valid?(environment)
|
|
190
|
+
fail ArgumentError, "invalid value for \"environment\", must be one of #{validator.allowable_values}."
|
|
191
|
+
end
|
|
192
|
+
@environment = environment
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
196
|
+
# @param [Object] signing_algorithm Object to be assigned
|
|
197
|
+
def signing_algorithm=(signing_algorithm)
|
|
198
|
+
validator = EnumAttributeValidator.new('String', ["HS256", "RS256", "ES256"])
|
|
199
|
+
unless validator.valid?(signing_algorithm)
|
|
200
|
+
fail ArgumentError, "invalid value for \"signing_algorithm\", must be one of #{validator.allowable_values}."
|
|
201
|
+
end
|
|
202
|
+
@signing_algorithm = signing_algorithm
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Checks equality by comparing each attribute.
|
|
206
|
+
# @param [Object] Object to be compared
|
|
207
|
+
def ==(o)
|
|
208
|
+
return true if self.equal?(o)
|
|
209
|
+
self.class == o.class &&
|
|
210
|
+
id == o.id &&
|
|
211
|
+
name == o.name &&
|
|
212
|
+
environment == o.environment &&
|
|
213
|
+
signing_algorithm == o.signing_algorithm
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# @see the `==` method
|
|
217
|
+
# @param [Object] Object to be compared
|
|
218
|
+
def eql?(o)
|
|
219
|
+
self == o
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# Calculates hash code according to all attributes.
|
|
223
|
+
# @return [Integer] Hash code
|
|
224
|
+
def hash
|
|
225
|
+
[id, name, environment, signing_algorithm].hash
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# Builds the object from hash
|
|
229
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
230
|
+
# @return [Object] Returns the model itself
|
|
231
|
+
def self.build_from_hash(attributes)
|
|
232
|
+
return nil unless attributes.is_a?(Hash)
|
|
233
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
234
|
+
transformed_hash = {}
|
|
235
|
+
openapi_types.each_pair do |key, type|
|
|
236
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
237
|
+
transformed_hash["#{key}"] = nil
|
|
238
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
239
|
+
# check to ensure the input is an array given that the attribute
|
|
240
|
+
# is documented as an array but the input is not
|
|
241
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
242
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
243
|
+
end
|
|
244
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
245
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
246
|
+
end
|
|
247
|
+
end
|
|
248
|
+
new(transformed_hash)
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
# Deserializes the data based on type
|
|
252
|
+
# @param string type Data type
|
|
253
|
+
# @param string value Value to be deserialized
|
|
254
|
+
# @return [Object] Deserialized data
|
|
255
|
+
def self._deserialize(type, value)
|
|
256
|
+
case type.to_sym
|
|
257
|
+
when :Time
|
|
258
|
+
Time.parse(value)
|
|
259
|
+
when :Date
|
|
260
|
+
Date.parse(value)
|
|
261
|
+
when :String
|
|
262
|
+
value.to_s
|
|
263
|
+
when :Integer
|
|
264
|
+
value.to_i
|
|
265
|
+
when :Float
|
|
266
|
+
value.to_f
|
|
267
|
+
when :Boolean
|
|
268
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
269
|
+
true
|
|
270
|
+
else
|
|
271
|
+
false
|
|
272
|
+
end
|
|
273
|
+
when :Object
|
|
274
|
+
# generic object (usually a Hash), return directly
|
|
275
|
+
value
|
|
276
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
277
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
278
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
279
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
280
|
+
k_type = Regexp.last_match[:k_type]
|
|
281
|
+
v_type = Regexp.last_match[:v_type]
|
|
282
|
+
{}.tap do |hash|
|
|
283
|
+
value.each do |k, v|
|
|
284
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
else # model
|
|
288
|
+
# models (e.g. Pet) or oneOf
|
|
289
|
+
klass = Zyphr.const_get(type)
|
|
290
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
# Returns the string representation of the object
|
|
295
|
+
# @return [String] String presentation of the object
|
|
296
|
+
def to_s
|
|
297
|
+
to_hash.to_s
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
301
|
+
# @return [Hash] Returns the object in the form of hash
|
|
302
|
+
def to_body
|
|
303
|
+
to_hash
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
# Returns the object in the form of hash
|
|
307
|
+
# @return [Hash] Returns the object in the form of hash
|
|
308
|
+
def to_hash
|
|
309
|
+
hash = {}
|
|
310
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
311
|
+
value = self.send(attr)
|
|
312
|
+
if value.nil?
|
|
313
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
314
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
hash[param] = _to_hash(value)
|
|
318
|
+
end
|
|
319
|
+
hash
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
# Outputs non-array value in the form of hash
|
|
323
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
324
|
+
# @param [Object] value Any valid value
|
|
325
|
+
# @return [Hash] Returns the value in the form of hash
|
|
326
|
+
def _to_hash(value)
|
|
327
|
+
if value.is_a?(Array)
|
|
328
|
+
value.compact.map { |v| _to_hash(v) }
|
|
329
|
+
elsif value.is_a?(Hash)
|
|
330
|
+
{}.tap do |hash|
|
|
331
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
332
|
+
end
|
|
333
|
+
elsif value.respond_to? :to_hash
|
|
334
|
+
value.to_hash
|
|
335
|
+
else
|
|
336
|
+
value
|
|
337
|
+
end
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
end
|
|
@@ -0,0 +1,229 @@
|
|
|
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 ApplicationSelfResponse
|
|
18
|
+
attr_accessor :data
|
|
19
|
+
|
|
20
|
+
attr_accessor :meta
|
|
21
|
+
|
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
23
|
+
def self.attribute_map
|
|
24
|
+
{
|
|
25
|
+
:'data' => :'data',
|
|
26
|
+
:'meta' => :'meta'
|
|
27
|
+
}
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Returns attribute mapping this model knows about
|
|
31
|
+
def self.acceptable_attribute_map
|
|
32
|
+
attribute_map
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Returns all the JSON keys this model knows about
|
|
36
|
+
def self.acceptable_attributes
|
|
37
|
+
acceptable_attribute_map.values
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Attribute type mapping.
|
|
41
|
+
def self.openapi_types
|
|
42
|
+
{
|
|
43
|
+
:'data' => :'ApplicationSelf',
|
|
44
|
+
:'meta' => :'RequestMeta'
|
|
45
|
+
}
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# List of attributes with nullable: true
|
|
49
|
+
def self.openapi_nullable
|
|
50
|
+
Set.new([
|
|
51
|
+
])
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Initializes the object
|
|
55
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
56
|
+
def initialize(attributes = {})
|
|
57
|
+
if (!attributes.is_a?(Hash))
|
|
58
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::ApplicationSelfResponse` initialize method"
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
62
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
63
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
64
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
65
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::ApplicationSelfResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
66
|
+
end
|
|
67
|
+
h[k.to_sym] = v
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if attributes.key?(:'data')
|
|
71
|
+
self.data = attributes[:'data']
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
if attributes.key?(:'meta')
|
|
75
|
+
self.meta = attributes[:'meta']
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
80
|
+
# @return Array for valid properties with the reasons
|
|
81
|
+
def list_invalid_properties
|
|
82
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
83
|
+
invalid_properties = Array.new
|
|
84
|
+
invalid_properties
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Check to see if the all the properties in the model are valid
|
|
88
|
+
# @return true if the model is valid
|
|
89
|
+
def valid?
|
|
90
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
91
|
+
true
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Checks equality by comparing each attribute.
|
|
95
|
+
# @param [Object] Object to be compared
|
|
96
|
+
def ==(o)
|
|
97
|
+
return true if self.equal?(o)
|
|
98
|
+
self.class == o.class &&
|
|
99
|
+
data == o.data &&
|
|
100
|
+
meta == o.meta
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# @see the `==` method
|
|
104
|
+
# @param [Object] Object to be compared
|
|
105
|
+
def eql?(o)
|
|
106
|
+
self == o
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Calculates hash code according to all attributes.
|
|
110
|
+
# @return [Integer] Hash code
|
|
111
|
+
def hash
|
|
112
|
+
[data, meta].hash
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Builds the object from hash
|
|
116
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
117
|
+
# @return [Object] Returns the model itself
|
|
118
|
+
def self.build_from_hash(attributes)
|
|
119
|
+
return nil unless attributes.is_a?(Hash)
|
|
120
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
121
|
+
transformed_hash = {}
|
|
122
|
+
openapi_types.each_pair do |key, type|
|
|
123
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
124
|
+
transformed_hash["#{key}"] = nil
|
|
125
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
126
|
+
# check to ensure the input is an array given that the attribute
|
|
127
|
+
# is documented as an array but the input is not
|
|
128
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
129
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
130
|
+
end
|
|
131
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
132
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
new(transformed_hash)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Deserializes the data based on type
|
|
139
|
+
# @param string type Data type
|
|
140
|
+
# @param string value Value to be deserialized
|
|
141
|
+
# @return [Object] Deserialized data
|
|
142
|
+
def self._deserialize(type, value)
|
|
143
|
+
case type.to_sym
|
|
144
|
+
when :Time
|
|
145
|
+
Time.parse(value)
|
|
146
|
+
when :Date
|
|
147
|
+
Date.parse(value)
|
|
148
|
+
when :String
|
|
149
|
+
value.to_s
|
|
150
|
+
when :Integer
|
|
151
|
+
value.to_i
|
|
152
|
+
when :Float
|
|
153
|
+
value.to_f
|
|
154
|
+
when :Boolean
|
|
155
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
156
|
+
true
|
|
157
|
+
else
|
|
158
|
+
false
|
|
159
|
+
end
|
|
160
|
+
when :Object
|
|
161
|
+
# generic object (usually a Hash), return directly
|
|
162
|
+
value
|
|
163
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
164
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
165
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
166
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
167
|
+
k_type = Regexp.last_match[:k_type]
|
|
168
|
+
v_type = Regexp.last_match[:v_type]
|
|
169
|
+
{}.tap do |hash|
|
|
170
|
+
value.each do |k, v|
|
|
171
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
else # model
|
|
175
|
+
# models (e.g. Pet) or oneOf
|
|
176
|
+
klass = Zyphr.const_get(type)
|
|
177
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Returns the string representation of the object
|
|
182
|
+
# @return [String] String presentation of the object
|
|
183
|
+
def to_s
|
|
184
|
+
to_hash.to_s
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
188
|
+
# @return [Hash] Returns the object in the form of hash
|
|
189
|
+
def to_body
|
|
190
|
+
to_hash
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Returns the object in the form of hash
|
|
194
|
+
# @return [Hash] Returns the object in the form of hash
|
|
195
|
+
def to_hash
|
|
196
|
+
hash = {}
|
|
197
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
198
|
+
value = self.send(attr)
|
|
199
|
+
if value.nil?
|
|
200
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
201
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
hash[param] = _to_hash(value)
|
|
205
|
+
end
|
|
206
|
+
hash
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Outputs non-array value in the form of hash
|
|
210
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
211
|
+
# @param [Object] value Any valid value
|
|
212
|
+
# @return [Hash] Returns the value in the form of hash
|
|
213
|
+
def _to_hash(value)
|
|
214
|
+
if value.is_a?(Array)
|
|
215
|
+
value.compact.map { |v| _to_hash(v) }
|
|
216
|
+
elsif value.is_a?(Hash)
|
|
217
|
+
{}.tap do |hash|
|
|
218
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
219
|
+
end
|
|
220
|
+
elsif value.respond_to? :to_hash
|
|
221
|
+
value.to_hash
|
|
222
|
+
else
|
|
223
|
+
value
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
end
|
|
@@ -15,7 +15,7 @@ require 'time'
|
|
|
15
15
|
|
|
16
16
|
module Zyphr
|
|
17
17
|
class AuthEmailTemplateTestRequest
|
|
18
|
-
# Recipient email. Must be in the application's `test_recipients` allowlist.
|
|
18
|
+
# Recipient email. Must be in the application's `test_recipients` allowlist. When non-empty, `test_recipients` gates ALL auth emails the application sends (magic link, password reset, verification, OTP) — only listed recipients receive auth email — which keeps non-production applications safe from mass sends. An empty allowlist imposes no restriction.
|
|
19
19
|
attr_accessor :to
|
|
20
20
|
|
|
21
21
|
attr_accessor :variables
|