zyphr 0.1.8 → 0.1.9
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 +4 -0
- data/docs/GenerateSubscriberToken200Response.md +18 -0
- data/docs/GenerateSubscriberToken200ResponseData.md +22 -0
- data/docs/GenerateSubscriberTokenRequest.md +20 -0
- data/docs/InboxApi.md +72 -0
- data/lib/zyphr/api/inbox_api.rb +68 -0
- data/lib/zyphr/models/generate_subscriber_token200_response.rb +220 -0
- data/lib/zyphr/models/generate_subscriber_token200_response_data.rb +240 -0
- data/lib/zyphr/models/generate_subscriber_token_request.rb +232 -0
- data/lib/zyphr.rb +3 -0
- data/spec/api/inbox_api_spec.rb +12 -0
- data/spec/models/generate_subscriber_token200_response_data_spec.rb +48 -0
- data/spec/models/generate_subscriber_token200_response_spec.rb +36 -0
- data/spec/models/generate_subscriber_token_request_spec.rb +42 -0
- data/zyphr.gemspec +1 -1
- metadata +14 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c623be268e21a0b9a6f02574620b8bad04a0f46376eebc87fd07169141048fea
|
|
4
|
+
data.tar.gz: eec0d29ed64024e54a7b919c953c63e454b166331a73bc705cdd394a7dbc8707
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a55b94c7d240d37497f0ad581f039b444d86e4d39138d8fc5cbfcc99219cee0c6e198ea015f6c50e5b6d802f7f340ce6aa88119e4b3baad922ffddfd08a69e04
|
|
7
|
+
data.tar.gz: cdfd6a51d14ed424e26be47da5a5e472aead6019e40e9dd6fdebf0bb3b417d95ec783781e9a32e166a6deb4c61923accf17f213cf0460afcaa450ad1b399d609
|
data/README.md
CHANGED
|
@@ -188,6 +188,7 @@ Class | Method | HTTP request | Description
|
|
|
188
188
|
*Zyphr::EmailsApi* | [**send_email**](docs/EmailsApi.md#send_email) | **POST** /emails | Send an email
|
|
189
189
|
*Zyphr::InboxApi* | [**archive_inbox_notification**](docs/InboxApi.md#archive_inbox_notification) | **POST** /inbox/{id}/archive | Archive a notification
|
|
190
190
|
*Zyphr::InboxApi* | [**delete_inbox_notification**](docs/InboxApi.md#delete_inbox_notification) | **DELETE** /inbox/{id} | Delete a notification
|
|
191
|
+
*Zyphr::InboxApi* | [**generate_subscriber_token**](docs/InboxApi.md#generate_subscriber_token) | **POST** /subscriber-inbox/token | Generate a subscriber token
|
|
191
192
|
*Zyphr::InboxApi* | [**get_inbox_notification**](docs/InboxApi.md#get_inbox_notification) | **GET** /inbox/{id} | Get a notification
|
|
192
193
|
*Zyphr::InboxApi* | [**get_unread_count**](docs/InboxApi.md#get_unread_count) | **GET** /inbox/unread-count | Get unread notification count
|
|
193
194
|
*Zyphr::InboxApi* | [**list_inbox**](docs/InboxApi.md#list_inbox) | **GET** /inbox | List inbox notifications
|
|
@@ -370,6 +371,9 @@ Class | Method | HTTP request | Description
|
|
|
370
371
|
- [Zyphr::EndUserDeleteResponse](docs/EndUserDeleteResponse.md)
|
|
371
372
|
- [Zyphr::EndUserDeleteResponseData](docs/EndUserDeleteResponseData.md)
|
|
372
373
|
- [Zyphr::ForgotPasswordRequest](docs/ForgotPasswordRequest.md)
|
|
374
|
+
- [Zyphr::GenerateSubscriberToken200Response](docs/GenerateSubscriberToken200Response.md)
|
|
375
|
+
- [Zyphr::GenerateSubscriberToken200ResponseData](docs/GenerateSubscriberToken200ResponseData.md)
|
|
376
|
+
- [Zyphr::GenerateSubscriberTokenRequest](docs/GenerateSubscriberTokenRequest.md)
|
|
373
377
|
- [Zyphr::GenerateWaaSPortalToken201Response](docs/GenerateWaaSPortalToken201Response.md)
|
|
374
378
|
- [Zyphr::GetWaaSEndpoint200Response](docs/GetWaaSEndpoint200Response.md)
|
|
375
379
|
- [Zyphr::GetWaaSUsage200Response](docs/GetWaaSUsage200Response.md)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Zyphr::GenerateSubscriberToken200Response
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **data** | [**GenerateSubscriberToken200ResponseData**](GenerateSubscriberToken200ResponseData.md) | | [optional] |
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
require 'zyphr'
|
|
13
|
+
|
|
14
|
+
instance = Zyphr::GenerateSubscriberToken200Response.new(
|
|
15
|
+
data: null
|
|
16
|
+
)
|
|
17
|
+
```
|
|
18
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Zyphr::GenerateSubscriberToken200ResponseData
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **token** | **String** | JWT subscriber token for client-side authentication | [optional] |
|
|
8
|
+
| **subscriber_id** | **String** | | [optional] |
|
|
9
|
+
| **expires_in** | **Integer** | Token lifetime in seconds | [optional] |
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
require 'zyphr'
|
|
15
|
+
|
|
16
|
+
instance = Zyphr::GenerateSubscriberToken200ResponseData.new(
|
|
17
|
+
token: null,
|
|
18
|
+
subscriber_id: null,
|
|
19
|
+
expires_in: 604800
|
|
20
|
+
)
|
|
21
|
+
```
|
|
22
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Zyphr::GenerateSubscriberTokenRequest
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **subscriber_id** | **String** | Internal subscriber ID | [optional] |
|
|
8
|
+
| **external_id** | **String** | Your external subscriber ID | [optional] |
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```ruby
|
|
13
|
+
require 'zyphr'
|
|
14
|
+
|
|
15
|
+
instance = Zyphr::GenerateSubscriberTokenRequest.new(
|
|
16
|
+
subscriber_id: null,
|
|
17
|
+
external_id: null
|
|
18
|
+
)
|
|
19
|
+
```
|
|
20
|
+
|
data/docs/InboxApi.md
CHANGED
|
@@ -6,6 +6,7 @@ All URIs are relative to *https://api.zyphr.dev/v1*
|
|
|
6
6
|
| ------ | ------------ | ----------- |
|
|
7
7
|
| [**archive_inbox_notification**](InboxApi.md#archive_inbox_notification) | **POST** /inbox/{id}/archive | Archive a notification |
|
|
8
8
|
| [**delete_inbox_notification**](InboxApi.md#delete_inbox_notification) | **DELETE** /inbox/{id} | Delete a notification |
|
|
9
|
+
| [**generate_subscriber_token**](InboxApi.md#generate_subscriber_token) | **POST** /subscriber-inbox/token | Generate a subscriber token |
|
|
9
10
|
| [**get_inbox_notification**](InboxApi.md#get_inbox_notification) | **GET** /inbox/{id} | Get a notification |
|
|
10
11
|
| [**get_unread_count**](InboxApi.md#get_unread_count) | **GET** /inbox/unread-count | Get unread notification count |
|
|
11
12
|
| [**list_inbox**](InboxApi.md#list_inbox) | **GET** /inbox | List inbox notifications |
|
|
@@ -166,6 +167,77 @@ nil (empty response body)
|
|
|
166
167
|
- **Accept**: Not defined
|
|
167
168
|
|
|
168
169
|
|
|
170
|
+
## generate_subscriber_token
|
|
171
|
+
|
|
172
|
+
> <GenerateSubscriberToken200Response> generate_subscriber_token(generate_subscriber_token_request)
|
|
173
|
+
|
|
174
|
+
Generate a subscriber token
|
|
175
|
+
|
|
176
|
+
Generate a JWT token for client-side inbox authentication. This is a server-side call that requires your API key. Pass the returned token to `@zyphr/inbox-react`'s `<ZyphrProvider subscriberToken=\"...\">` or use it as `Authorization: Bearer <token>` for client-side inbox API calls and WebSocket connections. The token expires in 7 days.
|
|
177
|
+
|
|
178
|
+
### Examples
|
|
179
|
+
|
|
180
|
+
```ruby
|
|
181
|
+
require 'time'
|
|
182
|
+
require 'zyphr'
|
|
183
|
+
# setup authorization
|
|
184
|
+
Zyphr.configure do |config|
|
|
185
|
+
# Configure API key authorization: ApiKeyAuth
|
|
186
|
+
config.api_key['X-API-Key'] = 'YOUR API KEY'
|
|
187
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
|
188
|
+
# config.api_key_prefix['X-API-Key'] = 'Bearer'
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
api_instance = Zyphr::InboxApi.new
|
|
192
|
+
generate_subscriber_token_request = Zyphr::GenerateSubscriberTokenRequest.new # GenerateSubscriberTokenRequest |
|
|
193
|
+
|
|
194
|
+
begin
|
|
195
|
+
# Generate a subscriber token
|
|
196
|
+
result = api_instance.generate_subscriber_token(generate_subscriber_token_request)
|
|
197
|
+
p result
|
|
198
|
+
rescue Zyphr::ApiError => e
|
|
199
|
+
puts "Error when calling InboxApi->generate_subscriber_token: #{e}"
|
|
200
|
+
end
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### Using the generate_subscriber_token_with_http_info variant
|
|
204
|
+
|
|
205
|
+
This returns an Array which contains the response data, status code and headers.
|
|
206
|
+
|
|
207
|
+
> <Array(<GenerateSubscriberToken200Response>, Integer, Hash)> generate_subscriber_token_with_http_info(generate_subscriber_token_request)
|
|
208
|
+
|
|
209
|
+
```ruby
|
|
210
|
+
begin
|
|
211
|
+
# Generate a subscriber token
|
|
212
|
+
data, status_code, headers = api_instance.generate_subscriber_token_with_http_info(generate_subscriber_token_request)
|
|
213
|
+
p status_code # => 2xx
|
|
214
|
+
p headers # => { ... }
|
|
215
|
+
p data # => <GenerateSubscriberToken200Response>
|
|
216
|
+
rescue Zyphr::ApiError => e
|
|
217
|
+
puts "Error when calling InboxApi->generate_subscriber_token_with_http_info: #{e}"
|
|
218
|
+
end
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Parameters
|
|
222
|
+
|
|
223
|
+
| Name | Type | Description | Notes |
|
|
224
|
+
| ---- | ---- | ----------- | ----- |
|
|
225
|
+
| **generate_subscriber_token_request** | [**GenerateSubscriberTokenRequest**](GenerateSubscriberTokenRequest.md) | | |
|
|
226
|
+
|
|
227
|
+
### Return type
|
|
228
|
+
|
|
229
|
+
[**GenerateSubscriberToken200Response**](GenerateSubscriberToken200Response.md)
|
|
230
|
+
|
|
231
|
+
### Authorization
|
|
232
|
+
|
|
233
|
+
[ApiKeyAuth](../README.md#ApiKeyAuth)
|
|
234
|
+
|
|
235
|
+
### HTTP request headers
|
|
236
|
+
|
|
237
|
+
- **Content-Type**: application/json
|
|
238
|
+
- **Accept**: application/json
|
|
239
|
+
|
|
240
|
+
|
|
169
241
|
## get_inbox_notification
|
|
170
242
|
|
|
171
243
|
> <InboxNotificationResponse> get_inbox_notification(id, opts)
|
data/lib/zyphr/api/inbox_api.rb
CHANGED
|
@@ -156,6 +156,74 @@ module Zyphr
|
|
|
156
156
|
return data, status_code, headers
|
|
157
157
|
end
|
|
158
158
|
|
|
159
|
+
# Generate a subscriber token
|
|
160
|
+
# Generate a JWT token for client-side inbox authentication. This is a server-side call that requires your API key. Pass the returned token to `@zyphr/inbox-react`'s `<ZyphrProvider subscriberToken=\"...\">` or use it as `Authorization: Bearer <token>` for client-side inbox API calls and WebSocket connections. The token expires in 7 days.
|
|
161
|
+
# @param generate_subscriber_token_request [GenerateSubscriberTokenRequest]
|
|
162
|
+
# @param [Hash] opts the optional parameters
|
|
163
|
+
# @return [GenerateSubscriberToken200Response]
|
|
164
|
+
def generate_subscriber_token(generate_subscriber_token_request, opts = {})
|
|
165
|
+
data, _status_code, _headers = generate_subscriber_token_with_http_info(generate_subscriber_token_request, opts)
|
|
166
|
+
data
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Generate a subscriber token
|
|
170
|
+
# Generate a JWT token for client-side inbox authentication. This is a server-side call that requires your API key. Pass the returned token to `@zyphr/inbox-react`'s `<ZyphrProvider subscriberToken=\"...\">` or use it as `Authorization: Bearer <token>` for client-side inbox API calls and WebSocket connections. The token expires in 7 days.
|
|
171
|
+
# @param generate_subscriber_token_request [GenerateSubscriberTokenRequest]
|
|
172
|
+
# @param [Hash] opts the optional parameters
|
|
173
|
+
# @return [Array<(GenerateSubscriberToken200Response, Integer, Hash)>] GenerateSubscriberToken200Response data, response status code and response headers
|
|
174
|
+
def generate_subscriber_token_with_http_info(generate_subscriber_token_request, opts = {})
|
|
175
|
+
if @api_client.config.debugging
|
|
176
|
+
@api_client.config.logger.debug 'Calling API: InboxApi.generate_subscriber_token ...'
|
|
177
|
+
end
|
|
178
|
+
# verify the required parameter 'generate_subscriber_token_request' is set
|
|
179
|
+
if @api_client.config.client_side_validation && generate_subscriber_token_request.nil?
|
|
180
|
+
fail ArgumentError, "Missing the required parameter 'generate_subscriber_token_request' when calling InboxApi.generate_subscriber_token"
|
|
181
|
+
end
|
|
182
|
+
# resource path
|
|
183
|
+
local_var_path = '/subscriber-inbox/token'
|
|
184
|
+
|
|
185
|
+
# query parameters
|
|
186
|
+
query_params = opts[:query_params] || {}
|
|
187
|
+
|
|
188
|
+
# header parameters
|
|
189
|
+
header_params = opts[:header_params] || {}
|
|
190
|
+
# HTTP header 'Accept' (if needed)
|
|
191
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
192
|
+
# HTTP header 'Content-Type'
|
|
193
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
194
|
+
if !content_type.nil?
|
|
195
|
+
header_params['Content-Type'] = content_type
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# form parameters
|
|
199
|
+
form_params = opts[:form_params] || {}
|
|
200
|
+
|
|
201
|
+
# http body (model)
|
|
202
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(generate_subscriber_token_request)
|
|
203
|
+
|
|
204
|
+
# return_type
|
|
205
|
+
return_type = opts[:debug_return_type] || 'GenerateSubscriberToken200Response'
|
|
206
|
+
|
|
207
|
+
# auth_names
|
|
208
|
+
auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']
|
|
209
|
+
|
|
210
|
+
new_options = opts.merge(
|
|
211
|
+
:operation => :"InboxApi.generate_subscriber_token",
|
|
212
|
+
:header_params => header_params,
|
|
213
|
+
:query_params => query_params,
|
|
214
|
+
:form_params => form_params,
|
|
215
|
+
:body => post_body,
|
|
216
|
+
:auth_names => auth_names,
|
|
217
|
+
:return_type => return_type
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
221
|
+
if @api_client.config.debugging
|
|
222
|
+
@api_client.config.logger.debug "API called: InboxApi#generate_subscriber_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
223
|
+
end
|
|
224
|
+
return data, status_code, headers
|
|
225
|
+
end
|
|
226
|
+
|
|
159
227
|
# Get a notification
|
|
160
228
|
# Get a specific in-app notification by ID.
|
|
161
229
|
# @param id [String]
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Zyphr API
|
|
3
|
+
|
|
4
|
+
#Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: support@zyphr.dev
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.12.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Zyphr
|
|
17
|
+
class GenerateSubscriberToken200Response
|
|
18
|
+
attr_accessor :data
|
|
19
|
+
|
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
21
|
+
def self.attribute_map
|
|
22
|
+
{
|
|
23
|
+
:'data' => :'data'
|
|
24
|
+
}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Returns attribute mapping this model knows about
|
|
28
|
+
def self.acceptable_attribute_map
|
|
29
|
+
attribute_map
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Returns all the JSON keys this model knows about
|
|
33
|
+
def self.acceptable_attributes
|
|
34
|
+
acceptable_attribute_map.values
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Attribute type mapping.
|
|
38
|
+
def self.openapi_types
|
|
39
|
+
{
|
|
40
|
+
:'data' => :'GenerateSubscriberToken200ResponseData'
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# List of attributes with nullable: true
|
|
45
|
+
def self.openapi_nullable
|
|
46
|
+
Set.new([
|
|
47
|
+
])
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Initializes the object
|
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
52
|
+
def initialize(attributes = {})
|
|
53
|
+
if (!attributes.is_a?(Hash))
|
|
54
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::GenerateSubscriberToken200Response` initialize method"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
58
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
59
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
60
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
61
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::GenerateSubscriberToken200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
62
|
+
end
|
|
63
|
+
h[k.to_sym] = v
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if attributes.key?(:'data')
|
|
67
|
+
self.data = attributes[:'data']
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
72
|
+
# @return Array for valid properties with the reasons
|
|
73
|
+
def list_invalid_properties
|
|
74
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
75
|
+
invalid_properties = Array.new
|
|
76
|
+
invalid_properties
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Check to see if the all the properties in the model are valid
|
|
80
|
+
# @return true if the model is valid
|
|
81
|
+
def valid?
|
|
82
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
83
|
+
true
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Checks equality by comparing each attribute.
|
|
87
|
+
# @param [Object] Object to be compared
|
|
88
|
+
def ==(o)
|
|
89
|
+
return true if self.equal?(o)
|
|
90
|
+
self.class == o.class &&
|
|
91
|
+
data == o.data
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# @see the `==` method
|
|
95
|
+
# @param [Object] Object to be compared
|
|
96
|
+
def eql?(o)
|
|
97
|
+
self == o
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Calculates hash code according to all attributes.
|
|
101
|
+
# @return [Integer] Hash code
|
|
102
|
+
def hash
|
|
103
|
+
[data].hash
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Builds the object from hash
|
|
107
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
108
|
+
# @return [Object] Returns the model itself
|
|
109
|
+
def self.build_from_hash(attributes)
|
|
110
|
+
return nil unless attributes.is_a?(Hash)
|
|
111
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
112
|
+
transformed_hash = {}
|
|
113
|
+
openapi_types.each_pair do |key, type|
|
|
114
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
115
|
+
transformed_hash["#{key}"] = nil
|
|
116
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
117
|
+
# check to ensure the input is an array given that the attribute
|
|
118
|
+
# is documented as an array but the input is not
|
|
119
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
120
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
121
|
+
end
|
|
122
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
123
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
new(transformed_hash)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Deserializes the data based on type
|
|
130
|
+
# @param string type Data type
|
|
131
|
+
# @param string value Value to be deserialized
|
|
132
|
+
# @return [Object] Deserialized data
|
|
133
|
+
def self._deserialize(type, value)
|
|
134
|
+
case type.to_sym
|
|
135
|
+
when :Time
|
|
136
|
+
Time.parse(value)
|
|
137
|
+
when :Date
|
|
138
|
+
Date.parse(value)
|
|
139
|
+
when :String
|
|
140
|
+
value.to_s
|
|
141
|
+
when :Integer
|
|
142
|
+
value.to_i
|
|
143
|
+
when :Float
|
|
144
|
+
value.to_f
|
|
145
|
+
when :Boolean
|
|
146
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
147
|
+
true
|
|
148
|
+
else
|
|
149
|
+
false
|
|
150
|
+
end
|
|
151
|
+
when :Object
|
|
152
|
+
# generic object (usually a Hash), return directly
|
|
153
|
+
value
|
|
154
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
155
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
156
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
157
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
158
|
+
k_type = Regexp.last_match[:k_type]
|
|
159
|
+
v_type = Regexp.last_match[:v_type]
|
|
160
|
+
{}.tap do |hash|
|
|
161
|
+
value.each do |k, v|
|
|
162
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
else # model
|
|
166
|
+
# models (e.g. Pet) or oneOf
|
|
167
|
+
klass = Zyphr.const_get(type)
|
|
168
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Returns the string representation of the object
|
|
173
|
+
# @return [String] String presentation of the object
|
|
174
|
+
def to_s
|
|
175
|
+
to_hash.to_s
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
|
180
|
+
def to_body
|
|
181
|
+
to_hash
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Returns the object in the form of hash
|
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
|
186
|
+
def to_hash
|
|
187
|
+
hash = {}
|
|
188
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
189
|
+
value = self.send(attr)
|
|
190
|
+
if value.nil?
|
|
191
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
192
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
hash[param] = _to_hash(value)
|
|
196
|
+
end
|
|
197
|
+
hash
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Outputs non-array value in the form of hash
|
|
201
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
202
|
+
# @param [Object] value Any valid value
|
|
203
|
+
# @return [Hash] Returns the value in the form of hash
|
|
204
|
+
def _to_hash(value)
|
|
205
|
+
if value.is_a?(Array)
|
|
206
|
+
value.compact.map { |v| _to_hash(v) }
|
|
207
|
+
elsif value.is_a?(Hash)
|
|
208
|
+
{}.tap do |hash|
|
|
209
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
210
|
+
end
|
|
211
|
+
elsif value.respond_to? :to_hash
|
|
212
|
+
value.to_hash
|
|
213
|
+
else
|
|
214
|
+
value
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
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 ## 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 GenerateSubscriberToken200ResponseData
|
|
18
|
+
# JWT subscriber token for client-side authentication
|
|
19
|
+
attr_accessor :token
|
|
20
|
+
|
|
21
|
+
attr_accessor :subscriber_id
|
|
22
|
+
|
|
23
|
+
# Token lifetime in seconds
|
|
24
|
+
attr_accessor :expires_in
|
|
25
|
+
|
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
27
|
+
def self.attribute_map
|
|
28
|
+
{
|
|
29
|
+
:'token' => :'token',
|
|
30
|
+
:'subscriber_id' => :'subscriber_id',
|
|
31
|
+
:'expires_in' => :'expires_in'
|
|
32
|
+
}
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Returns attribute mapping this model knows about
|
|
36
|
+
def self.acceptable_attribute_map
|
|
37
|
+
attribute_map
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Returns all the JSON keys this model knows about
|
|
41
|
+
def self.acceptable_attributes
|
|
42
|
+
acceptable_attribute_map.values
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Attribute type mapping.
|
|
46
|
+
def self.openapi_types
|
|
47
|
+
{
|
|
48
|
+
:'token' => :'String',
|
|
49
|
+
:'subscriber_id' => :'String',
|
|
50
|
+
:'expires_in' => :'Integer'
|
|
51
|
+
}
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# List of attributes with nullable: true
|
|
55
|
+
def self.openapi_nullable
|
|
56
|
+
Set.new([
|
|
57
|
+
])
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Initializes the object
|
|
61
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
62
|
+
def initialize(attributes = {})
|
|
63
|
+
if (!attributes.is_a?(Hash))
|
|
64
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::GenerateSubscriberToken200ResponseData` initialize method"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
68
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
69
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
70
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
71
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::GenerateSubscriberToken200ResponseData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
72
|
+
end
|
|
73
|
+
h[k.to_sym] = v
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if attributes.key?(:'token')
|
|
77
|
+
self.token = attributes[:'token']
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
if attributes.key?(:'subscriber_id')
|
|
81
|
+
self.subscriber_id = attributes[:'subscriber_id']
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
if attributes.key?(:'expires_in')
|
|
85
|
+
self.expires_in = attributes[:'expires_in']
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
90
|
+
# @return Array for valid properties with the reasons
|
|
91
|
+
def list_invalid_properties
|
|
92
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
93
|
+
invalid_properties = Array.new
|
|
94
|
+
invalid_properties
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Check to see if the all the properties in the model are valid
|
|
98
|
+
# @return true if the model is valid
|
|
99
|
+
def valid?
|
|
100
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
101
|
+
true
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Checks equality by comparing each attribute.
|
|
105
|
+
# @param [Object] Object to be compared
|
|
106
|
+
def ==(o)
|
|
107
|
+
return true if self.equal?(o)
|
|
108
|
+
self.class == o.class &&
|
|
109
|
+
token == o.token &&
|
|
110
|
+
subscriber_id == o.subscriber_id &&
|
|
111
|
+
expires_in == o.expires_in
|
|
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
|
+
[token, subscriber_id, expires_in].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
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Zyphr API
|
|
3
|
+
|
|
4
|
+
#Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: support@zyphr.dev
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.12.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Zyphr
|
|
17
|
+
# Provide either subscriber_id or external_id
|
|
18
|
+
class GenerateSubscriberTokenRequest
|
|
19
|
+
# Internal subscriber ID
|
|
20
|
+
attr_accessor :subscriber_id
|
|
21
|
+
|
|
22
|
+
# Your external subscriber ID
|
|
23
|
+
attr_accessor :external_id
|
|
24
|
+
|
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
26
|
+
def self.attribute_map
|
|
27
|
+
{
|
|
28
|
+
:'subscriber_id' => :'subscriber_id',
|
|
29
|
+
:'external_id' => :'external_id'
|
|
30
|
+
}
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Returns attribute mapping this model knows about
|
|
34
|
+
def self.acceptable_attribute_map
|
|
35
|
+
attribute_map
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Returns all the JSON keys this model knows about
|
|
39
|
+
def self.acceptable_attributes
|
|
40
|
+
acceptable_attribute_map.values
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Attribute type mapping.
|
|
44
|
+
def self.openapi_types
|
|
45
|
+
{
|
|
46
|
+
:'subscriber_id' => :'String',
|
|
47
|
+
:'external_id' => :'String'
|
|
48
|
+
}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# List of attributes with nullable: true
|
|
52
|
+
def self.openapi_nullable
|
|
53
|
+
Set.new([
|
|
54
|
+
])
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Initializes the object
|
|
58
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
59
|
+
def initialize(attributes = {})
|
|
60
|
+
if (!attributes.is_a?(Hash))
|
|
61
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::GenerateSubscriberTokenRequest` initialize method"
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
65
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
66
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
67
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
68
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::GenerateSubscriberTokenRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
69
|
+
end
|
|
70
|
+
h[k.to_sym] = v
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if attributes.key?(:'subscriber_id')
|
|
74
|
+
self.subscriber_id = attributes[:'subscriber_id']
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
if attributes.key?(:'external_id')
|
|
78
|
+
self.external_id = attributes[:'external_id']
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
83
|
+
# @return Array for valid properties with the reasons
|
|
84
|
+
def list_invalid_properties
|
|
85
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
86
|
+
invalid_properties = Array.new
|
|
87
|
+
invalid_properties
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Check to see if the all the properties in the model are valid
|
|
91
|
+
# @return true if the model is valid
|
|
92
|
+
def valid?
|
|
93
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
94
|
+
true
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Checks equality by comparing each attribute.
|
|
98
|
+
# @param [Object] Object to be compared
|
|
99
|
+
def ==(o)
|
|
100
|
+
return true if self.equal?(o)
|
|
101
|
+
self.class == o.class &&
|
|
102
|
+
subscriber_id == o.subscriber_id &&
|
|
103
|
+
external_id == o.external_id
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# @see the `==` method
|
|
107
|
+
# @param [Object] Object to be compared
|
|
108
|
+
def eql?(o)
|
|
109
|
+
self == o
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Calculates hash code according to all attributes.
|
|
113
|
+
# @return [Integer] Hash code
|
|
114
|
+
def hash
|
|
115
|
+
[subscriber_id, external_id].hash
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Builds the object from hash
|
|
119
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
120
|
+
# @return [Object] Returns the model itself
|
|
121
|
+
def self.build_from_hash(attributes)
|
|
122
|
+
return nil unless attributes.is_a?(Hash)
|
|
123
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
124
|
+
transformed_hash = {}
|
|
125
|
+
openapi_types.each_pair do |key, type|
|
|
126
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
127
|
+
transformed_hash["#{key}"] = nil
|
|
128
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
129
|
+
# check to ensure the input is an array given that the attribute
|
|
130
|
+
# is documented as an array but the input is not
|
|
131
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
132
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
133
|
+
end
|
|
134
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
135
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
new(transformed_hash)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Deserializes the data based on type
|
|
142
|
+
# @param string type Data type
|
|
143
|
+
# @param string value Value to be deserialized
|
|
144
|
+
# @return [Object] Deserialized data
|
|
145
|
+
def self._deserialize(type, value)
|
|
146
|
+
case type.to_sym
|
|
147
|
+
when :Time
|
|
148
|
+
Time.parse(value)
|
|
149
|
+
when :Date
|
|
150
|
+
Date.parse(value)
|
|
151
|
+
when :String
|
|
152
|
+
value.to_s
|
|
153
|
+
when :Integer
|
|
154
|
+
value.to_i
|
|
155
|
+
when :Float
|
|
156
|
+
value.to_f
|
|
157
|
+
when :Boolean
|
|
158
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
159
|
+
true
|
|
160
|
+
else
|
|
161
|
+
false
|
|
162
|
+
end
|
|
163
|
+
when :Object
|
|
164
|
+
# generic object (usually a Hash), return directly
|
|
165
|
+
value
|
|
166
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
167
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
168
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
169
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
170
|
+
k_type = Regexp.last_match[:k_type]
|
|
171
|
+
v_type = Regexp.last_match[:v_type]
|
|
172
|
+
{}.tap do |hash|
|
|
173
|
+
value.each do |k, v|
|
|
174
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
else # model
|
|
178
|
+
# models (e.g. Pet) or oneOf
|
|
179
|
+
klass = Zyphr.const_get(type)
|
|
180
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Returns the string representation of the object
|
|
185
|
+
# @return [String] String presentation of the object
|
|
186
|
+
def to_s
|
|
187
|
+
to_hash.to_s
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
|
192
|
+
def to_body
|
|
193
|
+
to_hash
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Returns the object in the form of hash
|
|
197
|
+
# @return [Hash] Returns the object in the form of hash
|
|
198
|
+
def to_hash
|
|
199
|
+
hash = {}
|
|
200
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
201
|
+
value = self.send(attr)
|
|
202
|
+
if value.nil?
|
|
203
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
204
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
hash[param] = _to_hash(value)
|
|
208
|
+
end
|
|
209
|
+
hash
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Outputs non-array value in the form of hash
|
|
213
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
214
|
+
# @param [Object] value Any valid value
|
|
215
|
+
# @return [Hash] Returns the value in the form of hash
|
|
216
|
+
def _to_hash(value)
|
|
217
|
+
if value.is_a?(Array)
|
|
218
|
+
value.compact.map { |v| _to_hash(v) }
|
|
219
|
+
elsif value.is_a?(Hash)
|
|
220
|
+
{}.tap do |hash|
|
|
221
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
222
|
+
end
|
|
223
|
+
elsif value.respond_to? :to_hash
|
|
224
|
+
value.to_hash
|
|
225
|
+
else
|
|
226
|
+
value
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
end
|
data/lib/zyphr.rb
CHANGED
|
@@ -83,6 +83,9 @@ require 'zyphr/models/email_tracking_response'
|
|
|
83
83
|
require 'zyphr/models/end_user_delete_response'
|
|
84
84
|
require 'zyphr/models/end_user_delete_response_data'
|
|
85
85
|
require 'zyphr/models/forgot_password_request'
|
|
86
|
+
require 'zyphr/models/generate_subscriber_token200_response'
|
|
87
|
+
require 'zyphr/models/generate_subscriber_token200_response_data'
|
|
88
|
+
require 'zyphr/models/generate_subscriber_token_request'
|
|
86
89
|
require 'zyphr/models/generate_waa_s_portal_token201_response'
|
|
87
90
|
require 'zyphr/models/get_waa_s_endpoint200_response'
|
|
88
91
|
require 'zyphr/models/get_waa_s_usage200_response'
|
data/spec/api/inbox_api_spec.rb
CHANGED
|
@@ -59,6 +59,18 @@ describe 'InboxApi' do
|
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
+
# unit tests for generate_subscriber_token
|
|
63
|
+
# Generate a subscriber token
|
|
64
|
+
# Generate a JWT token for client-side inbox authentication. This is a server-side call that requires your API key. Pass the returned token to `@zyphr/inbox-react`'s `<ZyphrProvider subscriberToken=\"...\">` or use it as `Authorization: Bearer <token>` for client-side inbox API calls and WebSocket connections. The token expires in 7 days.
|
|
65
|
+
# @param generate_subscriber_token_request
|
|
66
|
+
# @param [Hash] opts the optional parameters
|
|
67
|
+
# @return [GenerateSubscriberToken200Response]
|
|
68
|
+
describe 'generate_subscriber_token test' do
|
|
69
|
+
it 'should work' do
|
|
70
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
62
74
|
# unit tests for get_inbox_notification
|
|
63
75
|
# Get a notification
|
|
64
76
|
# Get a specific in-app notification by ID.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Zyphr API
|
|
3
|
+
|
|
4
|
+
#Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: support@zyphr.dev
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.12.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'spec_helper'
|
|
14
|
+
require 'json'
|
|
15
|
+
require 'date'
|
|
16
|
+
|
|
17
|
+
# Unit tests for Zyphr::GenerateSubscriberToken200ResponseData
|
|
18
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
|
19
|
+
# Please update as you see appropriate
|
|
20
|
+
describe Zyphr::GenerateSubscriberToken200ResponseData do
|
|
21
|
+
let(:instance) { Zyphr::GenerateSubscriberToken200ResponseData.new }
|
|
22
|
+
|
|
23
|
+
describe 'test an instance of GenerateSubscriberToken200ResponseData' do
|
|
24
|
+
it 'should create an instance of GenerateSubscriberToken200ResponseData' do
|
|
25
|
+
# uncomment below to test the instance creation
|
|
26
|
+
#expect(instance).to be_instance_of(Zyphr::GenerateSubscriberToken200ResponseData)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe 'test attribute "token"' 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
|
+
describe 'test attribute "subscriber_id"' do
|
|
37
|
+
it 'should work' do
|
|
38
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
describe 'test attribute "expires_in"' 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
|
+
|
|
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 ## 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::GenerateSubscriberToken200Response
|
|
18
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
|
19
|
+
# Please update as you see appropriate
|
|
20
|
+
describe Zyphr::GenerateSubscriberToken200Response do
|
|
21
|
+
let(:instance) { Zyphr::GenerateSubscriberToken200Response.new }
|
|
22
|
+
|
|
23
|
+
describe 'test an instance of GenerateSubscriberToken200Response' do
|
|
24
|
+
it 'should create an instance of GenerateSubscriberToken200Response' do
|
|
25
|
+
# uncomment below to test the instance creation
|
|
26
|
+
#expect(instance).to be_instance_of(Zyphr::GenerateSubscriberToken200Response)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe 'test attribute "data"' 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
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Zyphr API
|
|
3
|
+
|
|
4
|
+
#Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: support@zyphr.dev
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.12.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'spec_helper'
|
|
14
|
+
require 'json'
|
|
15
|
+
require 'date'
|
|
16
|
+
|
|
17
|
+
# Unit tests for Zyphr::GenerateSubscriberTokenRequest
|
|
18
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
|
19
|
+
# Please update as you see appropriate
|
|
20
|
+
describe Zyphr::GenerateSubscriberTokenRequest do
|
|
21
|
+
let(:instance) { Zyphr::GenerateSubscriberTokenRequest.new }
|
|
22
|
+
|
|
23
|
+
describe 'test an instance of GenerateSubscriberTokenRequest' do
|
|
24
|
+
it 'should create an instance of GenerateSubscriberTokenRequest' do
|
|
25
|
+
# uncomment below to test the instance creation
|
|
26
|
+
#expect(instance).to be_instance_of(Zyphr::GenerateSubscriberTokenRequest)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe 'test attribute "subscriber_id"' 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
|
+
describe 'test attribute "external_id"' do
|
|
37
|
+
it 'should work' do
|
|
38
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
data/zyphr.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Zyphr
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-04-
|
|
11
|
+
date: 2026-04-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -167,6 +167,9 @@ files:
|
|
|
167
167
|
- docs/EndUserDeleteResponse.md
|
|
168
168
|
- docs/EndUserDeleteResponseData.md
|
|
169
169
|
- docs/ForgotPasswordRequest.md
|
|
170
|
+
- docs/GenerateSubscriberToken200Response.md
|
|
171
|
+
- docs/GenerateSubscriberToken200ResponseData.md
|
|
172
|
+
- docs/GenerateSubscriberTokenRequest.md
|
|
170
173
|
- docs/GenerateWaaSPortalToken201Response.md
|
|
171
174
|
- docs/GetWaaSEndpoint200Response.md
|
|
172
175
|
- docs/GetWaaSUsage200Response.md
|
|
@@ -542,6 +545,9 @@ files:
|
|
|
542
545
|
- lib/zyphr/models/end_user_delete_response.rb
|
|
543
546
|
- lib/zyphr/models/end_user_delete_response_data.rb
|
|
544
547
|
- lib/zyphr/models/forgot_password_request.rb
|
|
548
|
+
- lib/zyphr/models/generate_subscriber_token200_response.rb
|
|
549
|
+
- lib/zyphr/models/generate_subscriber_token200_response_data.rb
|
|
550
|
+
- lib/zyphr/models/generate_subscriber_token_request.rb
|
|
545
551
|
- lib/zyphr/models/generate_waa_s_portal_token201_response.rb
|
|
546
552
|
- lib/zyphr/models/get_waa_s_endpoint200_response.rb
|
|
547
553
|
- lib/zyphr/models/get_waa_s_usage200_response.rb
|
|
@@ -899,6 +905,9 @@ files:
|
|
|
899
905
|
- spec/models/end_user_delete_response_data_spec.rb
|
|
900
906
|
- spec/models/end_user_delete_response_spec.rb
|
|
901
907
|
- spec/models/forgot_password_request_spec.rb
|
|
908
|
+
- spec/models/generate_subscriber_token200_response_data_spec.rb
|
|
909
|
+
- spec/models/generate_subscriber_token200_response_spec.rb
|
|
910
|
+
- spec/models/generate_subscriber_token_request_spec.rb
|
|
902
911
|
- spec/models/generate_waa_s_portal_token201_response_spec.rb
|
|
903
912
|
- spec/models/get_waa_s_endpoint200_response_spec.rb
|
|
904
913
|
- spec/models/get_waa_s_usage200_response_spec.rb
|
|
@@ -1249,6 +1258,7 @@ test_files:
|
|
|
1249
1258
|
- spec/models/send_email_verification_request_spec.rb
|
|
1250
1259
|
- spec/models/send_push_response_spec.rb
|
|
1251
1260
|
- spec/models/web_authn_credential_list_response_data_spec.rb
|
|
1261
|
+
- spec/models/generate_subscriber_token200_response_data_spec.rb
|
|
1252
1262
|
- spec/models/webhook_replay_response_spec.rb
|
|
1253
1263
|
- spec/models/topic_subscriber_spec.rb
|
|
1254
1264
|
- spec/models/verify_sms_config_data_spec.rb
|
|
@@ -1274,6 +1284,7 @@ test_files:
|
|
|
1274
1284
|
- spec/models/send_batch_sms_request_spec.rb
|
|
1275
1285
|
- spec/models/device_spec.rb
|
|
1276
1286
|
- spec/models/phone_otp_sent_response_spec.rb
|
|
1287
|
+
- spec/models/generate_subscriber_token200_response_spec.rb
|
|
1277
1288
|
- spec/models/create_waa_s_application_request_spec.rb
|
|
1278
1289
|
- spec/models/webhook_test_event_response_spec.rb
|
|
1279
1290
|
- spec/models/session_list_response_spec.rb
|
|
@@ -1391,6 +1402,7 @@ test_files:
|
|
|
1391
1402
|
- spec/models/create_waa_s_endpoint_request_spec.rb
|
|
1392
1403
|
- spec/models/test_webhook_transform_request_spec.rb
|
|
1393
1404
|
- spec/models/webhook_delivery_detail_spec.rb
|
|
1405
|
+
- spec/models/generate_subscriber_token_request_spec.rb
|
|
1394
1406
|
- spec/models/password_requirements_response_data_spec.rb
|
|
1395
1407
|
- spec/models/confirm_email_verification_response_spec.rb
|
|
1396
1408
|
- spec/models/unread_count_data_spec.rb
|