parlo-sdk 1.0.0

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 (46) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +132 -0
  3. data/lib/parlo-sdk/api/domains_api.rb +332 -0
  4. data/lib/parlo-sdk/api/emails_api.rb +156 -0
  5. data/lib/parlo-sdk/api_client.rb +397 -0
  6. data/lib/parlo-sdk/api_error.rb +58 -0
  7. data/lib/parlo-sdk/api_model_base.rb +88 -0
  8. data/lib/parlo-sdk/configuration.rb +308 -0
  9. data/lib/parlo-sdk/models/auth_health.rb +227 -0
  10. data/lib/parlo-sdk/models/auth_health_dkim.rb +188 -0
  11. data/lib/parlo-sdk/models/auth_health_dmarc.rb +174 -0
  12. data/lib/parlo-sdk/models/auth_health_spf.rb +164 -0
  13. data/lib/parlo-sdk/models/create_domain_request.rb +164 -0
  14. data/lib/parlo-sdk/models/delete_domain200_response.rb +214 -0
  15. data/lib/parlo-sdk/models/dns_record.rb +267 -0
  16. data/lib/parlo-sdk/models/domain.rb +319 -0
  17. data/lib/parlo-sdk/models/domain_summary.rb +260 -0
  18. data/lib/parlo-sdk/models/email.rb +340 -0
  19. data/lib/parlo-sdk/models/email_created.rb +214 -0
  20. data/lib/parlo-sdk/models/error.rb +190 -0
  21. data/lib/parlo-sdk/models/list_domains200_response.rb +166 -0
  22. data/lib/parlo-sdk/models/send_email_request.rb +288 -0
  23. data/lib/parlo-sdk/models/send_email_request_cc.rb +104 -0
  24. data/lib/parlo-sdk/models/send_email_request_to.rb +105 -0
  25. data/lib/parlo-sdk/version.rb +15 -0
  26. data/lib/parlo-sdk.rb +58 -0
  27. data/spec/api/domains_api_spec.rb +92 -0
  28. data/spec/api/emails_api_spec.rb +60 -0
  29. data/spec/models/auth_health_dkim_spec.rb +40 -0
  30. data/spec/models/auth_health_dmarc_spec.rb +42 -0
  31. data/spec/models/auth_health_spec.rb +54 -0
  32. data/spec/models/auth_health_spf_spec.rb +36 -0
  33. data/spec/models/create_domain_request_spec.rb +36 -0
  34. data/spec/models/delete_domain200_response_spec.rb +46 -0
  35. data/spec/models/dns_record_spec.rb +58 -0
  36. data/spec/models/domain_spec.rb +76 -0
  37. data/spec/models/domain_summary_spec.rb +64 -0
  38. data/spec/models/email_created_spec.rb +46 -0
  39. data/spec/models/email_spec.rb +82 -0
  40. data/spec/models/error_spec.rb +42 -0
  41. data/spec/models/list_domains200_response_spec.rb +36 -0
  42. data/spec/models/send_email_request_cc_spec.rb +32 -0
  43. data/spec/models/send_email_request_spec.rb +90 -0
  44. data/spec/models/send_email_request_to_spec.rb +32 -0
  45. data/spec/spec_helper.rb +111 -0
  46. metadata +153 -0
@@ -0,0 +1,190 @@
1
+ =begin
2
+ #Parlo API
3
+
4
+ #The Parlo API sends transactional email and manages the sending domains it authenticates from. Marketing campaigns (audiences, templates, broadcasts) are designed and sent from the Parlo dashboard, not this API — the API is transactional-only at launch. All requests authenticate with a company API key as an HTTP bearer token: `Authorization: Bearer parlo_live_xxx`. Errors return a JSON body of the shape `{ \"message\": string, \"code\": string }`.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.24.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Parlo
17
+ class Error < ApiModelBase
18
+ attr_accessor :message
19
+
20
+ attr_accessor :code
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'message' => :'message',
26
+ :'code' => :'code'
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
+ :'message' => :'String',
44
+ :'code' => :'String'
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 `Parlo::Error` 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 `Parlo::Error`. 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?(:'message')
71
+ self.message = attributes[:'message']
72
+ else
73
+ self.message = nil
74
+ end
75
+
76
+ if attributes.key?(:'code')
77
+ self.code = attributes[:'code']
78
+ else
79
+ self.code = nil
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
87
+ invalid_properties = Array.new
88
+ if @message.nil?
89
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
90
+ end
91
+
92
+ if @code.nil?
93
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
94
+ end
95
+
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ warn '[DEPRECATED] the `valid?` method is obsolete'
103
+ return false if @message.nil?
104
+ return false if @code.nil?
105
+ true
106
+ end
107
+
108
+ # Custom attribute writer method with validation
109
+ # @param [Object] message Value to be assigned
110
+ def message=(message)
111
+ if message.nil?
112
+ fail ArgumentError, 'message cannot be nil'
113
+ end
114
+
115
+ @message = message
116
+ end
117
+
118
+ # Custom attribute writer method with validation
119
+ # @param [Object] code Value to be assigned
120
+ def code=(code)
121
+ if code.nil?
122
+ fail ArgumentError, 'code cannot be nil'
123
+ end
124
+
125
+ @code = code
126
+ end
127
+
128
+ # Checks equality by comparing each attribute.
129
+ # @param [Object] Object to be compared
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ message == o.message &&
134
+ code == o.code
135
+ end
136
+
137
+ # @see the `==` method
138
+ # @param [Object] Object to be compared
139
+ def eql?(o)
140
+ self == o
141
+ end
142
+
143
+ # Calculates hash code according to all attributes.
144
+ # @return [Integer] Hash code
145
+ def hash
146
+ [message, code].hash
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def self.build_from_hash(attributes)
153
+ return nil unless attributes.is_a?(Hash)
154
+ attributes = attributes.transform_keys(&:to_sym)
155
+ transformed_hash = {}
156
+ openapi_types.each_pair do |key, type|
157
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
158
+ transformed_hash["#{key}"] = nil
159
+ elsif type =~ /\AArray<(.*)>/i
160
+ # check to ensure the input is an array given that the attribute
161
+ # is documented as an array but the input is not
162
+ if attributes[attribute_map[key]].is_a?(Array)
163
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
164
+ end
165
+ elsif !attributes[attribute_map[key]].nil?
166
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
167
+ end
168
+ end
169
+ new(transformed_hash)
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = self.send(attr)
178
+ if value.nil?
179
+ is_nullable = self.class.openapi_nullable.include?(attr)
180
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
181
+ end
182
+
183
+ hash[param] = _to_hash(value)
184
+ end
185
+ hash
186
+ end
187
+
188
+ end
189
+
190
+ end
@@ -0,0 +1,166 @@
1
+ =begin
2
+ #Parlo API
3
+
4
+ #The Parlo API sends transactional email and manages the sending domains it authenticates from. Marketing campaigns (audiences, templates, broadcasts) are designed and sent from the Parlo dashboard, not this API — the API is transactional-only at launch. All requests authenticate with a company API key as an HTTP bearer token: `Authorization: Bearer parlo_live_xxx`. Errors return a JSON body of the shape `{ \"message\": string, \"code\": string }`.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.24.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Parlo
17
+ class ListDomains200Response < ApiModelBase
18
+ attr_accessor :domains
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'domains' => :'domains'
24
+ }
25
+ end
26
+
27
+ # Returns attribute mapping this model knows about
28
+ def self.acceptable_attribute_map
29
+ attribute_map
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ acceptable_attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'domains' => :'Array<DomainSummary>'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Parlo::ListDomains200Response` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!acceptable_attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Parlo::ListDomains200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'domains')
67
+ if (value = attributes[:'domains']).is_a?(Array)
68
+ self.domains = value
69
+ end
70
+ else
71
+ self.domains = nil
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
79
+ invalid_properties = Array.new
80
+ if @domains.nil?
81
+ invalid_properties.push('invalid value for "domains", domains cannot be nil.')
82
+ end
83
+
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
+ return false if @domains.nil?
92
+ true
93
+ end
94
+
95
+ # Custom attribute writer method with validation
96
+ # @param [Object] domains Value to be assigned
97
+ def domains=(domains)
98
+ if domains.nil?
99
+ fail ArgumentError, 'domains cannot be nil'
100
+ end
101
+
102
+ @domains = domains
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ domains == o.domains
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [domains].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ attributes = attributes.transform_keys(&:to_sym)
131
+ transformed_hash = {}
132
+ openapi_types.each_pair do |key, type|
133
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = nil
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[attribute_map[key]].is_a?(Array)
139
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
140
+ end
141
+ elsif !attributes[attribute_map[key]].nil?
142
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
143
+ end
144
+ end
145
+ new(transformed_hash)
146
+ end
147
+
148
+ # Returns the object in the form of hash
149
+ # @return [Hash] Returns the object in the form of hash
150
+ def to_hash
151
+ hash = {}
152
+ self.class.attribute_map.each_pair do |attr, param|
153
+ value = self.send(attr)
154
+ if value.nil?
155
+ is_nullable = self.class.openapi_nullable.include?(attr)
156
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
157
+ end
158
+
159
+ hash[param] = _to_hash(value)
160
+ end
161
+ hash
162
+ end
163
+
164
+ end
165
+
166
+ end
@@ -0,0 +1,288 @@
1
+ =begin
2
+ #Parlo API
3
+
4
+ #The Parlo API sends transactional email and manages the sending domains it authenticates from. Marketing campaigns (audiences, templates, broadcasts) are designed and sent from the Parlo dashboard, not this API — the API is transactional-only at launch. All requests authenticate with a company API key as an HTTP bearer token: `Authorization: Bearer parlo_live_xxx`. Errors return a JSON body of the shape `{ \"message\": string, \"code\": string }`.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.24.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Parlo
17
+ class SendEmailRequest < ApiModelBase
18
+ # Sender address. Its domain must be a verified sending domain.
19
+ attr_accessor :from
20
+
21
+ attr_accessor :to
22
+
23
+ attr_accessor :subject
24
+
25
+ # HTML body. Provide at least one of html or text.
26
+ attr_accessor :html
27
+
28
+ # Plain-text body. Provide at least one of html or text.
29
+ attr_accessor :text
30
+
31
+ attr_accessor :reply_to
32
+
33
+ attr_accessor :cc
34
+
35
+ attr_accessor :bcc
36
+
37
+ # Values substituted into [placeholder] tokens in subject/html/text.
38
+ attr_accessor :data
39
+
40
+ # Arbitrary string key/value pairs attached to the message.
41
+ attr_accessor :tags
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'from' => :'from',
47
+ :'to' => :'to',
48
+ :'subject' => :'subject',
49
+ :'html' => :'html',
50
+ :'text' => :'text',
51
+ :'reply_to' => :'reply_to',
52
+ :'cc' => :'cc',
53
+ :'bcc' => :'bcc',
54
+ :'data' => :'data',
55
+ :'tags' => :'tags'
56
+ }
57
+ end
58
+
59
+ # Returns attribute mapping this model knows about
60
+ def self.acceptable_attribute_map
61
+ attribute_map
62
+ end
63
+
64
+ # Returns all the JSON keys this model knows about
65
+ def self.acceptable_attributes
66
+ acceptable_attribute_map.values
67
+ end
68
+
69
+ # Attribute type mapping.
70
+ def self.openapi_types
71
+ {
72
+ :'from' => :'String',
73
+ :'to' => :'SendEmailRequestTo',
74
+ :'subject' => :'String',
75
+ :'html' => :'String',
76
+ :'text' => :'String',
77
+ :'reply_to' => :'String',
78
+ :'cc' => :'SendEmailRequestCc',
79
+ :'bcc' => :'SendEmailRequestCc',
80
+ :'data' => :'Hash<String, Object>',
81
+ :'tags' => :'Hash<String, String>'
82
+ }
83
+ end
84
+
85
+ # List of attributes with nullable: true
86
+ def self.openapi_nullable
87
+ Set.new([
88
+ ])
89
+ end
90
+
91
+ # Initializes the object
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ def initialize(attributes = {})
94
+ if (!attributes.is_a?(Hash))
95
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Parlo::SendEmailRequest` initialize method"
96
+ end
97
+
98
+ # check to see if the attribute exists and convert string to symbol for hash key
99
+ acceptable_attribute_map = self.class.acceptable_attribute_map
100
+ attributes = attributes.each_with_object({}) { |(k, v), h|
101
+ if (!acceptable_attribute_map.key?(k.to_sym))
102
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Parlo::SendEmailRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
103
+ end
104
+ h[k.to_sym] = v
105
+ }
106
+
107
+ if attributes.key?(:'from')
108
+ self.from = attributes[:'from']
109
+ else
110
+ self.from = nil
111
+ end
112
+
113
+ if attributes.key?(:'to')
114
+ self.to = attributes[:'to']
115
+ else
116
+ self.to = nil
117
+ end
118
+
119
+ if attributes.key?(:'subject')
120
+ self.subject = attributes[:'subject']
121
+ else
122
+ self.subject = nil
123
+ end
124
+
125
+ if attributes.key?(:'html')
126
+ self.html = attributes[:'html']
127
+ end
128
+
129
+ if attributes.key?(:'text')
130
+ self.text = attributes[:'text']
131
+ end
132
+
133
+ if attributes.key?(:'reply_to')
134
+ self.reply_to = attributes[:'reply_to']
135
+ end
136
+
137
+ if attributes.key?(:'cc')
138
+ self.cc = attributes[:'cc']
139
+ end
140
+
141
+ if attributes.key?(:'bcc')
142
+ self.bcc = attributes[:'bcc']
143
+ end
144
+
145
+ if attributes.key?(:'data')
146
+ if (value = attributes[:'data']).is_a?(Hash)
147
+ self.data = value
148
+ end
149
+ end
150
+
151
+ if attributes.key?(:'tags')
152
+ if (value = attributes[:'tags']).is_a?(Hash)
153
+ self.tags = value
154
+ end
155
+ end
156
+ end
157
+
158
+ # Show invalid properties with the reasons. Usually used together with valid?
159
+ # @return Array for valid properties with the reasons
160
+ def list_invalid_properties
161
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
162
+ invalid_properties = Array.new
163
+ if @from.nil?
164
+ invalid_properties.push('invalid value for "from", from cannot be nil.')
165
+ end
166
+
167
+ if @to.nil?
168
+ invalid_properties.push('invalid value for "to", to cannot be nil.')
169
+ end
170
+
171
+ if @subject.nil?
172
+ invalid_properties.push('invalid value for "subject", subject 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
+ return false if @to.nil?
184
+ return false if @subject.nil?
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 with validation
199
+ # @param [Object] to Value to be assigned
200
+ def to=(to)
201
+ if to.nil?
202
+ fail ArgumentError, 'to cannot be nil'
203
+ end
204
+
205
+ @to = to
206
+ end
207
+
208
+ # Custom attribute writer method with validation
209
+ # @param [Object] subject Value to be assigned
210
+ def subject=(subject)
211
+ if subject.nil?
212
+ fail ArgumentError, 'subject cannot be nil'
213
+ end
214
+
215
+ @subject = subject
216
+ end
217
+
218
+ # Checks equality by comparing each attribute.
219
+ # @param [Object] Object to be compared
220
+ def ==(o)
221
+ return true if self.equal?(o)
222
+ self.class == o.class &&
223
+ from == o.from &&
224
+ to == o.to &&
225
+ subject == o.subject &&
226
+ html == o.html &&
227
+ text == o.text &&
228
+ reply_to == o.reply_to &&
229
+ cc == o.cc &&
230
+ bcc == o.bcc &&
231
+ data == o.data &&
232
+ tags == o.tags
233
+ end
234
+
235
+ # @see the `==` method
236
+ # @param [Object] Object to be compared
237
+ def eql?(o)
238
+ self == o
239
+ end
240
+
241
+ # Calculates hash code according to all attributes.
242
+ # @return [Integer] Hash code
243
+ def hash
244
+ [from, to, subject, html, text, reply_to, cc, bcc, data, tags].hash
245
+ end
246
+
247
+ # Builds the object from hash
248
+ # @param [Hash] attributes Model attributes in the form of hash
249
+ # @return [Object] Returns the model itself
250
+ def self.build_from_hash(attributes)
251
+ return nil unless attributes.is_a?(Hash)
252
+ attributes = attributes.transform_keys(&:to_sym)
253
+ transformed_hash = {}
254
+ openapi_types.each_pair do |key, type|
255
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
256
+ transformed_hash["#{key}"] = nil
257
+ elsif type =~ /\AArray<(.*)>/i
258
+ # check to ensure the input is an array given that the attribute
259
+ # is documented as an array but the input is not
260
+ if attributes[attribute_map[key]].is_a?(Array)
261
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
262
+ end
263
+ elsif !attributes[attribute_map[key]].nil?
264
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
265
+ end
266
+ end
267
+ new(transformed_hash)
268
+ end
269
+
270
+ # Returns the object in the form of hash
271
+ # @return [Hash] Returns the object in the form of hash
272
+ def to_hash
273
+ hash = {}
274
+ self.class.attribute_map.each_pair do |attr, param|
275
+ value = self.send(attr)
276
+ if value.nil?
277
+ is_nullable = self.class.openapi_nullable.include?(attr)
278
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
279
+ end
280
+
281
+ hash[param] = _to_hash(value)
282
+ end
283
+ hash
284
+ end
285
+
286
+ end
287
+
288
+ end