zyphr 0.1.26 → 0.1.28

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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -0
  3. data/docs/AddDomain200Response.md +20 -0
  4. data/docs/AddDomain200ResponseMeta.md +20 -0
  5. data/docs/AddDomainRequest.md +18 -0
  6. data/docs/DeleteDomainResponse.md +20 -0
  7. data/docs/DeleteDomainResponseData.md +20 -0
  8. data/docs/DnsRecord.md +26 -0
  9. data/docs/DomainListResponse.md +20 -0
  10. data/docs/DomainListResponseMeta.md +24 -0
  11. data/docs/DomainResponse.md +38 -0
  12. data/docs/DomainsApi.md +436 -0
  13. data/docs/GetDomain200Response.md +20 -0
  14. data/docs/GetDomain200ResponseMeta.md +18 -0
  15. data/docs/VerificationStatusResponse.md +20 -0
  16. data/docs/VerificationStatusResponseData.md +32 -0
  17. data/docs/VerifyDomainResponse.md +20 -0
  18. data/docs/VerifyDomainResponseData.md +24 -0
  19. data/lib/zyphr/api/domains_api.rb +399 -0
  20. data/lib/zyphr/models/add_domain200_response.rb +229 -0
  21. data/lib/zyphr/models/add_domain200_response_meta.rb +229 -0
  22. data/lib/zyphr/models/add_domain_request.rb +238 -0
  23. data/lib/zyphr/models/delete_domain_response.rb +263 -0
  24. data/lib/zyphr/models/delete_domain_response_data.rb +263 -0
  25. data/lib/zyphr/models/dns_record.rb +373 -0
  26. data/lib/zyphr/models/domain_list_response.rb +265 -0
  27. data/lib/zyphr/models/domain_list_response_meta.rb +249 -0
  28. data/lib/zyphr/models/domain_response.rb +463 -0
  29. data/lib/zyphr/models/get_domain200_response.rb +229 -0
  30. data/lib/zyphr/models/get_domain200_response_meta.rb +220 -0
  31. data/lib/zyphr/models/verification_status_response.rb +263 -0
  32. data/lib/zyphr/models/verification_status_response_data.rb +415 -0
  33. data/lib/zyphr/models/verify_domain_response.rb +263 -0
  34. data/lib/zyphr/models/verify_domain_response_data.rb +339 -0
  35. data/lib/zyphr.rb +16 -0
  36. data/spec/api/domains_api_spec.rb +106 -0
  37. data/spec/models/add_domain200_response_meta_spec.rb +42 -0
  38. data/spec/models/add_domain200_response_spec.rb +42 -0
  39. data/spec/models/add_domain_request_spec.rb +36 -0
  40. data/spec/models/delete_domain_response_data_spec.rb +42 -0
  41. data/spec/models/delete_domain_response_spec.rb +42 -0
  42. data/spec/models/dns_record_spec.rb +68 -0
  43. data/spec/models/domain_list_response_meta_spec.rb +54 -0
  44. data/spec/models/domain_list_response_spec.rb +42 -0
  45. data/spec/models/domain_response_spec.rb +100 -0
  46. data/spec/models/get_domain200_response_meta_spec.rb +36 -0
  47. data/spec/models/get_domain200_response_spec.rb +42 -0
  48. data/spec/models/verification_status_response_data_spec.rb +82 -0
  49. data/spec/models/verification_status_response_spec.rb +42 -0
  50. data/spec/models/verify_domain_response_data_spec.rb +58 -0
  51. data/spec/models/verify_domain_response_spec.rb +42 -0
  52. data/zyphr.gemspec +1 -1
  53. metadata +435 -371
@@ -0,0 +1,249 @@
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 DomainListResponseMeta
18
+ attr_accessor :request_id
19
+
20
+ # Account-wide domain count (across all projects)
21
+ attr_accessor :count
22
+
23
+ # Per-account domain limit from the current plan
24
+ attr_accessor :limit
25
+
26
+ attr_accessor :plan
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'request_id' => :'request_id',
32
+ :'count' => :'count',
33
+ :'limit' => :'limit',
34
+ :'plan' => :'plan'
35
+ }
36
+ end
37
+
38
+ # Returns attribute mapping this model knows about
39
+ def self.acceptable_attribute_map
40
+ attribute_map
41
+ end
42
+
43
+ # Returns all the JSON keys this model knows about
44
+ def self.acceptable_attributes
45
+ acceptable_attribute_map.values
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.openapi_types
50
+ {
51
+ :'request_id' => :'String',
52
+ :'count' => :'Integer',
53
+ :'limit' => :'Integer',
54
+ :'plan' => :'String'
55
+ }
56
+ end
57
+
58
+ # List of attributes with nullable: true
59
+ def self.openapi_nullable
60
+ Set.new([
61
+ ])
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ if (!attributes.is_a?(Hash))
68
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::DomainListResponseMeta` initialize method"
69
+ end
70
+
71
+ # check to see if the attribute exists and convert string to symbol for hash key
72
+ acceptable_attribute_map = self.class.acceptable_attribute_map
73
+ attributes = attributes.each_with_object({}) { |(k, v), h|
74
+ if (!acceptable_attribute_map.key?(k.to_sym))
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::DomainListResponseMeta`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
76
+ end
77
+ h[k.to_sym] = v
78
+ }
79
+
80
+ if attributes.key?(:'request_id')
81
+ self.request_id = attributes[:'request_id']
82
+ end
83
+
84
+ if attributes.key?(:'count')
85
+ self.count = attributes[:'count']
86
+ end
87
+
88
+ if attributes.key?(:'limit')
89
+ self.limit = attributes[:'limit']
90
+ end
91
+
92
+ if attributes.key?(:'plan')
93
+ self.plan = attributes[:'plan']
94
+ end
95
+ end
96
+
97
+ # Show invalid properties with the reasons. Usually used together with valid?
98
+ # @return Array for valid properties with the reasons
99
+ def list_invalid_properties
100
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
101
+ invalid_properties = Array.new
102
+ invalid_properties
103
+ end
104
+
105
+ # Check to see if the all the properties in the model are valid
106
+ # @return true if the model is valid
107
+ def valid?
108
+ warn '[DEPRECATED] the `valid?` method is obsolete'
109
+ true
110
+ end
111
+
112
+ # Checks equality by comparing each attribute.
113
+ # @param [Object] Object to be compared
114
+ def ==(o)
115
+ return true if self.equal?(o)
116
+ self.class == o.class &&
117
+ request_id == o.request_id &&
118
+ count == o.count &&
119
+ limit == o.limit &&
120
+ plan == o.plan
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] Object to be compared
125
+ def eql?(o)
126
+ self == o
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Integer] Hash code
131
+ def hash
132
+ [request_id, count, limit, plan].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def self.build_from_hash(attributes)
139
+ return nil unless attributes.is_a?(Hash)
140
+ attributes = attributes.transform_keys(&:to_sym)
141
+ transformed_hash = {}
142
+ openapi_types.each_pair do |key, type|
143
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
144
+ transformed_hash["#{key}"] = nil
145
+ elsif type =~ /\AArray<(.*)>/i
146
+ # check to ensure the input is an array given that the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[attribute_map[key]].is_a?(Array)
149
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
150
+ end
151
+ elsif !attributes[attribute_map[key]].nil?
152
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
153
+ end
154
+ end
155
+ new(transformed_hash)
156
+ end
157
+
158
+ # Deserializes the data based on type
159
+ # @param string type Data type
160
+ # @param string value Value to be deserialized
161
+ # @return [Object] Deserialized data
162
+ def self._deserialize(type, value)
163
+ case type.to_sym
164
+ when :Time
165
+ Time.parse(value)
166
+ when :Date
167
+ Date.parse(value)
168
+ when :String
169
+ value.to_s
170
+ when :Integer
171
+ value.to_i
172
+ when :Float
173
+ value.to_f
174
+ when :Boolean
175
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
176
+ true
177
+ else
178
+ false
179
+ end
180
+ when :Object
181
+ # generic object (usually a Hash), return directly
182
+ value
183
+ when /\AArray<(?<inner_type>.+)>\z/
184
+ inner_type = Regexp.last_match[:inner_type]
185
+ value.map { |v| _deserialize(inner_type, v) }
186
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
187
+ k_type = Regexp.last_match[:k_type]
188
+ v_type = Regexp.last_match[:v_type]
189
+ {}.tap do |hash|
190
+ value.each do |k, v|
191
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
192
+ end
193
+ end
194
+ else # model
195
+ # models (e.g. Pet) or oneOf
196
+ klass = Zyphr.const_get(type)
197
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
198
+ end
199
+ end
200
+
201
+ # Returns the string representation of the object
202
+ # @return [String] String presentation of the object
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # to_body is an alias to to_hash (backward compatibility)
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_body
210
+ to_hash
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.openapi_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Outputs non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ # @param [Object] value Any valid value
232
+ # @return [Hash] Returns the value in the form of hash
233
+ def _to_hash(value)
234
+ if value.is_a?(Array)
235
+ value.compact.map { |v| _to_hash(v) }
236
+ elsif value.is_a?(Hash)
237
+ {}.tap do |hash|
238
+ value.each { |k, v| hash[k] = _to_hash(v) }
239
+ end
240
+ elsif value.respond_to? :to_hash
241
+ value.to_hash
242
+ else
243
+ value
244
+ end
245
+ end
246
+
247
+ end
248
+
249
+ end
@@ -0,0 +1,463 @@
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 DomainResponse
18
+ attr_accessor :id
19
+
20
+ # The sending domain
21
+ attr_accessor :domain
22
+
23
+ attr_accessor :status
24
+
25
+ attr_accessor :dns_records
26
+
27
+ # Count of `dns_records[]` entries with `verified=true`
28
+ attr_accessor :records_verified
29
+
30
+ # Total entries in `dns_records[]`
31
+ attr_accessor :records_total
32
+
33
+ # Token used for the verification TXT record (also visible in `dns_records[]`)
34
+ attr_accessor :verification_token
35
+
36
+ # Timestamp when verification first succeeded
37
+ attr_accessor :verified_at
38
+
39
+ # Timestamp of the most recent verification attempt
40
+ attr_accessor :last_checked_at
41
+
42
+ attr_accessor :created_at
43
+
44
+ attr_accessor :updated_at
45
+
46
+ class EnumAttributeValidator
47
+ attr_reader :datatype
48
+ attr_reader :allowable_values
49
+
50
+ def initialize(datatype, allowable_values)
51
+ @allowable_values = allowable_values.map do |value|
52
+ case datatype.to_s
53
+ when /Integer/i
54
+ value.to_i
55
+ when /Float/i
56
+ value.to_f
57
+ else
58
+ value
59
+ end
60
+ end
61
+ end
62
+
63
+ def valid?(value)
64
+ !value || allowable_values.include?(value)
65
+ end
66
+ end
67
+
68
+ # Attribute mapping from ruby-style variable name to JSON key.
69
+ def self.attribute_map
70
+ {
71
+ :'id' => :'id',
72
+ :'domain' => :'domain',
73
+ :'status' => :'status',
74
+ :'dns_records' => :'dns_records',
75
+ :'records_verified' => :'records_verified',
76
+ :'records_total' => :'records_total',
77
+ :'verification_token' => :'verification_token',
78
+ :'verified_at' => :'verified_at',
79
+ :'last_checked_at' => :'last_checked_at',
80
+ :'created_at' => :'created_at',
81
+ :'updated_at' => :'updated_at'
82
+ }
83
+ end
84
+
85
+ # Returns attribute mapping this model knows about
86
+ def self.acceptable_attribute_map
87
+ attribute_map
88
+ end
89
+
90
+ # Returns all the JSON keys this model knows about
91
+ def self.acceptable_attributes
92
+ acceptable_attribute_map.values
93
+ end
94
+
95
+ # Attribute type mapping.
96
+ def self.openapi_types
97
+ {
98
+ :'id' => :'String',
99
+ :'domain' => :'String',
100
+ :'status' => :'String',
101
+ :'dns_records' => :'Array<DnsRecord>',
102
+ :'records_verified' => :'Integer',
103
+ :'records_total' => :'Integer',
104
+ :'verification_token' => :'String',
105
+ :'verified_at' => :'Time',
106
+ :'last_checked_at' => :'Time',
107
+ :'created_at' => :'Time',
108
+ :'updated_at' => :'Time'
109
+ }
110
+ end
111
+
112
+ # List of attributes with nullable: true
113
+ def self.openapi_nullable
114
+ Set.new([
115
+ :'verified_at',
116
+ :'last_checked_at',
117
+ ])
118
+ end
119
+
120
+ # Initializes the object
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ def initialize(attributes = {})
123
+ if (!attributes.is_a?(Hash))
124
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::DomainResponse` initialize method"
125
+ end
126
+
127
+ # check to see if the attribute exists and convert string to symbol for hash key
128
+ acceptable_attribute_map = self.class.acceptable_attribute_map
129
+ attributes = attributes.each_with_object({}) { |(k, v), h|
130
+ if (!acceptable_attribute_map.key?(k.to_sym))
131
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::DomainResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
132
+ end
133
+ h[k.to_sym] = v
134
+ }
135
+
136
+ if attributes.key?(:'id')
137
+ self.id = attributes[:'id']
138
+ else
139
+ self.id = nil
140
+ end
141
+
142
+ if attributes.key?(:'domain')
143
+ self.domain = attributes[:'domain']
144
+ else
145
+ self.domain = nil
146
+ end
147
+
148
+ if attributes.key?(:'status')
149
+ self.status = attributes[:'status']
150
+ else
151
+ self.status = nil
152
+ end
153
+
154
+ if attributes.key?(:'dns_records')
155
+ if (value = attributes[:'dns_records']).is_a?(Array)
156
+ self.dns_records = value
157
+ end
158
+ else
159
+ self.dns_records = nil
160
+ end
161
+
162
+ if attributes.key?(:'records_verified')
163
+ self.records_verified = attributes[:'records_verified']
164
+ else
165
+ self.records_verified = nil
166
+ end
167
+
168
+ if attributes.key?(:'records_total')
169
+ self.records_total = attributes[:'records_total']
170
+ else
171
+ self.records_total = nil
172
+ end
173
+
174
+ if attributes.key?(:'verification_token')
175
+ self.verification_token = attributes[:'verification_token']
176
+ end
177
+
178
+ if attributes.key?(:'verified_at')
179
+ self.verified_at = attributes[:'verified_at']
180
+ end
181
+
182
+ if attributes.key?(:'last_checked_at')
183
+ self.last_checked_at = attributes[:'last_checked_at']
184
+ end
185
+
186
+ if attributes.key?(:'created_at')
187
+ self.created_at = attributes[:'created_at']
188
+ else
189
+ self.created_at = nil
190
+ end
191
+
192
+ if attributes.key?(:'updated_at')
193
+ self.updated_at = attributes[:'updated_at']
194
+ end
195
+ end
196
+
197
+ # Show invalid properties with the reasons. Usually used together with valid?
198
+ # @return Array for valid properties with the reasons
199
+ def list_invalid_properties
200
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
201
+ invalid_properties = Array.new
202
+ if @id.nil?
203
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
204
+ end
205
+
206
+ if @domain.nil?
207
+ invalid_properties.push('invalid value for "domain", domain cannot be nil.')
208
+ end
209
+
210
+ if @status.nil?
211
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
212
+ end
213
+
214
+ if @dns_records.nil?
215
+ invalid_properties.push('invalid value for "dns_records", dns_records cannot be nil.')
216
+ end
217
+
218
+ if @records_verified.nil?
219
+ invalid_properties.push('invalid value for "records_verified", records_verified cannot be nil.')
220
+ end
221
+
222
+ if @records_total.nil?
223
+ invalid_properties.push('invalid value for "records_total", records_total cannot be nil.')
224
+ end
225
+
226
+ if @created_at.nil?
227
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
228
+ end
229
+
230
+ invalid_properties
231
+ end
232
+
233
+ # Check to see if the all the properties in the model are valid
234
+ # @return true if the model is valid
235
+ def valid?
236
+ warn '[DEPRECATED] the `valid?` method is obsolete'
237
+ return false if @id.nil?
238
+ return false if @domain.nil?
239
+ return false if @status.nil?
240
+ status_validator = EnumAttributeValidator.new('String', ["pending", "verifying", "verified", "failed"])
241
+ return false unless status_validator.valid?(@status)
242
+ return false if @dns_records.nil?
243
+ return false if @records_verified.nil?
244
+ return false if @records_total.nil?
245
+ return false if @created_at.nil?
246
+ true
247
+ end
248
+
249
+ # Custom attribute writer method with validation
250
+ # @param [Object] id Value to be assigned
251
+ def id=(id)
252
+ if id.nil?
253
+ fail ArgumentError, 'id cannot be nil'
254
+ end
255
+
256
+ @id = id
257
+ end
258
+
259
+ # Custom attribute writer method with validation
260
+ # @param [Object] domain Value to be assigned
261
+ def domain=(domain)
262
+ if domain.nil?
263
+ fail ArgumentError, 'domain cannot be nil'
264
+ end
265
+
266
+ @domain = domain
267
+ end
268
+
269
+ # Custom attribute writer method checking allowed values (enum).
270
+ # @param [Object] status Object to be assigned
271
+ def status=(status)
272
+ validator = EnumAttributeValidator.new('String', ["pending", "verifying", "verified", "failed"])
273
+ unless validator.valid?(status)
274
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
275
+ end
276
+ @status = status
277
+ end
278
+
279
+ # Custom attribute writer method with validation
280
+ # @param [Object] dns_records Value to be assigned
281
+ def dns_records=(dns_records)
282
+ if dns_records.nil?
283
+ fail ArgumentError, 'dns_records cannot be nil'
284
+ end
285
+
286
+ @dns_records = dns_records
287
+ end
288
+
289
+ # Custom attribute writer method with validation
290
+ # @param [Object] records_verified Value to be assigned
291
+ def records_verified=(records_verified)
292
+ if records_verified.nil?
293
+ fail ArgumentError, 'records_verified cannot be nil'
294
+ end
295
+
296
+ @records_verified = records_verified
297
+ end
298
+
299
+ # Custom attribute writer method with validation
300
+ # @param [Object] records_total Value to be assigned
301
+ def records_total=(records_total)
302
+ if records_total.nil?
303
+ fail ArgumentError, 'records_total cannot be nil'
304
+ end
305
+
306
+ @records_total = records_total
307
+ end
308
+
309
+ # Custom attribute writer method with validation
310
+ # @param [Object] created_at Value to be assigned
311
+ def created_at=(created_at)
312
+ if created_at.nil?
313
+ fail ArgumentError, 'created_at cannot be nil'
314
+ end
315
+
316
+ @created_at = created_at
317
+ end
318
+
319
+ # Checks equality by comparing each attribute.
320
+ # @param [Object] Object to be compared
321
+ def ==(o)
322
+ return true if self.equal?(o)
323
+ self.class == o.class &&
324
+ id == o.id &&
325
+ domain == o.domain &&
326
+ status == o.status &&
327
+ dns_records == o.dns_records &&
328
+ records_verified == o.records_verified &&
329
+ records_total == o.records_total &&
330
+ verification_token == o.verification_token &&
331
+ verified_at == o.verified_at &&
332
+ last_checked_at == o.last_checked_at &&
333
+ created_at == o.created_at &&
334
+ updated_at == o.updated_at
335
+ end
336
+
337
+ # @see the `==` method
338
+ # @param [Object] Object to be compared
339
+ def eql?(o)
340
+ self == o
341
+ end
342
+
343
+ # Calculates hash code according to all attributes.
344
+ # @return [Integer] Hash code
345
+ def hash
346
+ [id, domain, status, dns_records, records_verified, records_total, verification_token, verified_at, last_checked_at, created_at, updated_at].hash
347
+ end
348
+
349
+ # Builds the object from hash
350
+ # @param [Hash] attributes Model attributes in the form of hash
351
+ # @return [Object] Returns the model itself
352
+ def self.build_from_hash(attributes)
353
+ return nil unless attributes.is_a?(Hash)
354
+ attributes = attributes.transform_keys(&:to_sym)
355
+ transformed_hash = {}
356
+ openapi_types.each_pair do |key, type|
357
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
358
+ transformed_hash["#{key}"] = nil
359
+ elsif type =~ /\AArray<(.*)>/i
360
+ # check to ensure the input is an array given that the attribute
361
+ # is documented as an array but the input is not
362
+ if attributes[attribute_map[key]].is_a?(Array)
363
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
364
+ end
365
+ elsif !attributes[attribute_map[key]].nil?
366
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
367
+ end
368
+ end
369
+ new(transformed_hash)
370
+ end
371
+
372
+ # Deserializes the data based on type
373
+ # @param string type Data type
374
+ # @param string value Value to be deserialized
375
+ # @return [Object] Deserialized data
376
+ def self._deserialize(type, value)
377
+ case type.to_sym
378
+ when :Time
379
+ Time.parse(value)
380
+ when :Date
381
+ Date.parse(value)
382
+ when :String
383
+ value.to_s
384
+ when :Integer
385
+ value.to_i
386
+ when :Float
387
+ value.to_f
388
+ when :Boolean
389
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
390
+ true
391
+ else
392
+ false
393
+ end
394
+ when :Object
395
+ # generic object (usually a Hash), return directly
396
+ value
397
+ when /\AArray<(?<inner_type>.+)>\z/
398
+ inner_type = Regexp.last_match[:inner_type]
399
+ value.map { |v| _deserialize(inner_type, v) }
400
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
401
+ k_type = Regexp.last_match[:k_type]
402
+ v_type = Regexp.last_match[:v_type]
403
+ {}.tap do |hash|
404
+ value.each do |k, v|
405
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
406
+ end
407
+ end
408
+ else # model
409
+ # models (e.g. Pet) or oneOf
410
+ klass = Zyphr.const_get(type)
411
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
412
+ end
413
+ end
414
+
415
+ # Returns the string representation of the object
416
+ # @return [String] String presentation of the object
417
+ def to_s
418
+ to_hash.to_s
419
+ end
420
+
421
+ # to_body is an alias to to_hash (backward compatibility)
422
+ # @return [Hash] Returns the object in the form of hash
423
+ def to_body
424
+ to_hash
425
+ end
426
+
427
+ # Returns the object in the form of hash
428
+ # @return [Hash] Returns the object in the form of hash
429
+ def to_hash
430
+ hash = {}
431
+ self.class.attribute_map.each_pair do |attr, param|
432
+ value = self.send(attr)
433
+ if value.nil?
434
+ is_nullable = self.class.openapi_nullable.include?(attr)
435
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
436
+ end
437
+
438
+ hash[param] = _to_hash(value)
439
+ end
440
+ hash
441
+ end
442
+
443
+ # Outputs non-array value in the form of hash
444
+ # For object, use to_hash. Otherwise, just return the value
445
+ # @param [Object] value Any valid value
446
+ # @return [Hash] Returns the value in the form of hash
447
+ def _to_hash(value)
448
+ if value.is_a?(Array)
449
+ value.compact.map { |v| _to_hash(v) }
450
+ elsif value.is_a?(Hash)
451
+ {}.tap do |hash|
452
+ value.each { |k, v| hash[k] = _to_hash(v) }
453
+ end
454
+ elsif value.respond_to? :to_hash
455
+ value.to_hash
456
+ else
457
+ value
458
+ end
459
+ end
460
+
461
+ end
462
+
463
+ end