zyphr 0.1.71 → 0.1.72
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 +11 -0
- data/docs/CreateInboxRequest.md +24 -0
- data/docs/InboundEmail.md +2 -0
- data/docs/InboundEmailApi.md +432 -0
- data/docs/Inbox.md +30 -0
- data/docs/InboxResponse.md +20 -0
- data/docs/ReplyToInboundEmailRequest.md +34 -0
- data/docs/SendEmailRequest.md +4 -0
- data/docs/UpdateInboxRequest.md +20 -0
- data/lib/zyphr/api/inbound_email_api.rb +396 -0
- data/lib/zyphr/models/create_inbox_request.rb +328 -0
- data/lib/zyphr/models/inbound_email.rb +12 -1
- data/lib/zyphr/models/inbox.rb +278 -0
- data/lib/zyphr/models/inbox_response.rb +229 -0
- data/lib/zyphr/models/reply_to_inbound_email_request.rb +350 -0
- data/lib/zyphr/models/send_email_request.rb +61 -1
- data/lib/zyphr/models/update_inbox_request.rb +264 -0
- data/lib/zyphr.rb +5 -0
- data/spec/api/inbound_email_api_spec.rb +72 -0
- data/spec/models/create_inbox_request_spec.rb +54 -0
- data/spec/models/inbound_email_spec.rb +6 -0
- data/spec/models/inbox_response_spec.rb +42 -0
- data/spec/models/inbox_spec.rb +72 -0
- data/spec/models/reply_to_inbound_email_request_spec.rb +88 -0
- data/spec/models/send_email_request_spec.rb +12 -0
- data/spec/models/update_inbox_request_spec.rb +42 -0
- data/zyphr.gemspec +1 -1
- metadata +21 -1
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Zyphr API
|
|
3
|
+
|
|
4
|
+
#Zyphr is a developer platform for user authentication and transactional messaging. One API covers auth (passkeys, social sign-in, passwordless, MFA, sessions, organizations) plus email, push notifications, SMS, in-app messages, and webhooks. ## 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. > **Test keys are being retired.** `zy_test_*` keys are no longer issued, and existing ones stop working on **21 October 2026**. They never delivered mail — sends were mocked and marked sent without reaching a provider, so they could not verify domain authentication, rendering, or deliverability. To test your integration, use a `zy_live_*` key against a verified domain and send to an address you control. ## 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 InboxResponse
|
|
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' => :'Inbox',
|
|
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::InboxResponse` 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::InboxResponse`. 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
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Zyphr API
|
|
3
|
+
|
|
4
|
+
#Zyphr is a developer platform for user authentication and transactional messaging. One API covers auth (passkeys, social sign-in, passwordless, MFA, sessions, organizations) plus email, push notifications, SMS, in-app messages, and webhooks. ## 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. > **Test keys are being retired.** `zy_test_*` keys are no longer issued, and existing ones stop working on **21 October 2026**. They never delivered mail — sends were mocked and marked sent without reaching a provider, so they could not verify domain authentication, rendering, or deliverability. To test your integration, use a `zy_live_*` key against a verified domain and send to an address you control. ## 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 ReplyToInboundEmailRequest
|
|
18
|
+
# Sender, on one of your verified sending domains. The API also accepts a plain email string for convenience.
|
|
19
|
+
attr_accessor :from
|
|
20
|
+
|
|
21
|
+
attr_accessor :html
|
|
22
|
+
|
|
23
|
+
attr_accessor :text
|
|
24
|
+
|
|
25
|
+
attr_accessor :reply_to
|
|
26
|
+
|
|
27
|
+
attr_accessor :tags
|
|
28
|
+
|
|
29
|
+
attr_accessor :metadata
|
|
30
|
+
|
|
31
|
+
attr_accessor :classification
|
|
32
|
+
|
|
33
|
+
attr_accessor :send_at
|
|
34
|
+
|
|
35
|
+
# Seconds to wait before sending
|
|
36
|
+
attr_accessor :delay
|
|
37
|
+
|
|
38
|
+
class EnumAttributeValidator
|
|
39
|
+
attr_reader :datatype
|
|
40
|
+
attr_reader :allowable_values
|
|
41
|
+
|
|
42
|
+
def initialize(datatype, allowable_values)
|
|
43
|
+
@allowable_values = allowable_values.map do |value|
|
|
44
|
+
case datatype.to_s
|
|
45
|
+
when /Integer/i
|
|
46
|
+
value.to_i
|
|
47
|
+
when /Float/i
|
|
48
|
+
value.to_f
|
|
49
|
+
else
|
|
50
|
+
value
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def valid?(value)
|
|
56
|
+
!value || allowable_values.include?(value)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
61
|
+
def self.attribute_map
|
|
62
|
+
{
|
|
63
|
+
:'from' => :'from',
|
|
64
|
+
:'html' => :'html',
|
|
65
|
+
:'text' => :'text',
|
|
66
|
+
:'reply_to' => :'reply_to',
|
|
67
|
+
:'tags' => :'tags',
|
|
68
|
+
:'metadata' => :'metadata',
|
|
69
|
+
:'classification' => :'classification',
|
|
70
|
+
:'send_at' => :'send_at',
|
|
71
|
+
:'delay' => :'delay'
|
|
72
|
+
}
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Returns attribute mapping this model knows about
|
|
76
|
+
def self.acceptable_attribute_map
|
|
77
|
+
attribute_map
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Returns all the JSON keys this model knows about
|
|
81
|
+
def self.acceptable_attributes
|
|
82
|
+
acceptable_attribute_map.values
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Attribute type mapping.
|
|
86
|
+
def self.openapi_types
|
|
87
|
+
{
|
|
88
|
+
:'from' => :'EmailAddress',
|
|
89
|
+
:'html' => :'String',
|
|
90
|
+
:'text' => :'String',
|
|
91
|
+
:'reply_to' => :'String',
|
|
92
|
+
:'tags' => :'Array<String>',
|
|
93
|
+
:'metadata' => :'Hash<String, Object>',
|
|
94
|
+
:'classification' => :'String',
|
|
95
|
+
:'send_at' => :'Time',
|
|
96
|
+
:'delay' => :'Integer'
|
|
97
|
+
}
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# List of attributes with nullable: true
|
|
101
|
+
def self.openapi_nullable
|
|
102
|
+
Set.new([
|
|
103
|
+
:'classification',
|
|
104
|
+
])
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Initializes the object
|
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
109
|
+
def initialize(attributes = {})
|
|
110
|
+
if (!attributes.is_a?(Hash))
|
|
111
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::ReplyToInboundEmailRequest` initialize method"
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
115
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
116
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
117
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
118
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::ReplyToInboundEmailRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
119
|
+
end
|
|
120
|
+
h[k.to_sym] = v
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if attributes.key?(:'from')
|
|
124
|
+
self.from = attributes[:'from']
|
|
125
|
+
else
|
|
126
|
+
self.from = nil
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
if attributes.key?(:'html')
|
|
130
|
+
self.html = attributes[:'html']
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
if attributes.key?(:'text')
|
|
134
|
+
self.text = attributes[:'text']
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
if attributes.key?(:'reply_to')
|
|
138
|
+
self.reply_to = attributes[:'reply_to']
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
if attributes.key?(:'tags')
|
|
142
|
+
if (value = attributes[:'tags']).is_a?(Array)
|
|
143
|
+
self.tags = value
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
if attributes.key?(:'metadata')
|
|
148
|
+
if (value = attributes[:'metadata']).is_a?(Hash)
|
|
149
|
+
self.metadata = value
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if attributes.key?(:'classification')
|
|
154
|
+
self.classification = attributes[:'classification']
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if attributes.key?(:'send_at')
|
|
158
|
+
self.send_at = attributes[:'send_at']
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if attributes.key?(:'delay')
|
|
162
|
+
self.delay = attributes[:'delay']
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
167
|
+
# @return Array for valid properties with the reasons
|
|
168
|
+
def list_invalid_properties
|
|
169
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
170
|
+
invalid_properties = Array.new
|
|
171
|
+
if @from.nil?
|
|
172
|
+
invalid_properties.push('invalid value for "from", from cannot be nil.')
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
invalid_properties
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Check to see if the all the properties in the model are valid
|
|
179
|
+
# @return true if the model is valid
|
|
180
|
+
def valid?
|
|
181
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
182
|
+
return false if @from.nil?
|
|
183
|
+
classification_validator = EnumAttributeValidator.new('String', ["transactional", "marketing"])
|
|
184
|
+
return false unless classification_validator.valid?(@classification)
|
|
185
|
+
true
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# Custom attribute writer method with validation
|
|
189
|
+
# @param [Object] from Value to be assigned
|
|
190
|
+
def from=(from)
|
|
191
|
+
if from.nil?
|
|
192
|
+
fail ArgumentError, 'from cannot be nil'
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
@from = from
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
199
|
+
# @param [Object] classification Object to be assigned
|
|
200
|
+
def classification=(classification)
|
|
201
|
+
validator = EnumAttributeValidator.new('String', ["transactional", "marketing"])
|
|
202
|
+
unless validator.valid?(classification)
|
|
203
|
+
fail ArgumentError, "invalid value for \"classification\", must be one of #{validator.allowable_values}."
|
|
204
|
+
end
|
|
205
|
+
@classification = classification
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# Checks equality by comparing each attribute.
|
|
209
|
+
# @param [Object] Object to be compared
|
|
210
|
+
def ==(o)
|
|
211
|
+
return true if self.equal?(o)
|
|
212
|
+
self.class == o.class &&
|
|
213
|
+
from == o.from &&
|
|
214
|
+
html == o.html &&
|
|
215
|
+
text == o.text &&
|
|
216
|
+
reply_to == o.reply_to &&
|
|
217
|
+
tags == o.tags &&
|
|
218
|
+
metadata == o.metadata &&
|
|
219
|
+
classification == o.classification &&
|
|
220
|
+
send_at == o.send_at &&
|
|
221
|
+
delay == o.delay
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# @see the `==` method
|
|
225
|
+
# @param [Object] Object to be compared
|
|
226
|
+
def eql?(o)
|
|
227
|
+
self == o
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# Calculates hash code according to all attributes.
|
|
231
|
+
# @return [Integer] Hash code
|
|
232
|
+
def hash
|
|
233
|
+
[from, html, text, reply_to, tags, metadata, classification, send_at, delay].hash
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
# Builds the object from hash
|
|
237
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
238
|
+
# @return [Object] Returns the model itself
|
|
239
|
+
def self.build_from_hash(attributes)
|
|
240
|
+
return nil unless attributes.is_a?(Hash)
|
|
241
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
242
|
+
transformed_hash = {}
|
|
243
|
+
openapi_types.each_pair do |key, type|
|
|
244
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
245
|
+
transformed_hash["#{key}"] = nil
|
|
246
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
247
|
+
# check to ensure the input is an array given that the attribute
|
|
248
|
+
# is documented as an array but the input is not
|
|
249
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
250
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
251
|
+
end
|
|
252
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
253
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
new(transformed_hash)
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# Deserializes the data based on type
|
|
260
|
+
# @param string type Data type
|
|
261
|
+
# @param string value Value to be deserialized
|
|
262
|
+
# @return [Object] Deserialized data
|
|
263
|
+
def self._deserialize(type, value)
|
|
264
|
+
case type.to_sym
|
|
265
|
+
when :Time
|
|
266
|
+
Time.parse(value)
|
|
267
|
+
when :Date
|
|
268
|
+
Date.parse(value)
|
|
269
|
+
when :String
|
|
270
|
+
value.to_s
|
|
271
|
+
when :Integer
|
|
272
|
+
value.to_i
|
|
273
|
+
when :Float
|
|
274
|
+
value.to_f
|
|
275
|
+
when :Boolean
|
|
276
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
277
|
+
true
|
|
278
|
+
else
|
|
279
|
+
false
|
|
280
|
+
end
|
|
281
|
+
when :Object
|
|
282
|
+
# generic object (usually a Hash), return directly
|
|
283
|
+
value
|
|
284
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
285
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
286
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
287
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
288
|
+
k_type = Regexp.last_match[:k_type]
|
|
289
|
+
v_type = Regexp.last_match[:v_type]
|
|
290
|
+
{}.tap do |hash|
|
|
291
|
+
value.each do |k, v|
|
|
292
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
293
|
+
end
|
|
294
|
+
end
|
|
295
|
+
else # model
|
|
296
|
+
# models (e.g. Pet) or oneOf
|
|
297
|
+
klass = Zyphr.const_get(type)
|
|
298
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
299
|
+
end
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
# Returns the string representation of the object
|
|
303
|
+
# @return [String] String presentation of the object
|
|
304
|
+
def to_s
|
|
305
|
+
to_hash.to_s
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
309
|
+
# @return [Hash] Returns the object in the form of hash
|
|
310
|
+
def to_body
|
|
311
|
+
to_hash
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
# Returns the object in the form of hash
|
|
315
|
+
# @return [Hash] Returns the object in the form of hash
|
|
316
|
+
def to_hash
|
|
317
|
+
hash = {}
|
|
318
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
319
|
+
value = self.send(attr)
|
|
320
|
+
if value.nil?
|
|
321
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
322
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
hash[param] = _to_hash(value)
|
|
326
|
+
end
|
|
327
|
+
hash
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
# Outputs non-array value in the form of hash
|
|
331
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
332
|
+
# @param [Object] value Any valid value
|
|
333
|
+
# @return [Hash] Returns the value in the form of hash
|
|
334
|
+
def _to_hash(value)
|
|
335
|
+
if value.is_a?(Array)
|
|
336
|
+
value.compact.map { |v| _to_hash(v) }
|
|
337
|
+
elsif value.is_a?(Hash)
|
|
338
|
+
{}.tap do |hash|
|
|
339
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
340
|
+
end
|
|
341
|
+
elsif value.respond_to? :to_hash
|
|
342
|
+
value.to_hash
|
|
343
|
+
else
|
|
344
|
+
value
|
|
345
|
+
end
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
end
|
|
@@ -24,6 +24,12 @@ module Zyphr
|
|
|
24
24
|
# Reply-to address. The API also accepts a plain email string for convenience.
|
|
25
25
|
attr_accessor :reply_to
|
|
26
26
|
|
|
27
|
+
# RFC 5322 Message-ID of the email this one replies to, e.g. `<abc@example.com>`. Sets the `In-Reply-To` header so the reply threads in the recipient's mail client. To reply to a received email, `POST /inbound-emails/{id}/reply` sets this for you.
|
|
28
|
+
attr_accessor :in_reply_to
|
|
29
|
+
|
|
30
|
+
# RFC 5322 Message-IDs of the thread, oldest first. Sets the `References` header.
|
|
31
|
+
attr_accessor :references
|
|
32
|
+
|
|
27
33
|
# CC recipient email address(es).
|
|
28
34
|
attr_accessor :cc
|
|
29
35
|
|
|
@@ -65,6 +71,8 @@ module Zyphr
|
|
|
65
71
|
:'to' => :'to',
|
|
66
72
|
:'from' => :'from',
|
|
67
73
|
:'reply_to' => :'reply_to',
|
|
74
|
+
:'in_reply_to' => :'in_reply_to',
|
|
75
|
+
:'references' => :'references',
|
|
68
76
|
:'cc' => :'cc',
|
|
69
77
|
:'bcc' => :'bcc',
|
|
70
78
|
:'subject' => :'subject',
|
|
@@ -98,6 +106,8 @@ module Zyphr
|
|
|
98
106
|
:'to' => :'Array<EmailAddress>',
|
|
99
107
|
:'from' => :'EmailAddress',
|
|
100
108
|
:'reply_to' => :'EmailAddress',
|
|
109
|
+
:'in_reply_to' => :'String',
|
|
110
|
+
:'references' => :'Array<String>',
|
|
101
111
|
:'cc' => :'Array<String>',
|
|
102
112
|
:'bcc' => :'Array<String>',
|
|
103
113
|
:'subject' => :'String',
|
|
@@ -153,6 +163,16 @@ module Zyphr
|
|
|
153
163
|
self.reply_to = attributes[:'reply_to']
|
|
154
164
|
end
|
|
155
165
|
|
|
166
|
+
if attributes.key?(:'in_reply_to')
|
|
167
|
+
self.in_reply_to = attributes[:'in_reply_to']
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
if attributes.key?(:'references')
|
|
171
|
+
if (value = attributes[:'references']).is_a?(Array)
|
|
172
|
+
self.references = value
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
156
176
|
if attributes.key?(:'cc')
|
|
157
177
|
if (value = attributes[:'cc']).is_a?(Array)
|
|
158
178
|
self.cc = value
|
|
@@ -235,6 +255,14 @@ module Zyphr
|
|
|
235
255
|
invalid_properties.push('invalid value for "to", to cannot be nil.')
|
|
236
256
|
end
|
|
237
257
|
|
|
258
|
+
if !@in_reply_to.nil? && @in_reply_to.to_s.length > 985
|
|
259
|
+
invalid_properties.push('invalid value for "in_reply_to", the character length must be smaller than or equal to 985.')
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
if !@references.nil? && @references.length > 50
|
|
263
|
+
invalid_properties.push('invalid value for "references", number of items must be less than or equal to 50.')
|
|
264
|
+
end
|
|
265
|
+
|
|
238
266
|
if @subject.nil?
|
|
239
267
|
invalid_properties.push('invalid value for "subject", subject cannot be nil.')
|
|
240
268
|
end
|
|
@@ -247,6 +275,8 @@ module Zyphr
|
|
|
247
275
|
def valid?
|
|
248
276
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
249
277
|
return false if @to.nil?
|
|
278
|
+
return false if !@in_reply_to.nil? && @in_reply_to.to_s.length > 985
|
|
279
|
+
return false if !@references.nil? && @references.length > 50
|
|
250
280
|
return false if @subject.nil?
|
|
251
281
|
true
|
|
252
282
|
end
|
|
@@ -261,6 +291,34 @@ module Zyphr
|
|
|
261
291
|
@to = to
|
|
262
292
|
end
|
|
263
293
|
|
|
294
|
+
# Custom attribute writer method with validation
|
|
295
|
+
# @param [Object] in_reply_to Value to be assigned
|
|
296
|
+
def in_reply_to=(in_reply_to)
|
|
297
|
+
if in_reply_to.nil?
|
|
298
|
+
fail ArgumentError, 'in_reply_to cannot be nil'
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
if in_reply_to.to_s.length > 985
|
|
302
|
+
fail ArgumentError, 'invalid value for "in_reply_to", the character length must be smaller than or equal to 985.'
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
@in_reply_to = in_reply_to
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
# Custom attribute writer method with validation
|
|
309
|
+
# @param [Object] references Value to be assigned
|
|
310
|
+
def references=(references)
|
|
311
|
+
if references.nil?
|
|
312
|
+
fail ArgumentError, 'references cannot be nil'
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
if references.length > 50
|
|
316
|
+
fail ArgumentError, 'invalid value for "references", number of items must be less than or equal to 50.'
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
@references = references
|
|
320
|
+
end
|
|
321
|
+
|
|
264
322
|
# Custom attribute writer method with validation
|
|
265
323
|
# @param [Object] subject Value to be assigned
|
|
266
324
|
def subject=(subject)
|
|
@@ -279,6 +337,8 @@ module Zyphr
|
|
|
279
337
|
to == o.to &&
|
|
280
338
|
from == o.from &&
|
|
281
339
|
reply_to == o.reply_to &&
|
|
340
|
+
in_reply_to == o.in_reply_to &&
|
|
341
|
+
references == o.references &&
|
|
282
342
|
cc == o.cc &&
|
|
283
343
|
bcc == o.bcc &&
|
|
284
344
|
subject == o.subject &&
|
|
@@ -304,7 +364,7 @@ module Zyphr
|
|
|
304
364
|
# Calculates hash code according to all attributes.
|
|
305
365
|
# @return [Integer] Hash code
|
|
306
366
|
def hash
|
|
307
|
-
[to, from, reply_to, cc, bcc, subject, html, text, template_id, template_data, attachments, headers, tags, metadata, scheduled_at, subscriber_id, category].hash
|
|
367
|
+
[to, from, reply_to, in_reply_to, references, cc, bcc, subject, html, text, template_id, template_data, attachments, headers, tags, metadata, scheduled_at, subscriber_id, category].hash
|
|
308
368
|
end
|
|
309
369
|
|
|
310
370
|
# Builds the object from hash
|