zyphr 0.1.53 → 0.1.54
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 +1 -0
- data/docs/AuthEmailVerificationApi.md +4 -4
- data/docs/ConfirmEmailVerificationResponseData.md +3 -1
- data/docs/ResendEmailVerificationRequest.md +18 -0
- data/docs/SendEmailVerificationRequest.md +1 -1
- data/lib/zyphr/api/auth_email_verification_api.rb +7 -7
- data/lib/zyphr/models/confirm_email_verification_response_data.rb +14 -4
- data/lib/zyphr/models/resend_email_verification_request.rb +221 -0
- data/lib/zyphr/models/send_email_verification_request.rb +1 -1
- data/lib/zyphr.rb +1 -0
- data/spec/api/auth_email_verification_api_spec.rb +3 -3
- data/spec/models/confirm_email_verification_response_data_spec.rb +6 -0
- data/spec/models/resend_email_verification_request_spec.rb +36 -0
- data/zyphr.gemspec +1 -1
- metadata +5 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1dd0fa491c14eae6cbe02e22123be2a14b9e610a0ae0e0c8bc23494fa829b794
|
|
4
|
+
data.tar.gz: eac26999943994e36be2f294b8b7fb2971c06499be14d1aafd215bbca6b96731
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 629ace4aadcb6d25d8322bfa7a5c6db4acaee7c24f24d81420dbf982a89125b7e63e3f742db85904871bc34badf9bf0e6d2d6dbaac354071a0e50597e4b4eb0f
|
|
7
|
+
data.tar.gz: a22a85f934c92ffb9e1e7b06e301debdaef89af3591336bda245c86a8a2331d29f763b2886c325738b7225a24dc28be26ddb2336f6493e31d91752f173e233f1
|
data/README.md
CHANGED
|
@@ -674,6 +674,7 @@ Class | Method | HTTP request | Description
|
|
|
674
674
|
- [Zyphr::ReorderWorkflowStepsRequest](docs/ReorderWorkflowStepsRequest.md)
|
|
675
675
|
- [Zyphr::ReplayWebhookEventsRequest](docs/ReplayWebhookEventsRequest.md)
|
|
676
676
|
- [Zyphr::RequestMeta](docs/RequestMeta.md)
|
|
677
|
+
- [Zyphr::ResendEmailVerificationRequest](docs/ResendEmailVerificationRequest.md)
|
|
677
678
|
- [Zyphr::ResetPasswordRequest](docs/ResetPasswordRequest.md)
|
|
678
679
|
- [Zyphr::ResetPasswordResponse](docs/ResetPasswordResponse.md)
|
|
679
680
|
- [Zyphr::ResubscribeRequest](docs/ResubscribeRequest.md)
|
|
@@ -15,7 +15,7 @@ All URIs are relative to *https://api.zyphr.dev/v1*
|
|
|
15
15
|
|
|
16
16
|
Confirm email verification
|
|
17
17
|
|
|
18
|
-
Verify the user's email using
|
|
18
|
+
Verify the user's email using a token you collected yourself. IMPORTANT: the emailed verification LINK verifies the address server-side **on click** and then redirects to `redirect_url`. So if you take the token off that redirect and post it here, it is already redeemed — and this endpoint treats that as an idempotent **success** (`200` with `already_verified: true`), not an error. Only a genuinely invalid / expired / unknown token returns `400`. `send` / `confirm` / `resend` are NOT a mandatory matched set — `confirm` is for flows where you collect the token directly rather than landing the hosted redirect. Recommended pattern for the redirect landing: call `confirm`, ignore its result, then read the user's verified state back and report that — correct whether or not the link already consumed the token.
|
|
19
19
|
|
|
20
20
|
### Examples
|
|
21
21
|
|
|
@@ -116,7 +116,7 @@ end
|
|
|
116
116
|
|
|
117
117
|
api_instance = Zyphr::AuthEmailVerificationApi.new
|
|
118
118
|
opts = {
|
|
119
|
-
|
|
119
|
+
resend_email_verification_request: Zyphr::ResendEmailVerificationRequest.new # ResendEmailVerificationRequest |
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
begin
|
|
@@ -150,7 +150,7 @@ end
|
|
|
150
150
|
|
|
151
151
|
| Name | Type | Description | Notes |
|
|
152
152
|
| ---- | ---- | ----------- | ----- |
|
|
153
|
-
| **
|
|
153
|
+
| **resend_email_verification_request** | [**ResendEmailVerificationRequest**](ResendEmailVerificationRequest.md) | | [optional] |
|
|
154
154
|
|
|
155
155
|
### Return type
|
|
156
156
|
|
|
@@ -172,7 +172,7 @@ end
|
|
|
172
172
|
|
|
173
173
|
Send email verification
|
|
174
174
|
|
|
175
|
-
Send an email verification link to the authenticated user.
|
|
175
|
+
Send an email verification link to the authenticated user. Requires all three credentials simultaneously: the application key (`X-Application-Key`), the application secret (`X-Application-Secret`), and the end user's `Authorization: Bearer` token. If the recipient is blocked by the application's `auth_email_mode=allowlist` gate, the request is still **accepted with 200** (mirroring `POST /auth/forgot-password`): no email is sent, and the suppression is recorded as a `messages` row (`status=suppressed`, `status_reason=recipient_not_allowlisted`) and an `email.suppressed` webhook. It is NOT a 500.
|
|
176
176
|
|
|
177
177
|
### Examples
|
|
178
178
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
7
|
| **success** | **Boolean** | | [optional] |
|
|
8
8
|
| **email** | **String** | | [optional] |
|
|
9
|
+
| **already_verified** | **Boolean** | True when the address was already verified (the emailed link consumed the token on click). Still a 200 — an idempotent success, not an error (sc-7721). | [optional] |
|
|
9
10
|
|
|
10
11
|
## Example
|
|
11
12
|
|
|
@@ -14,7 +15,8 @@ require 'zyphr'
|
|
|
14
15
|
|
|
15
16
|
instance = Zyphr::ConfirmEmailVerificationResponseData.new(
|
|
16
17
|
success: null,
|
|
17
|
-
email: null
|
|
18
|
+
email: null,
|
|
19
|
+
already_verified: null
|
|
18
20
|
)
|
|
19
21
|
```
|
|
20
22
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Zyphr::ResendEmailVerificationRequest
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **redirect_url** | **String** | URL to redirect to after verification | [optional] |
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
require 'zyphr'
|
|
13
|
+
|
|
14
|
+
instance = Zyphr::ResendEmailVerificationRequest.new(
|
|
15
|
+
redirect_url: null
|
|
16
|
+
)
|
|
17
|
+
```
|
|
18
|
+
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
| Name | Type | Description | Notes |
|
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
|
7
|
-
| **redirect_url** | **String** | URL to redirect to after verification | [optional] |
|
|
7
|
+
| **redirect_url** | **String** | URL to redirect to after verification (snake_case `redirect_url` — a camelCase `redirectUrl` is ignored and the hosted verification page is used instead). Must match one of the application's configured redirect URIs. | [optional] |
|
|
8
8
|
|
|
9
9
|
## Example
|
|
10
10
|
|
|
@@ -20,7 +20,7 @@ module Zyphr
|
|
|
20
20
|
@api_client = api_client
|
|
21
21
|
end
|
|
22
22
|
# Confirm email verification
|
|
23
|
-
# Verify the user's email using
|
|
23
|
+
# Verify the user's email using a token you collected yourself. IMPORTANT: the emailed verification LINK verifies the address server-side **on click** and then redirects to `redirect_url`. So if you take the token off that redirect and post it here, it is already redeemed — and this endpoint treats that as an idempotent **success** (`200` with `already_verified: true`), not an error. Only a genuinely invalid / expired / unknown token returns `400`. `send` / `confirm` / `resend` are NOT a mandatory matched set — `confirm` is for flows where you collect the token directly rather than landing the hosted redirect. Recommended pattern for the redirect landing: call `confirm`, ignore its result, then read the user's verified state back and report that — correct whether or not the link already consumed the token.
|
|
24
24
|
# @param confirm_email_verification_request [ConfirmEmailVerificationRequest]
|
|
25
25
|
# @param [Hash] opts the optional parameters
|
|
26
26
|
# @return [ConfirmEmailVerificationResponse]
|
|
@@ -30,7 +30,7 @@ module Zyphr
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
# Confirm email verification
|
|
33
|
-
# Verify the user's email using
|
|
33
|
+
# Verify the user's email using a token you collected yourself. IMPORTANT: the emailed verification LINK verifies the address server-side **on click** and then redirects to `redirect_url`. So if you take the token off that redirect and post it here, it is already redeemed — and this endpoint treats that as an idempotent **success** (`200` with `already_verified: true`), not an error. Only a genuinely invalid / expired / unknown token returns `400`. `send` / `confirm` / `resend` are NOT a mandatory matched set — `confirm` is for flows where you collect the token directly rather than landing the hosted redirect. Recommended pattern for the redirect landing: call `confirm`, ignore its result, then read the user's verified state back and report that — correct whether or not the link already consumed the token.
|
|
34
34
|
# @param confirm_email_verification_request [ConfirmEmailVerificationRequest]
|
|
35
35
|
# @param [Hash] opts the optional parameters
|
|
36
36
|
# @return [Array<(ConfirmEmailVerificationResponse, Integer, Hash)>] ConfirmEmailVerificationResponse data, response status code and response headers
|
|
@@ -90,7 +90,7 @@ module Zyphr
|
|
|
90
90
|
# Resend email verification
|
|
91
91
|
# Resend the verification email to the authenticated user. Rate limited to once per 60 seconds.
|
|
92
92
|
# @param [Hash] opts the optional parameters
|
|
93
|
-
# @option opts [
|
|
93
|
+
# @option opts [ResendEmailVerificationRequest] :resend_email_verification_request
|
|
94
94
|
# @return [SuccessResult]
|
|
95
95
|
def resend_email_verification(opts = {})
|
|
96
96
|
data, _status_code, _headers = resend_email_verification_with_http_info(opts)
|
|
@@ -100,7 +100,7 @@ module Zyphr
|
|
|
100
100
|
# Resend email verification
|
|
101
101
|
# Resend the verification email to the authenticated user. Rate limited to once per 60 seconds.
|
|
102
102
|
# @param [Hash] opts the optional parameters
|
|
103
|
-
# @option opts [
|
|
103
|
+
# @option opts [ResendEmailVerificationRequest] :resend_email_verification_request
|
|
104
104
|
# @return [Array<(SuccessResult, Integer, Hash)>] SuccessResult data, response status code and response headers
|
|
105
105
|
def resend_email_verification_with_http_info(opts = {})
|
|
106
106
|
if @api_client.config.debugging
|
|
@@ -126,7 +126,7 @@ module Zyphr
|
|
|
126
126
|
form_params = opts[:form_params] || {}
|
|
127
127
|
|
|
128
128
|
# http body (model)
|
|
129
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'
|
|
129
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'resend_email_verification_request'])
|
|
130
130
|
|
|
131
131
|
# return_type
|
|
132
132
|
return_type = opts[:debug_return_type] || 'SuccessResult'
|
|
@@ -152,7 +152,7 @@ module Zyphr
|
|
|
152
152
|
end
|
|
153
153
|
|
|
154
154
|
# Send email verification
|
|
155
|
-
# Send an email verification link to the authenticated user.
|
|
155
|
+
# Send an email verification link to the authenticated user. Requires all three credentials simultaneously: the application key (`X-Application-Key`), the application secret (`X-Application-Secret`), and the end user's `Authorization: Bearer` token. If the recipient is blocked by the application's `auth_email_mode=allowlist` gate, the request is still **accepted with 200** (mirroring `POST /auth/forgot-password`): no email is sent, and the suppression is recorded as a `messages` row (`status=suppressed`, `status_reason=recipient_not_allowlisted`) and an `email.suppressed` webhook. It is NOT a 500.
|
|
156
156
|
# @param [Hash] opts the optional parameters
|
|
157
157
|
# @option opts [SendEmailVerificationRequest] :send_email_verification_request
|
|
158
158
|
# @return [SuccessResult]
|
|
@@ -162,7 +162,7 @@ module Zyphr
|
|
|
162
162
|
end
|
|
163
163
|
|
|
164
164
|
# Send email verification
|
|
165
|
-
# Send an email verification link to the authenticated user.
|
|
165
|
+
# Send an email verification link to the authenticated user. Requires all three credentials simultaneously: the application key (`X-Application-Key`), the application secret (`X-Application-Secret`), and the end user's `Authorization: Bearer` token. If the recipient is blocked by the application's `auth_email_mode=allowlist` gate, the request is still **accepted with 200** (mirroring `POST /auth/forgot-password`): no email is sent, and the suppression is recorded as a `messages` row (`status=suppressed`, `status_reason=recipient_not_allowlisted`) and an `email.suppressed` webhook. It is NOT a 500.
|
|
166
166
|
# @param [Hash] opts the optional parameters
|
|
167
167
|
# @option opts [SendEmailVerificationRequest] :send_email_verification_request
|
|
168
168
|
# @return [Array<(SuccessResult, Integer, Hash)>] SuccessResult data, response status code and response headers
|
|
@@ -19,11 +19,15 @@ module Zyphr
|
|
|
19
19
|
|
|
20
20
|
attr_accessor :email
|
|
21
21
|
|
|
22
|
+
# True when the address was already verified (the emailed link consumed the token on click). Still a 200 — an idempotent success, not an error (sc-7721).
|
|
23
|
+
attr_accessor :already_verified
|
|
24
|
+
|
|
22
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
23
26
|
def self.attribute_map
|
|
24
27
|
{
|
|
25
28
|
:'success' => :'success',
|
|
26
|
-
:'email' => :'email'
|
|
29
|
+
:'email' => :'email',
|
|
30
|
+
:'already_verified' => :'already_verified'
|
|
27
31
|
}
|
|
28
32
|
end
|
|
29
33
|
|
|
@@ -41,7 +45,8 @@ module Zyphr
|
|
|
41
45
|
def self.openapi_types
|
|
42
46
|
{
|
|
43
47
|
:'success' => :'Boolean',
|
|
44
|
-
:'email' => :'String'
|
|
48
|
+
:'email' => :'String',
|
|
49
|
+
:'already_verified' => :'Boolean'
|
|
45
50
|
}
|
|
46
51
|
end
|
|
47
52
|
|
|
@@ -74,6 +79,10 @@ module Zyphr
|
|
|
74
79
|
if attributes.key?(:'email')
|
|
75
80
|
self.email = attributes[:'email']
|
|
76
81
|
end
|
|
82
|
+
|
|
83
|
+
if attributes.key?(:'already_verified')
|
|
84
|
+
self.already_verified = attributes[:'already_verified']
|
|
85
|
+
end
|
|
77
86
|
end
|
|
78
87
|
|
|
79
88
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -97,7 +106,8 @@ module Zyphr
|
|
|
97
106
|
return true if self.equal?(o)
|
|
98
107
|
self.class == o.class &&
|
|
99
108
|
success == o.success &&
|
|
100
|
-
email == o.email
|
|
109
|
+
email == o.email &&
|
|
110
|
+
already_verified == o.already_verified
|
|
101
111
|
end
|
|
102
112
|
|
|
103
113
|
# @see the `==` method
|
|
@@ -109,7 +119,7 @@ module Zyphr
|
|
|
109
119
|
# Calculates hash code according to all attributes.
|
|
110
120
|
# @return [Integer] Hash code
|
|
111
121
|
def hash
|
|
112
|
-
[success, email].hash
|
|
122
|
+
[success, email, already_verified].hash
|
|
113
123
|
end
|
|
114
124
|
|
|
115
125
|
# Builds the object from hash
|
|
@@ -0,0 +1,221 @@
|
|
|
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 ResendEmailVerificationRequest
|
|
18
|
+
# URL to redirect to after verification
|
|
19
|
+
attr_accessor :redirect_url
|
|
20
|
+
|
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
22
|
+
def self.attribute_map
|
|
23
|
+
{
|
|
24
|
+
:'redirect_url' => :'redirect_url'
|
|
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
|
+
:'redirect_url' => :'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::ResendEmailVerificationRequest` 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::ResendEmailVerificationRequest`. 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?(:'redirect_url')
|
|
68
|
+
self.redirect_url = attributes[:'redirect_url']
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
73
|
+
# @return Array for valid properties with the reasons
|
|
74
|
+
def list_invalid_properties
|
|
75
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
76
|
+
invalid_properties = Array.new
|
|
77
|
+
invalid_properties
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Check to see if the all the properties in the model are valid
|
|
81
|
+
# @return true if the model is valid
|
|
82
|
+
def valid?
|
|
83
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
84
|
+
true
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Checks equality by comparing each attribute.
|
|
88
|
+
# @param [Object] Object to be compared
|
|
89
|
+
def ==(o)
|
|
90
|
+
return true if self.equal?(o)
|
|
91
|
+
self.class == o.class &&
|
|
92
|
+
redirect_url == o.redirect_url
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# @see the `==` method
|
|
96
|
+
# @param [Object] Object to be compared
|
|
97
|
+
def eql?(o)
|
|
98
|
+
self == o
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Calculates hash code according to all attributes.
|
|
102
|
+
# @return [Integer] Hash code
|
|
103
|
+
def hash
|
|
104
|
+
[redirect_url].hash
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Builds the object from hash
|
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
109
|
+
# @return [Object] Returns the model itself
|
|
110
|
+
def self.build_from_hash(attributes)
|
|
111
|
+
return nil unless attributes.is_a?(Hash)
|
|
112
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
113
|
+
transformed_hash = {}
|
|
114
|
+
openapi_types.each_pair do |key, type|
|
|
115
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
116
|
+
transformed_hash["#{key}"] = nil
|
|
117
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
118
|
+
# check to ensure the input is an array given that the attribute
|
|
119
|
+
# is documented as an array but the input is not
|
|
120
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
121
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
122
|
+
end
|
|
123
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
124
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
new(transformed_hash)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Deserializes the data based on type
|
|
131
|
+
# @param string type Data type
|
|
132
|
+
# @param string value Value to be deserialized
|
|
133
|
+
# @return [Object] Deserialized data
|
|
134
|
+
def self._deserialize(type, value)
|
|
135
|
+
case type.to_sym
|
|
136
|
+
when :Time
|
|
137
|
+
Time.parse(value)
|
|
138
|
+
when :Date
|
|
139
|
+
Date.parse(value)
|
|
140
|
+
when :String
|
|
141
|
+
value.to_s
|
|
142
|
+
when :Integer
|
|
143
|
+
value.to_i
|
|
144
|
+
when :Float
|
|
145
|
+
value.to_f
|
|
146
|
+
when :Boolean
|
|
147
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
148
|
+
true
|
|
149
|
+
else
|
|
150
|
+
false
|
|
151
|
+
end
|
|
152
|
+
when :Object
|
|
153
|
+
# generic object (usually a Hash), return directly
|
|
154
|
+
value
|
|
155
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
156
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
157
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
158
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
159
|
+
k_type = Regexp.last_match[:k_type]
|
|
160
|
+
v_type = Regexp.last_match[:v_type]
|
|
161
|
+
{}.tap do |hash|
|
|
162
|
+
value.each do |k, v|
|
|
163
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
else # model
|
|
167
|
+
# models (e.g. Pet) or oneOf
|
|
168
|
+
klass = Zyphr.const_get(type)
|
|
169
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Returns the string representation of the object
|
|
174
|
+
# @return [String] String presentation of the object
|
|
175
|
+
def to_s
|
|
176
|
+
to_hash.to_s
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
180
|
+
# @return [Hash] Returns the object in the form of hash
|
|
181
|
+
def to_body
|
|
182
|
+
to_hash
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Returns the object in the form of hash
|
|
186
|
+
# @return [Hash] Returns the object in the form of hash
|
|
187
|
+
def to_hash
|
|
188
|
+
hash = {}
|
|
189
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
190
|
+
value = self.send(attr)
|
|
191
|
+
if value.nil?
|
|
192
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
193
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
hash[param] = _to_hash(value)
|
|
197
|
+
end
|
|
198
|
+
hash
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Outputs non-array value in the form of hash
|
|
202
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
203
|
+
# @param [Object] value Any valid value
|
|
204
|
+
# @return [Hash] Returns the value in the form of hash
|
|
205
|
+
def _to_hash(value)
|
|
206
|
+
if value.is_a?(Array)
|
|
207
|
+
value.compact.map { |v| _to_hash(v) }
|
|
208
|
+
elsif value.is_a?(Hash)
|
|
209
|
+
{}.tap do |hash|
|
|
210
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
211
|
+
end
|
|
212
|
+
elsif value.respond_to? :to_hash
|
|
213
|
+
value.to_hash
|
|
214
|
+
else
|
|
215
|
+
value
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
end
|
|
@@ -15,7 +15,7 @@ require 'time'
|
|
|
15
15
|
|
|
16
16
|
module Zyphr
|
|
17
17
|
class SendEmailVerificationRequest
|
|
18
|
-
# URL to redirect to after verification
|
|
18
|
+
# URL to redirect to after verification (snake_case `redirect_url` — a camelCase `redirectUrl` is ignored and the hosted verification page is used instead). Must match one of the application's configured redirect URIs.
|
|
19
19
|
attr_accessor :redirect_url
|
|
20
20
|
|
|
21
21
|
# Attribute mapping from ruby-style variable name to JSON key.
|
data/lib/zyphr.rb
CHANGED
|
@@ -294,6 +294,7 @@ require 'zyphr/models/render_template_request'
|
|
|
294
294
|
require 'zyphr/models/reorder_workflow_steps_request'
|
|
295
295
|
require 'zyphr/models/replay_webhook_events_request'
|
|
296
296
|
require 'zyphr/models/request_meta'
|
|
297
|
+
require 'zyphr/models/resend_email_verification_request'
|
|
297
298
|
require 'zyphr/models/reset_password_request'
|
|
298
299
|
require 'zyphr/models/reset_password_response'
|
|
299
300
|
require 'zyphr/models/resubscribe_request'
|
|
@@ -34,7 +34,7 @@ describe 'AuthEmailVerificationApi' do
|
|
|
34
34
|
|
|
35
35
|
# unit tests for confirm_email_verification
|
|
36
36
|
# Confirm email verification
|
|
37
|
-
# Verify the user's email using
|
|
37
|
+
# Verify the user's email using a token you collected yourself. IMPORTANT: the emailed verification LINK verifies the address server-side **on click** and then redirects to `redirect_url`. So if you take the token off that redirect and post it here, it is already redeemed — and this endpoint treats that as an idempotent **success** (`200` with `already_verified: true`), not an error. Only a genuinely invalid / expired / unknown token returns `400`. `send` / `confirm` / `resend` are NOT a mandatory matched set — `confirm` is for flows where you collect the token directly rather than landing the hosted redirect. Recommended pattern for the redirect landing: call `confirm`, ignore its result, then read the user's verified state back and report that — correct whether or not the link already consumed the token.
|
|
38
38
|
# @param confirm_email_verification_request
|
|
39
39
|
# @param [Hash] opts the optional parameters
|
|
40
40
|
# @return [ConfirmEmailVerificationResponse]
|
|
@@ -48,7 +48,7 @@ describe 'AuthEmailVerificationApi' do
|
|
|
48
48
|
# Resend email verification
|
|
49
49
|
# Resend the verification email to the authenticated user. Rate limited to once per 60 seconds.
|
|
50
50
|
# @param [Hash] opts the optional parameters
|
|
51
|
-
# @option opts [
|
|
51
|
+
# @option opts [ResendEmailVerificationRequest] :resend_email_verification_request
|
|
52
52
|
# @return [SuccessResult]
|
|
53
53
|
describe 'resend_email_verification test' do
|
|
54
54
|
it 'should work' do
|
|
@@ -58,7 +58,7 @@ describe 'AuthEmailVerificationApi' do
|
|
|
58
58
|
|
|
59
59
|
# unit tests for send_email_verification
|
|
60
60
|
# Send email verification
|
|
61
|
-
# Send an email verification link to the authenticated user.
|
|
61
|
+
# Send an email verification link to the authenticated user. Requires all three credentials simultaneously: the application key (`X-Application-Key`), the application secret (`X-Application-Secret`), and the end user's `Authorization: Bearer` token. If the recipient is blocked by the application's `auth_email_mode=allowlist` gate, the request is still **accepted with 200** (mirroring `POST /auth/forgot-password`): no email is sent, and the suppression is recorded as a `messages` row (`status=suppressed`, `status_reason=recipient_not_allowlisted`) and an `email.suppressed` webhook. It is NOT a 500.
|
|
62
62
|
# @param [Hash] opts the optional parameters
|
|
63
63
|
# @option opts [SendEmailVerificationRequest] :send_email_verification_request
|
|
64
64
|
# @return [SuccessResult]
|
|
@@ -39,4 +39,10 @@ describe Zyphr::ConfirmEmailVerificationResponseData do
|
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
describe 'test attribute "already_verified"' do
|
|
43
|
+
it 'should work' do
|
|
44
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
42
48
|
end
|
|
@@ -0,0 +1,36 @@
|
|
|
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 'spec_helper'
|
|
14
|
+
require 'json'
|
|
15
|
+
require 'date'
|
|
16
|
+
|
|
17
|
+
# Unit tests for Zyphr::ResendEmailVerificationRequest
|
|
18
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
|
19
|
+
# Please update as you see appropriate
|
|
20
|
+
describe Zyphr::ResendEmailVerificationRequest do
|
|
21
|
+
let(:instance) { Zyphr::ResendEmailVerificationRequest.new }
|
|
22
|
+
|
|
23
|
+
describe 'test an instance of ResendEmailVerificationRequest' do
|
|
24
|
+
it 'should create an instance of ResendEmailVerificationRequest' do
|
|
25
|
+
# uncomment below to test the instance creation
|
|
26
|
+
#expect(instance).to be_instance_of(Zyphr::ResendEmailVerificationRequest)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe 'test attribute "redirect_url"' do
|
|
31
|
+
it 'should work' do
|
|
32
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
data/zyphr.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zyphr
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.54
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Zyphr
|
|
@@ -388,6 +388,7 @@ files:
|
|
|
388
388
|
- docs/ReorderWorkflowStepsRequest.md
|
|
389
389
|
- docs/ReplayWebhookEventsRequest.md
|
|
390
390
|
- docs/RequestMeta.md
|
|
391
|
+
- docs/ResendEmailVerificationRequest.md
|
|
391
392
|
- docs/ResetPasswordRequest.md
|
|
392
393
|
- docs/ResetPasswordResponse.md
|
|
393
394
|
- docs/ResubscribeRequest.md
|
|
@@ -948,6 +949,7 @@ files:
|
|
|
948
949
|
- lib/zyphr/models/reorder_workflow_steps_request.rb
|
|
949
950
|
- lib/zyphr/models/replay_webhook_events_request.rb
|
|
950
951
|
- lib/zyphr/models/request_meta.rb
|
|
952
|
+
- lib/zyphr/models/resend_email_verification_request.rb
|
|
951
953
|
- lib/zyphr/models/reset_password_request.rb
|
|
952
954
|
- lib/zyphr/models/reset_password_response.rb
|
|
953
955
|
- lib/zyphr/models/resubscribe_request.rb
|
|
@@ -1490,6 +1492,7 @@ files:
|
|
|
1490
1492
|
- spec/models/reorder_workflow_steps_request_spec.rb
|
|
1491
1493
|
- spec/models/replay_webhook_events_request_spec.rb
|
|
1492
1494
|
- spec/models/request_meta_spec.rb
|
|
1495
|
+
- spec/models/resend_email_verification_request_spec.rb
|
|
1493
1496
|
- spec/models/reset_password_request_spec.rb
|
|
1494
1497
|
- spec/models/reset_password_response_spec.rb
|
|
1495
1498
|
- spec/models/resubscribe_request_spec.rb
|
|
@@ -2188,6 +2191,7 @@ test_files:
|
|
|
2188
2191
|
- spec/models/end_user_delete_response_data_spec.rb
|
|
2189
2192
|
- spec/models/slack_message_list_response_spec.rb
|
|
2190
2193
|
- spec/models/convert_anonymous_user_request_one_of_spec.rb
|
|
2194
|
+
- spec/models/resend_email_verification_request_spec.rb
|
|
2191
2195
|
- spec/models/workflow_execution_spec.rb
|
|
2192
2196
|
- spec/models/webhook_delivery_detail_spec.rb
|
|
2193
2197
|
- spec/models/get_waa_s_endpoint_metrics200_response_data_spec.rb
|