unsent 1.0.1 → 1.0.2
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/LICENSE.txt +1 -1
- data/README.md +258 -2
- data/lib/unsent/analytics.rb +30 -0
- data/lib/unsent/api_keys.rb +21 -0
- data/lib/unsent/campaigns.rb +4 -0
- data/lib/unsent/client.rb +8 -1
- data/lib/unsent/contact_books.rb +29 -0
- data/lib/unsent/contacts.rb +11 -0
- data/lib/unsent/emails.rb +47 -0
- data/lib/unsent/errors.rb +2 -0
- data/lib/unsent/models/add_suppression_request.rb +223 -0
- data/lib/unsent/models/create_api_key_request.rb +218 -0
- data/lib/unsent/models/create_campaign200_response.rb +750 -0
- data/lib/unsent/models/create_campaign_request.rb +426 -0
- data/lib/unsent/models/create_campaign_request_reply_to.rb +103 -0
- data/lib/unsent/models/create_contact200_response.rb +147 -0
- data/lib/unsent/models/create_contact_book200_response.rb +304 -0
- data/lib/unsent/models/create_contact_book_request.rb +193 -0
- data/lib/unsent/models/create_contact_request.rb +202 -0
- data/lib/unsent/models/create_domain_request.rb +190 -0
- data/lib/unsent/models/create_template200_response.rb +164 -0
- data/lib/unsent/models/create_template_request.rb +226 -0
- data/lib/unsent/models/delete_contact_book200_response.rb +164 -0
- data/lib/unsent/models/get_api_keys200_response_inner.rb +278 -0
- data/lib/unsent/models/get_campaigns200_response_inner.rb +296 -0
- data/lib/unsent/models/get_contact_book200_response.rb +330 -0
- data/lib/unsent/models/get_contact_book200_response_details.rb +218 -0
- data/lib/unsent/models/get_domains200_response_inner.rb +482 -0
- data/lib/unsent/models/get_domains200_response_inner_dns_records_inner.rb +318 -0
- data/lib/unsent/models/get_health200_response.rb +216 -0
- data/lib/unsent/models/get_templates200_response_inner.rb +314 -0
- data/lib/unsent/models/list_emails_domain_id_parameter.rb +103 -0
- data/lib/unsent/models/schedule_campaign_request.rb +185 -0
- data/lib/unsent/models/send_email_request.rb +378 -0
- data/lib/unsent/models/send_email_request_to.rb +103 -0
- data/lib/unsent/models/update_contact_book200_response.rb +190 -0
- data/lib/unsent/models/update_contact_book_request.rb +167 -0
- data/lib/unsent/models/update_contact_request.rb +176 -0
- data/lib/unsent/models/update_template_request.rb +174 -0
- data/lib/unsent/settings.rb +13 -0
- data/lib/unsent/suppressions.rb +28 -0
- data/lib/unsent/templates.rb +29 -0
- data/lib/unsent/version.rb +1 -1
- data/lib/unsent/webhooks.rb +25 -0
- data/lib/unsent.rb +7 -0
- metadata +38 -2
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Unsent API
|
|
3
|
+
|
|
4
|
+
#API for Unsent.dev
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: support@unsent.dev
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.18.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Unsent
|
|
17
|
+
class GetDomains200ResponseInnerDnsRecordsInner < ApiModelBase
|
|
18
|
+
# DNS record type
|
|
19
|
+
attr_accessor :type
|
|
20
|
+
|
|
21
|
+
# DNS record name
|
|
22
|
+
attr_accessor :name
|
|
23
|
+
|
|
24
|
+
# DNS record value
|
|
25
|
+
attr_accessor :value
|
|
26
|
+
|
|
27
|
+
# DNS record TTL
|
|
28
|
+
attr_accessor :ttl
|
|
29
|
+
|
|
30
|
+
# DNS record priority
|
|
31
|
+
attr_accessor :priority
|
|
32
|
+
|
|
33
|
+
# The status of the domain
|
|
34
|
+
attr_accessor :status
|
|
35
|
+
|
|
36
|
+
# Whether the record is recommended
|
|
37
|
+
attr_accessor :recommended
|
|
38
|
+
|
|
39
|
+
class EnumAttributeValidator
|
|
40
|
+
attr_reader :datatype
|
|
41
|
+
attr_reader :allowable_values
|
|
42
|
+
|
|
43
|
+
def initialize(datatype, allowable_values)
|
|
44
|
+
@allowable_values = allowable_values.map do |value|
|
|
45
|
+
case datatype.to_s
|
|
46
|
+
when /Integer/i
|
|
47
|
+
value.to_i
|
|
48
|
+
when /Float/i
|
|
49
|
+
value.to_f
|
|
50
|
+
else
|
|
51
|
+
value
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def valid?(value)
|
|
57
|
+
!value || allowable_values.include?(value)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
62
|
+
def self.attribute_map
|
|
63
|
+
{
|
|
64
|
+
:'type' => :'type',
|
|
65
|
+
:'name' => :'name',
|
|
66
|
+
:'value' => :'value',
|
|
67
|
+
:'ttl' => :'ttl',
|
|
68
|
+
:'priority' => :'priority',
|
|
69
|
+
:'status' => :'status',
|
|
70
|
+
:'recommended' => :'recommended'
|
|
71
|
+
}
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Returns attribute mapping this model knows about
|
|
75
|
+
def self.acceptable_attribute_map
|
|
76
|
+
attribute_map
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Returns all the JSON keys this model knows about
|
|
80
|
+
def self.acceptable_attributes
|
|
81
|
+
acceptable_attribute_map.values
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Attribute type mapping.
|
|
85
|
+
def self.openapi_types
|
|
86
|
+
{
|
|
87
|
+
:'type' => :'String',
|
|
88
|
+
:'name' => :'String',
|
|
89
|
+
:'value' => :'String',
|
|
90
|
+
:'ttl' => :'String',
|
|
91
|
+
:'priority' => :'String',
|
|
92
|
+
:'status' => :'String',
|
|
93
|
+
:'recommended' => :'Boolean'
|
|
94
|
+
}
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# List of attributes with nullable: true
|
|
98
|
+
def self.openapi_nullable
|
|
99
|
+
Set.new([
|
|
100
|
+
:'priority',
|
|
101
|
+
])
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Initializes the object
|
|
105
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
106
|
+
def initialize(attributes = {})
|
|
107
|
+
if (!attributes.is_a?(Hash))
|
|
108
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Unsent::GetDomains200ResponseInnerDnsRecordsInner` initialize method"
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
112
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
113
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
114
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
115
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Unsent::GetDomains200ResponseInnerDnsRecordsInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
116
|
+
end
|
|
117
|
+
h[k.to_sym] = v
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if attributes.key?(:'type')
|
|
121
|
+
self.type = attributes[:'type']
|
|
122
|
+
else
|
|
123
|
+
self.type = nil
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
if attributes.key?(:'name')
|
|
127
|
+
self.name = attributes[:'name']
|
|
128
|
+
else
|
|
129
|
+
self.name = nil
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
if attributes.key?(:'value')
|
|
133
|
+
self.value = attributes[:'value']
|
|
134
|
+
else
|
|
135
|
+
self.value = nil
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
if attributes.key?(:'ttl')
|
|
139
|
+
self.ttl = attributes[:'ttl']
|
|
140
|
+
else
|
|
141
|
+
self.ttl = nil
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
if attributes.key?(:'priority')
|
|
145
|
+
self.priority = attributes[:'priority']
|
|
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?(:'recommended')
|
|
155
|
+
self.recommended = attributes[:'recommended']
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
160
|
+
# @return Array for valid properties with the reasons
|
|
161
|
+
def list_invalid_properties
|
|
162
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
163
|
+
invalid_properties = Array.new
|
|
164
|
+
if @type.nil?
|
|
165
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
if @name.nil?
|
|
169
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
if @value.nil?
|
|
173
|
+
invalid_properties.push('invalid value for "value", value cannot be nil.')
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
if @ttl.nil?
|
|
177
|
+
invalid_properties.push('invalid value for "ttl", ttl cannot be nil.')
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
if @status.nil?
|
|
181
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
invalid_properties
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# Check to see if the all the properties in the model are valid
|
|
188
|
+
# @return true if the model is valid
|
|
189
|
+
def valid?
|
|
190
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
191
|
+
return false if @type.nil?
|
|
192
|
+
type_validator = EnumAttributeValidator.new('String', ["MX", "TXT"])
|
|
193
|
+
return false unless type_validator.valid?(@type)
|
|
194
|
+
return false if @name.nil?
|
|
195
|
+
return false if @value.nil?
|
|
196
|
+
return false if @ttl.nil?
|
|
197
|
+
return false if @status.nil?
|
|
198
|
+
true
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
202
|
+
# @param [Object] type Object to be assigned
|
|
203
|
+
def type=(type)
|
|
204
|
+
validator = EnumAttributeValidator.new('String', ["MX", "TXT"])
|
|
205
|
+
unless validator.valid?(type)
|
|
206
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
207
|
+
end
|
|
208
|
+
@type = type
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# Custom attribute writer method with validation
|
|
212
|
+
# @param [Object] name Value to be assigned
|
|
213
|
+
def name=(name)
|
|
214
|
+
if name.nil?
|
|
215
|
+
fail ArgumentError, 'name cannot be nil'
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
@name = name
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# Custom attribute writer method with validation
|
|
222
|
+
# @param [Object] value Value to be assigned
|
|
223
|
+
def value=(value)
|
|
224
|
+
if value.nil?
|
|
225
|
+
fail ArgumentError, 'value cannot be nil'
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
@value = value
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# Custom attribute writer method with validation
|
|
232
|
+
# @param [Object] ttl Value to be assigned
|
|
233
|
+
def ttl=(ttl)
|
|
234
|
+
if ttl.nil?
|
|
235
|
+
fail ArgumentError, 'ttl cannot be nil'
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
@ttl = ttl
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
# Custom attribute writer method with validation
|
|
242
|
+
# @param [Object] status Value to be assigned
|
|
243
|
+
def status=(status)
|
|
244
|
+
if status.nil?
|
|
245
|
+
fail ArgumentError, 'status cannot be nil'
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
@status = status
|
|
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
|
+
type == o.type &&
|
|
257
|
+
name == o.name &&
|
|
258
|
+
value == o.value &&
|
|
259
|
+
ttl == o.ttl &&
|
|
260
|
+
priority == o.priority &&
|
|
261
|
+
status == o.status &&
|
|
262
|
+
recommended == o.recommended
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
# @see the `==` method
|
|
266
|
+
# @param [Object] Object to be compared
|
|
267
|
+
def eql?(o)
|
|
268
|
+
self == o
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
# Calculates hash code according to all attributes.
|
|
272
|
+
# @return [Integer] Hash code
|
|
273
|
+
def hash
|
|
274
|
+
[type, name, value, ttl, priority, status, recommended].hash
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
# Builds the object from hash
|
|
278
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
279
|
+
# @return [Object] Returns the model itself
|
|
280
|
+
def self.build_from_hash(attributes)
|
|
281
|
+
return nil unless attributes.is_a?(Hash)
|
|
282
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
283
|
+
transformed_hash = {}
|
|
284
|
+
openapi_types.each_pair do |key, type|
|
|
285
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
286
|
+
transformed_hash["#{key}"] = nil
|
|
287
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
288
|
+
# check to ensure the input is an array given that the attribute
|
|
289
|
+
# is documented as an array but the input is not
|
|
290
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
291
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
292
|
+
end
|
|
293
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
294
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
295
|
+
end
|
|
296
|
+
end
|
|
297
|
+
new(transformed_hash)
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
# Returns the object in the form of hash
|
|
301
|
+
# @return [Hash] Returns the object in the form of hash
|
|
302
|
+
def to_hash
|
|
303
|
+
hash = {}
|
|
304
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
305
|
+
value = self.send(attr)
|
|
306
|
+
if value.nil?
|
|
307
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
308
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
hash[param] = _to_hash(value)
|
|
312
|
+
end
|
|
313
|
+
hash
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
end
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Unsent API
|
|
3
|
+
|
|
4
|
+
#API for Unsent.dev
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: support@unsent.dev
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.18.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Unsent
|
|
17
|
+
class GetHealth200Response < ApiModelBase
|
|
18
|
+
attr_accessor :status
|
|
19
|
+
|
|
20
|
+
attr_accessor :uptime
|
|
21
|
+
|
|
22
|
+
attr_accessor :timestamp
|
|
23
|
+
|
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
25
|
+
def self.attribute_map
|
|
26
|
+
{
|
|
27
|
+
:'status' => :'status',
|
|
28
|
+
:'uptime' => :'uptime',
|
|
29
|
+
:'timestamp' => :'timestamp'
|
|
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
|
+
:'status' => :'String',
|
|
47
|
+
:'uptime' => :'Float',
|
|
48
|
+
:'timestamp' => :'Float'
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# List of attributes with nullable: true
|
|
53
|
+
def self.openapi_nullable
|
|
54
|
+
Set.new([
|
|
55
|
+
])
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Initializes the object
|
|
59
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
60
|
+
def initialize(attributes = {})
|
|
61
|
+
if (!attributes.is_a?(Hash))
|
|
62
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Unsent::GetHealth200Response` initialize method"
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
66
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
67
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
68
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
69
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Unsent::GetHealth200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
70
|
+
end
|
|
71
|
+
h[k.to_sym] = v
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if attributes.key?(:'status')
|
|
75
|
+
self.status = attributes[:'status']
|
|
76
|
+
else
|
|
77
|
+
self.status = nil
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
if attributes.key?(:'uptime')
|
|
81
|
+
self.uptime = attributes[:'uptime']
|
|
82
|
+
else
|
|
83
|
+
self.uptime = nil
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
if attributes.key?(:'timestamp')
|
|
87
|
+
self.timestamp = attributes[:'timestamp']
|
|
88
|
+
else
|
|
89
|
+
self.timestamp = nil
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
94
|
+
# @return Array for valid properties with the reasons
|
|
95
|
+
def list_invalid_properties
|
|
96
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
97
|
+
invalid_properties = Array.new
|
|
98
|
+
if @status.nil?
|
|
99
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
if @uptime.nil?
|
|
103
|
+
invalid_properties.push('invalid value for "uptime", uptime cannot be nil.')
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
if @timestamp.nil?
|
|
107
|
+
invalid_properties.push('invalid value for "timestamp", timestamp cannot be nil.')
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
invalid_properties
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Check to see if the all the properties in the model are valid
|
|
114
|
+
# @return true if the model is valid
|
|
115
|
+
def valid?
|
|
116
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
117
|
+
return false if @status.nil?
|
|
118
|
+
return false if @uptime.nil?
|
|
119
|
+
return false if @timestamp.nil?
|
|
120
|
+
true
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Custom attribute writer method with validation
|
|
124
|
+
# @param [Object] status Value to be assigned
|
|
125
|
+
def status=(status)
|
|
126
|
+
if status.nil?
|
|
127
|
+
fail ArgumentError, 'status cannot be nil'
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
@status = status
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Custom attribute writer method with validation
|
|
134
|
+
# @param [Object] uptime Value to be assigned
|
|
135
|
+
def uptime=(uptime)
|
|
136
|
+
if uptime.nil?
|
|
137
|
+
fail ArgumentError, 'uptime cannot be nil'
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
@uptime = uptime
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Custom attribute writer method with validation
|
|
144
|
+
# @param [Object] timestamp Value to be assigned
|
|
145
|
+
def timestamp=(timestamp)
|
|
146
|
+
if timestamp.nil?
|
|
147
|
+
fail ArgumentError, 'timestamp cannot be nil'
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
@timestamp = timestamp
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Checks equality by comparing each attribute.
|
|
154
|
+
# @param [Object] Object to be compared
|
|
155
|
+
def ==(o)
|
|
156
|
+
return true if self.equal?(o)
|
|
157
|
+
self.class == o.class &&
|
|
158
|
+
status == o.status &&
|
|
159
|
+
uptime == o.uptime &&
|
|
160
|
+
timestamp == o.timestamp
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# @see the `==` method
|
|
164
|
+
# @param [Object] Object to be compared
|
|
165
|
+
def eql?(o)
|
|
166
|
+
self == o
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Calculates hash code according to all attributes.
|
|
170
|
+
# @return [Integer] Hash code
|
|
171
|
+
def hash
|
|
172
|
+
[status, uptime, timestamp].hash
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Builds the object from hash
|
|
176
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
177
|
+
# @return [Object] Returns the model itself
|
|
178
|
+
def self.build_from_hash(attributes)
|
|
179
|
+
return nil unless attributes.is_a?(Hash)
|
|
180
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
181
|
+
transformed_hash = {}
|
|
182
|
+
openapi_types.each_pair do |key, type|
|
|
183
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
184
|
+
transformed_hash["#{key}"] = nil
|
|
185
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
186
|
+
# check to ensure the input is an array given that the attribute
|
|
187
|
+
# is documented as an array but the input is not
|
|
188
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
189
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
190
|
+
end
|
|
191
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
192
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
new(transformed_hash)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Returns the object in the form of hash
|
|
199
|
+
# @return [Hash] Returns the object in the form of hash
|
|
200
|
+
def to_hash
|
|
201
|
+
hash = {}
|
|
202
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
203
|
+
value = self.send(attr)
|
|
204
|
+
if value.nil?
|
|
205
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
206
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
hash[param] = _to_hash(value)
|
|
210
|
+
end
|
|
211
|
+
hash
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
end
|