zyphr 0.1.74 → 0.1.76
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 +49 -1
- data/docs/CreateInboxLabelRequest.md +20 -0
- data/docs/Draft.md +36 -0
- data/docs/DraftAddress.md +20 -0
- data/docs/DraftListResponse.md +20 -0
- data/docs/DraftRequest.md +30 -0
- data/docs/DraftResponse.md +20 -0
- data/docs/ForwardEmailRequest.md +34 -0
- data/docs/InboundEmailApi.md +1855 -152
- data/docs/Inbox.md +3 -1
- data/docs/InboxLabel.md +26 -0
- data/docs/InboxLabelListResponse.md +20 -0
- data/docs/InboxLabelResponse.md +20 -0
- data/docs/InboxListResponse.md +1 -1
- data/docs/InboxListResponseMeta.md +22 -0
- data/docs/{ReplyToInboundEmailRequest.md → ReplyEmailRequest.md} +3 -3
- data/docs/Thread.md +40 -0
- data/docs/ThreadEmail.md +38 -0
- data/docs/ThreadEmailAttachmentsInner.md +24 -0
- data/docs/ThreadEmailFrom.md +20 -0
- data/docs/ThreadEmailListResponse.md +20 -0
- data/docs/ThreadEmailResponse.md +20 -0
- data/docs/ThreadFolder.md +15 -0
- data/docs/ThreadLabelsInner.md +22 -0
- data/docs/ThreadLabelsRequest.md +18 -0
- data/docs/ThreadListResponse.md +20 -0
- data/docs/ThreadListResponseMeta.md +20 -0
- data/docs/ThreadResponse.md +20 -0
- data/docs/UpdateInboxLabelRequest.md +20 -0
- data/docs/UpdateThreadRequest.md +22 -0
- data/lib/zyphr/api/inbound_email_api.rb +1774 -168
- data/lib/zyphr/models/create_inbox_label_request.rb +272 -0
- data/lib/zyphr/models/draft.rb +375 -0
- data/lib/zyphr/models/draft_address.rb +249 -0
- data/lib/zyphr/models/draft_list_response.rb +231 -0
- data/lib/zyphr/models/draft_request.rb +299 -0
- data/lib/zyphr/models/draft_response.rb +229 -0
- data/lib/zyphr/models/forward_email_request.rb +393 -0
- data/lib/zyphr/models/inbox.rb +14 -4
- data/lib/zyphr/models/inbox_label.rb +258 -0
- data/lib/zyphr/models/inbox_label_list_response.rb +231 -0
- data/lib/zyphr/models/inbox_label_response.rb +229 -0
- data/lib/zyphr/models/inbox_list_response.rb +1 -1
- data/lib/zyphr/models/inbox_list_response_meta.rb +246 -0
- data/lib/zyphr/models/{reply_to_inbound_email_request.rb → reply_email_request.rb} +4 -3
- data/lib/zyphr/models/thread.rb +352 -0
- data/lib/zyphr/models/thread_email.rb +353 -0
- data/lib/zyphr/models/thread_email_attachments_inner.rb +248 -0
- data/lib/zyphr/models/thread_email_from.rb +230 -0
- data/lib/zyphr/models/thread_email_list_response.rb +231 -0
- data/lib/zyphr/models/thread_email_response.rb +229 -0
- data/lib/zyphr/models/thread_folder.rb +43 -0
- data/lib/zyphr/models/thread_labels_inner.rb +239 -0
- data/lib/zyphr/models/thread_labels_request.rb +248 -0
- data/lib/zyphr/models/thread_list_response.rb +231 -0
- data/lib/zyphr/models/thread_list_response_meta.rb +237 -0
- data/lib/zyphr/models/thread_response.rb +229 -0
- data/lib/zyphr/models/update_inbox_label_request.rb +264 -0
- data/lib/zyphr/models/update_thread_request.rb +262 -0
- data/lib/zyphr.rb +26 -1
- data/spec/api/inbound_email_api_spec.rb +294 -1
- data/spec/models/create_inbox_label_request_spec.rb +42 -0
- data/spec/models/draft_address_spec.rb +42 -0
- data/spec/models/draft_list_response_spec.rb +42 -0
- data/spec/models/draft_request_spec.rb +72 -0
- data/spec/models/draft_response_spec.rb +42 -0
- data/spec/models/draft_spec.rb +90 -0
- data/spec/models/forward_email_request_spec.rb +88 -0
- data/spec/models/inbox_label_list_response_spec.rb +42 -0
- data/spec/models/inbox_label_response_spec.rb +42 -0
- data/spec/models/inbox_label_spec.rb +60 -0
- data/spec/models/inbox_list_response_meta_spec.rb +48 -0
- data/spec/models/inbox_spec.rb +6 -0
- data/spec/models/{reply_to_inbound_email_request_spec.rb → reply_email_request_spec.rb} +6 -6
- data/spec/models/thread_email_attachments_inner_spec.rb +54 -0
- data/spec/models/thread_email_from_spec.rb +42 -0
- data/spec/models/thread_email_list_response_spec.rb +42 -0
- data/spec/models/thread_email_response_spec.rb +42 -0
- data/spec/models/thread_email_spec.rb +100 -0
- data/spec/models/thread_folder_spec.rb +30 -0
- data/spec/models/thread_labels_inner_spec.rb +48 -0
- data/spec/models/thread_labels_request_spec.rb +36 -0
- data/spec/models/thread_list_response_meta_spec.rb +42 -0
- data/spec/models/thread_list_response_spec.rb +42 -0
- data/spec/models/thread_response_spec.rb +42 -0
- data/spec/models/thread_spec.rb +102 -0
- data/spec/models/update_inbox_label_request_spec.rb +42 -0
- data/spec/models/update_thread_request_spec.rb +48 -0
- data/zyphr.gemspec +1 -1
- metadata +106 -6
|
@@ -0,0 +1,393 @@
|
|
|
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
|
+
# Only these fields are accepted; anything else is a 400. Zyphr sets the subject and threading headers.
|
|
18
|
+
class ForwardEmailRequest
|
|
19
|
+
# Sender, on one of your verified sending domains. The API also accepts a plain email string for convenience.
|
|
20
|
+
attr_accessor :from
|
|
21
|
+
|
|
22
|
+
# Who to forward to: one recipient. A plain email string is also accepted.
|
|
23
|
+
attr_accessor :to
|
|
24
|
+
|
|
25
|
+
# Your note, above the forwarded email
|
|
26
|
+
attr_accessor :text
|
|
27
|
+
|
|
28
|
+
# Your note as HTML
|
|
29
|
+
attr_accessor :html
|
|
30
|
+
|
|
31
|
+
# Send the original attachments on (copied inside Zyphr). The whole email must fit the 10 MB email limit, so about 7 MB of attachments.
|
|
32
|
+
attr_accessor :include_attachments
|
|
33
|
+
|
|
34
|
+
# Defaults to the inbox address the email arrived at, so an answer comes back to Zyphr.
|
|
35
|
+
attr_accessor :reply_to
|
|
36
|
+
|
|
37
|
+
attr_accessor :tags
|
|
38
|
+
|
|
39
|
+
attr_accessor :metadata
|
|
40
|
+
|
|
41
|
+
attr_accessor :classification
|
|
42
|
+
|
|
43
|
+
class EnumAttributeValidator
|
|
44
|
+
attr_reader :datatype
|
|
45
|
+
attr_reader :allowable_values
|
|
46
|
+
|
|
47
|
+
def initialize(datatype, allowable_values)
|
|
48
|
+
@allowable_values = allowable_values.map do |value|
|
|
49
|
+
case datatype.to_s
|
|
50
|
+
when /Integer/i
|
|
51
|
+
value.to_i
|
|
52
|
+
when /Float/i
|
|
53
|
+
value.to_f
|
|
54
|
+
else
|
|
55
|
+
value
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def valid?(value)
|
|
61
|
+
!value || allowable_values.include?(value)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
66
|
+
def self.attribute_map
|
|
67
|
+
{
|
|
68
|
+
:'from' => :'from',
|
|
69
|
+
:'to' => :'to',
|
|
70
|
+
:'text' => :'text',
|
|
71
|
+
:'html' => :'html',
|
|
72
|
+
:'include_attachments' => :'include_attachments',
|
|
73
|
+
:'reply_to' => :'reply_to',
|
|
74
|
+
:'tags' => :'tags',
|
|
75
|
+
:'metadata' => :'metadata',
|
|
76
|
+
:'classification' => :'classification'
|
|
77
|
+
}
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Returns attribute mapping this model knows about
|
|
81
|
+
def self.acceptable_attribute_map
|
|
82
|
+
attribute_map
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Returns all the JSON keys this model knows about
|
|
86
|
+
def self.acceptable_attributes
|
|
87
|
+
acceptable_attribute_map.values
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Attribute type mapping.
|
|
91
|
+
def self.openapi_types
|
|
92
|
+
{
|
|
93
|
+
:'from' => :'EmailAddress',
|
|
94
|
+
:'to' => :'EmailAddress',
|
|
95
|
+
:'text' => :'String',
|
|
96
|
+
:'html' => :'String',
|
|
97
|
+
:'include_attachments' => :'Boolean',
|
|
98
|
+
:'reply_to' => :'String',
|
|
99
|
+
:'tags' => :'Array<String>',
|
|
100
|
+
:'metadata' => :'Hash<String, Object>',
|
|
101
|
+
:'classification' => :'String'
|
|
102
|
+
}
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# List of attributes with nullable: true
|
|
106
|
+
def self.openapi_nullable
|
|
107
|
+
Set.new([
|
|
108
|
+
:'classification'
|
|
109
|
+
])
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Initializes the object
|
|
113
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
114
|
+
def initialize(attributes = {})
|
|
115
|
+
if (!attributes.is_a?(Hash))
|
|
116
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::ForwardEmailRequest` initialize method"
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
120
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
121
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
122
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
123
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::ForwardEmailRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
124
|
+
end
|
|
125
|
+
h[k.to_sym] = v
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if attributes.key?(:'from')
|
|
129
|
+
self.from = attributes[:'from']
|
|
130
|
+
else
|
|
131
|
+
self.from = nil
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if attributes.key?(:'to')
|
|
135
|
+
self.to = attributes[:'to']
|
|
136
|
+
else
|
|
137
|
+
self.to = nil
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
if attributes.key?(:'text')
|
|
141
|
+
self.text = attributes[:'text']
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
if attributes.key?(:'html')
|
|
145
|
+
self.html = attributes[:'html']
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
if attributes.key?(:'include_attachments')
|
|
149
|
+
self.include_attachments = attributes[:'include_attachments']
|
|
150
|
+
else
|
|
151
|
+
self.include_attachments = true
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
if attributes.key?(:'reply_to')
|
|
155
|
+
self.reply_to = attributes[:'reply_to']
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
if attributes.key?(:'tags')
|
|
159
|
+
if (value = attributes[:'tags']).is_a?(Array)
|
|
160
|
+
self.tags = value
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
if attributes.key?(:'metadata')
|
|
165
|
+
if (value = attributes[:'metadata']).is_a?(Hash)
|
|
166
|
+
self.metadata = value
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
if attributes.key?(:'classification')
|
|
171
|
+
self.classification = attributes[:'classification']
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
176
|
+
# @return Array for valid properties with the reasons
|
|
177
|
+
def list_invalid_properties
|
|
178
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
179
|
+
invalid_properties = Array.new
|
|
180
|
+
if @from.nil?
|
|
181
|
+
invalid_properties.push('invalid value for "from", from cannot be nil.')
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
if @to.nil?
|
|
185
|
+
invalid_properties.push('invalid value for "to", to cannot be nil.')
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
if !@tags.nil? && @tags.length > 10
|
|
189
|
+
invalid_properties.push('invalid value for "tags", number of items must be less than or equal to 10.')
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
invalid_properties
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Check to see if the all the properties in the model are valid
|
|
196
|
+
# @return true if the model is valid
|
|
197
|
+
def valid?
|
|
198
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
199
|
+
return false if @from.nil?
|
|
200
|
+
return false if @to.nil?
|
|
201
|
+
return false if !@tags.nil? && @tags.length > 10
|
|
202
|
+
classification_validator = EnumAttributeValidator.new('String', ["transactional", "marketing"])
|
|
203
|
+
return false unless classification_validator.valid?(@classification)
|
|
204
|
+
true
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# Custom attribute writer method with validation
|
|
208
|
+
# @param [Object] from Value to be assigned
|
|
209
|
+
def from=(from)
|
|
210
|
+
if from.nil?
|
|
211
|
+
fail ArgumentError, 'from cannot be nil'
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
@from = from
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# Custom attribute writer method with validation
|
|
218
|
+
# @param [Object] to Value to be assigned
|
|
219
|
+
def to=(to)
|
|
220
|
+
if to.nil?
|
|
221
|
+
fail ArgumentError, 'to cannot be nil'
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
@to = to
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Custom attribute writer method with validation
|
|
228
|
+
# @param [Object] tags Value to be assigned
|
|
229
|
+
def tags=(tags)
|
|
230
|
+
if tags.nil?
|
|
231
|
+
fail ArgumentError, 'tags cannot be nil'
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
if tags.length > 10
|
|
235
|
+
fail ArgumentError, 'invalid value for "tags", number of items must be less than or equal to 10.'
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
@tags = tags
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
242
|
+
# @param [Object] classification Object to be assigned
|
|
243
|
+
def classification=(classification)
|
|
244
|
+
validator = EnumAttributeValidator.new('String', ["transactional", "marketing"])
|
|
245
|
+
unless validator.valid?(classification)
|
|
246
|
+
fail ArgumentError, "invalid value for \"classification\", must be one of #{validator.allowable_values}."
|
|
247
|
+
end
|
|
248
|
+
@classification = classification
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
# Checks equality by comparing each attribute.
|
|
252
|
+
# @param [Object] Object to be compared
|
|
253
|
+
def ==(o)
|
|
254
|
+
return true if self.equal?(o)
|
|
255
|
+
self.class == o.class &&
|
|
256
|
+
from == o.from &&
|
|
257
|
+
to == o.to &&
|
|
258
|
+
text == o.text &&
|
|
259
|
+
html == o.html &&
|
|
260
|
+
include_attachments == o.include_attachments &&
|
|
261
|
+
reply_to == o.reply_to &&
|
|
262
|
+
tags == o.tags &&
|
|
263
|
+
metadata == o.metadata &&
|
|
264
|
+
classification == o.classification
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
# @see the `==` method
|
|
268
|
+
# @param [Object] Object to be compared
|
|
269
|
+
def eql?(o)
|
|
270
|
+
self == o
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
# Calculates hash code according to all attributes.
|
|
274
|
+
# @return [Integer] Hash code
|
|
275
|
+
def hash
|
|
276
|
+
[from, to, text, html, include_attachments, reply_to, tags, metadata, classification].hash
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
# Builds the object from hash
|
|
280
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
281
|
+
# @return [Object] Returns the model itself
|
|
282
|
+
def self.build_from_hash(attributes)
|
|
283
|
+
return nil unless attributes.is_a?(Hash)
|
|
284
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
285
|
+
transformed_hash = {}
|
|
286
|
+
openapi_types.each_pair do |key, type|
|
|
287
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
288
|
+
transformed_hash["#{key}"] = nil
|
|
289
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
290
|
+
# check to ensure the input is an array given that the attribute
|
|
291
|
+
# is documented as an array but the input is not
|
|
292
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
293
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
294
|
+
end
|
|
295
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
296
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
297
|
+
end
|
|
298
|
+
end
|
|
299
|
+
new(transformed_hash)
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
# Deserializes the data based on type
|
|
303
|
+
# @param string type Data type
|
|
304
|
+
# @param string value Value to be deserialized
|
|
305
|
+
# @return [Object] Deserialized data
|
|
306
|
+
def self._deserialize(type, value)
|
|
307
|
+
case type.to_sym
|
|
308
|
+
when :Time
|
|
309
|
+
Time.parse(value)
|
|
310
|
+
when :Date
|
|
311
|
+
Date.parse(value)
|
|
312
|
+
when :String
|
|
313
|
+
value.to_s
|
|
314
|
+
when :Integer
|
|
315
|
+
value.to_i
|
|
316
|
+
when :Float
|
|
317
|
+
value.to_f
|
|
318
|
+
when :Boolean
|
|
319
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
320
|
+
true
|
|
321
|
+
else
|
|
322
|
+
false
|
|
323
|
+
end
|
|
324
|
+
when :Object
|
|
325
|
+
# generic object (usually a Hash), return directly
|
|
326
|
+
value
|
|
327
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
328
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
329
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
330
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
331
|
+
k_type = Regexp.last_match[:k_type]
|
|
332
|
+
v_type = Regexp.last_match[:v_type]
|
|
333
|
+
{}.tap do |hash|
|
|
334
|
+
value.each do |k, v|
|
|
335
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
336
|
+
end
|
|
337
|
+
end
|
|
338
|
+
else # model
|
|
339
|
+
# models (e.g. Pet) or oneOf
|
|
340
|
+
klass = Zyphr.const_get(type)
|
|
341
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
342
|
+
end
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
# Returns the string representation of the object
|
|
346
|
+
# @return [String] String presentation of the object
|
|
347
|
+
def to_s
|
|
348
|
+
to_hash.to_s
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
352
|
+
# @return [Hash] Returns the object in the form of hash
|
|
353
|
+
def to_body
|
|
354
|
+
to_hash
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
# Returns the object in the form of hash
|
|
358
|
+
# @return [Hash] Returns the object in the form of hash
|
|
359
|
+
def to_hash
|
|
360
|
+
hash = {}
|
|
361
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
362
|
+
value = self.send(attr)
|
|
363
|
+
if value.nil?
|
|
364
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
365
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
hash[param] = _to_hash(value)
|
|
369
|
+
end
|
|
370
|
+
hash
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
# Outputs non-array value in the form of hash
|
|
374
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
375
|
+
# @param [Object] value Any valid value
|
|
376
|
+
# @return [Hash] Returns the value in the form of hash
|
|
377
|
+
def _to_hash(value)
|
|
378
|
+
if value.is_a?(Array)
|
|
379
|
+
value.compact.map { |v| _to_hash(v) }
|
|
380
|
+
elsif value.is_a?(Hash)
|
|
381
|
+
{}.tap do |hash|
|
|
382
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
383
|
+
end
|
|
384
|
+
elsif value.respond_to? :to_hash
|
|
385
|
+
value.to_hash
|
|
386
|
+
else
|
|
387
|
+
value
|
|
388
|
+
end
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
end
|
data/lib/zyphr/models/inbox.rb
CHANGED
|
@@ -38,6 +38,9 @@ module Zyphr
|
|
|
38
38
|
|
|
39
39
|
attr_accessor :updated_at
|
|
40
40
|
|
|
41
|
+
# Delivered mail in this inbox. Only with `include_counts=true`.
|
|
42
|
+
attr_accessor :received_count
|
|
43
|
+
|
|
41
44
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
42
45
|
def self.attribute_map
|
|
43
46
|
{
|
|
@@ -49,7 +52,8 @@ module Zyphr
|
|
|
49
52
|
:'name' => :'name',
|
|
50
53
|
:'from_name' => :'from_name',
|
|
51
54
|
:'created_at' => :'created_at',
|
|
52
|
-
:'updated_at' => :'updated_at'
|
|
55
|
+
:'updated_at' => :'updated_at',
|
|
56
|
+
:'received_count' => :'received_count'
|
|
53
57
|
}
|
|
54
58
|
end
|
|
55
59
|
|
|
@@ -74,7 +78,8 @@ module Zyphr
|
|
|
74
78
|
:'name' => :'String',
|
|
75
79
|
:'from_name' => :'String',
|
|
76
80
|
:'created_at' => :'Time',
|
|
77
|
-
:'updated_at' => :'Time'
|
|
81
|
+
:'updated_at' => :'Time',
|
|
82
|
+
:'received_count' => :'Integer'
|
|
78
83
|
}
|
|
79
84
|
end
|
|
80
85
|
|
|
@@ -136,6 +141,10 @@ module Zyphr
|
|
|
136
141
|
if attributes.key?(:'updated_at')
|
|
137
142
|
self.updated_at = attributes[:'updated_at']
|
|
138
143
|
end
|
|
144
|
+
|
|
145
|
+
if attributes.key?(:'received_count')
|
|
146
|
+
self.received_count = attributes[:'received_count']
|
|
147
|
+
end
|
|
139
148
|
end
|
|
140
149
|
|
|
141
150
|
# Show invalid properties with the reasons. Usually used together with valid?
|
|
@@ -166,7 +175,8 @@ module Zyphr
|
|
|
166
175
|
name == o.name &&
|
|
167
176
|
from_name == o.from_name &&
|
|
168
177
|
created_at == o.created_at &&
|
|
169
|
-
updated_at == o.updated_at
|
|
178
|
+
updated_at == o.updated_at &&
|
|
179
|
+
received_count == o.received_count
|
|
170
180
|
end
|
|
171
181
|
|
|
172
182
|
# @see the `==` method
|
|
@@ -178,7 +188,7 @@ module Zyphr
|
|
|
178
188
|
# Calculates hash code according to all attributes.
|
|
179
189
|
# @return [Integer] Hash code
|
|
180
190
|
def hash
|
|
181
|
-
[id, email_address, is_catch_all, enabled, domain_id, name, from_name, created_at, updated_at].hash
|
|
191
|
+
[id, email_address, is_catch_all, enabled, domain_id, name, from_name, created_at, updated_at, received_count].hash
|
|
182
192
|
end
|
|
183
193
|
|
|
184
194
|
# Builds the object from hash
|