qubrics-sending 2.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/CHANGELOG.md +57 -0
  3. data/LICENSE +21 -0
  4. data/README.md +112 -0
  5. data/lib/qubrics/sending/client.rb +71 -0
  6. data/lib/qubrics/sending/version.rb +7 -0
  7. data/lib/qubrics/sending.rb +12 -0
  8. data/lib/qubrics_sending_generated/api/attachments_api.rb +373 -0
  9. data/lib/qubrics_sending_generated/api/emails_api.rb +172 -0
  10. data/lib/qubrics_sending_generated/api/meta_api.rb +142 -0
  11. data/lib/qubrics_sending_generated/api_client.rb +447 -0
  12. data/lib/qubrics_sending_generated/api_error.rb +58 -0
  13. data/lib/qubrics_sending_generated/api_model_base.rb +95 -0
  14. data/lib/qubrics_sending_generated/configuration.rb +413 -0
  15. data/lib/qubrics_sending_generated/models/address.rb +215 -0
  16. data/lib/qubrics_sending_generated/models/attachment.rb +103 -0
  17. data/lib/qubrics_sending_generated/models/attachment_upload_data.rb +284 -0
  18. data/lib/qubrics_sending_generated/models/attachment_upload_intent_data.rb +337 -0
  19. data/lib/qubrics_sending_generated/models/attachment_upload_intent_request.rb +279 -0
  20. data/lib/qubrics_sending_generated/models/attachment_upload_intent_response.rb +223 -0
  21. data/lib/qubrics_sending_generated/models/attachment_upload_response.rb +223 -0
  22. data/lib/qubrics_sending_generated/models/batch_result_item.rb +256 -0
  23. data/lib/qubrics_sending_generated/models/batch_send_request.rb +185 -0
  24. data/lib/qubrics_sending_generated/models/batch_send_success_data.rb +192 -0
  25. data/lib/qubrics_sending_generated/models/batch_send_success_response.rb +223 -0
  26. data/lib/qubrics_sending_generated/models/batch_summary.rb +219 -0
  27. data/lib/qubrics_sending_generated/models/connection.rb +273 -0
  28. data/lib/qubrics_sending_generated/models/connection_credential.rb +226 -0
  29. data/lib/qubrics_sending_generated/models/connection_mailboxes_inner.rb +190 -0
  30. data/lib/qubrics_sending_generated/models/connection_response.rb +223 -0
  31. data/lib/qubrics_sending_generated/models/connection_team.rb +190 -0
  32. data/lib/qubrics_sending_generated/models/email_send_request.rb +474 -0
  33. data/lib/qubrics_sending_generated/models/email_send_request_delivery_group.rb +105 -0
  34. data/lib/qubrics_sending_generated/models/error_detail.rb +251 -0
  35. data/lib/qubrics_sending_generated/models/error_issue.rb +219 -0
  36. data/lib/qubrics_sending_generated/models/error_response.rb +216 -0
  37. data/lib/qubrics_sending_generated/models/inline_attachment.rb +274 -0
  38. data/lib/qubrics_sending_generated/models/meta.rb +165 -0
  39. data/lib/qubrics_sending_generated/models/recipient.rb +214 -0
  40. data/lib/qubrics_sending_generated/models/send_success_data.rb +227 -0
  41. data/lib/qubrics_sending_generated/models/send_success_response.rb +223 -0
  42. data/lib/qubrics_sending_generated/models/success_envelope.rb +190 -0
  43. data/lib/qubrics_sending_generated/models/uploaded_attachment_ref.rb +176 -0
  44. data/lib/qubrics_sending_generated/version.rb +15 -0
  45. data/lib/qubrics_sending_generated.rb +72 -0
  46. metadata +168 -0
@@ -0,0 +1,251 @@
1
+ =begin
2
+ #Qubrics Sending API
3
+
4
+ #Send emails programmatically via the Qubrics email infrastructure. Every response carries an `X-Request-Id` header; errors include a `retryable` flag. 429 and 503 responses include `Retry-After`. Mutating endpoints accept an `Idempotency-Key` header for safe retries.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Qubrics::Sending::Generated
17
+ class ErrorDetail < ApiModelBase
18
+ # Machine-readable error code
19
+ attr_accessor :code
20
+
21
+ # Link to error documentation
22
+ attr_accessor :doc_url
23
+
24
+ # Accumulated per-field issues (validation errors)
25
+ attr_accessor :errors
26
+
27
+ # Human-readable error description
28
+ attr_accessor :message
29
+
30
+ # Parameter that caused the error
31
+ attr_accessor :param
32
+
33
+ # True when the client may safely retry the same request. 429 and 5xx default true; 4xx default false.
34
+ attr_accessor :retryable
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'code' => :'code',
40
+ :'doc_url' => :'doc_url',
41
+ :'errors' => :'errors',
42
+ :'message' => :'message',
43
+ :'param' => :'param',
44
+ :'retryable' => :'retryable'
45
+ }
46
+ end
47
+
48
+ # Returns attribute mapping this model knows about
49
+ def self.acceptable_attribute_map
50
+ attribute_map
51
+ end
52
+
53
+ # Returns all the JSON keys this model knows about
54
+ def self.acceptable_attributes
55
+ acceptable_attribute_map.values
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'code' => :'String',
62
+ :'doc_url' => :'String',
63
+ :'errors' => :'Array<ErrorIssue>',
64
+ :'message' => :'String',
65
+ :'param' => :'String',
66
+ :'retryable' => :'Boolean'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Qubrics::Sending::Generated::ErrorDetail` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ acceptable_attribute_map = self.class.acceptable_attribute_map
85
+ attributes = attributes.each_with_object({}) { |(k, v), h|
86
+ if (!acceptable_attribute_map.key?(k.to_sym))
87
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Qubrics::Sending::Generated::ErrorDetail`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
88
+ end
89
+ h[k.to_sym] = v
90
+ }
91
+
92
+ if attributes.key?(:'code')
93
+ self.code = attributes[:'code']
94
+ else
95
+ self.code = nil
96
+ end
97
+
98
+ if attributes.key?(:'doc_url')
99
+ self.doc_url = attributes[:'doc_url']
100
+ end
101
+
102
+ if attributes.key?(:'errors')
103
+ if (value = attributes[:'errors']).is_a?(Array)
104
+ self.errors = value
105
+ end
106
+ end
107
+
108
+ if attributes.key?(:'message')
109
+ self.message = attributes[:'message']
110
+ else
111
+ self.message = nil
112
+ end
113
+
114
+ if attributes.key?(:'param')
115
+ self.param = attributes[:'param']
116
+ end
117
+
118
+ if attributes.key?(:'retryable')
119
+ self.retryable = attributes[:'retryable']
120
+ else
121
+ self.retryable = nil
122
+ end
123
+ end
124
+
125
+ # Show invalid properties with the reasons. Usually used together with valid?
126
+ # @return Array for valid properties with the reasons
127
+ def list_invalid_properties
128
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
129
+ invalid_properties = Array.new
130
+ if @code.nil?
131
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
132
+ end
133
+
134
+ if @message.nil?
135
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
136
+ end
137
+
138
+ if @retryable.nil?
139
+ invalid_properties.push('invalid value for "retryable", retryable cannot be nil.')
140
+ end
141
+
142
+ invalid_properties
143
+ end
144
+
145
+ # Check to see if the all the properties in the model are valid
146
+ # @return true if the model is valid
147
+ def valid?
148
+ warn '[DEPRECATED] the `valid?` method is obsolete'
149
+ return false if @code.nil?
150
+ return false if @message.nil?
151
+ return false if @retryable.nil?
152
+ true
153
+ end
154
+
155
+ # Custom attribute writer method with validation
156
+ # @param [Object] code Value to be assigned
157
+ def code=(code)
158
+ if code.nil?
159
+ fail ArgumentError, 'code cannot be nil'
160
+ end
161
+
162
+ @code = code
163
+ end
164
+
165
+ # Custom attribute writer method with validation
166
+ # @param [Object] message Value to be assigned
167
+ def message=(message)
168
+ if message.nil?
169
+ fail ArgumentError, 'message cannot be nil'
170
+ end
171
+
172
+ @message = message
173
+ end
174
+
175
+ # Custom attribute writer method with validation
176
+ # @param [Object] retryable Value to be assigned
177
+ def retryable=(retryable)
178
+ if retryable.nil?
179
+ fail ArgumentError, 'retryable cannot be nil'
180
+ end
181
+
182
+ @retryable = retryable
183
+ end
184
+
185
+ # Checks equality by comparing each attribute.
186
+ # @param [Object] Object to be compared
187
+ def ==(o)
188
+ return true if self.equal?(o)
189
+ self.class == o.class &&
190
+ code == o.code &&
191
+ doc_url == o.doc_url &&
192
+ errors == o.errors &&
193
+ message == o.message &&
194
+ param == o.param &&
195
+ retryable == o.retryable
196
+ end
197
+
198
+ # @see the `==` method
199
+ # @param [Object] Object to be compared
200
+ def eql?(o)
201
+ self == o
202
+ end
203
+
204
+ # Calculates hash code according to all attributes.
205
+ # @return [Integer] Hash code
206
+ def hash
207
+ [code, doc_url, errors, message, param, retryable].hash
208
+ end
209
+
210
+ # Builds the object from hash
211
+ # @param [Hash] attributes Model attributes in the form of hash
212
+ # @return [Object] Returns the model itself
213
+ def self.build_from_hash(attributes)
214
+ return nil unless attributes.is_a?(Hash)
215
+ attributes = attributes.transform_keys(&:to_sym)
216
+ transformed_hash = {}
217
+ openapi_types.each_pair do |key, type|
218
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
219
+ transformed_hash["#{key}"] = nil
220
+ elsif type =~ /\AArray<(.*)>/i
221
+ # check to ensure the input is an array given that the attribute
222
+ # is documented as an array but the input is not
223
+ if attributes[attribute_map[key]].is_a?(Array)
224
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
225
+ end
226
+ elsif !attributes[attribute_map[key]].nil?
227
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
228
+ end
229
+ end
230
+ new(transformed_hash)
231
+ end
232
+
233
+ # Returns the object in the form of hash
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_hash
236
+ hash = {}
237
+ self.class.attribute_map.each_pair do |attr, param|
238
+ value = self.send(attr)
239
+ if value.nil?
240
+ is_nullable = self.class.openapi_nullable.include?(attr)
241
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
242
+ end
243
+
244
+ hash[param] = _to_hash(value)
245
+ end
246
+ hash
247
+ end
248
+
249
+ end
250
+
251
+ end
@@ -0,0 +1,219 @@
1
+ =begin
2
+ #Qubrics Sending API
3
+
4
+ #Send emails programmatically via the Qubrics email infrastructure. Every response carries an `X-Request-Id` header; errors include a `retryable` flag. 429 and 503 responses include `Retry-After`. Mutating endpoints accept an `Idempotency-Key` header for safe retries.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Qubrics::Sending::Generated
17
+ class ErrorIssue < ApiModelBase
18
+ # Issue code from the validator
19
+ attr_accessor :code
20
+
21
+ # Dot-path to the failing field
22
+ attr_accessor :field
23
+
24
+ # Human-readable issue message
25
+ attr_accessor :message
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'code' => :'code',
31
+ :'field' => :'field',
32
+ :'message' => :'message'
33
+ }
34
+ end
35
+
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ acceptable_attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'code' => :'String',
50
+ :'field' => :'String',
51
+ :'message' => :'String'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Qubrics::Sending::Generated::ErrorIssue` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Qubrics::Sending::Generated::ErrorIssue`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'code')
78
+ self.code = attributes[:'code']
79
+ else
80
+ self.code = nil
81
+ end
82
+
83
+ if attributes.key?(:'field')
84
+ self.field = attributes[:'field']
85
+ else
86
+ self.field = nil
87
+ end
88
+
89
+ if attributes.key?(:'message')
90
+ self.message = attributes[:'message']
91
+ else
92
+ self.message = nil
93
+ end
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properties with the reasons
98
+ def list_invalid_properties
99
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
100
+ invalid_properties = Array.new
101
+ if @code.nil?
102
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
103
+ end
104
+
105
+ if @field.nil?
106
+ invalid_properties.push('invalid value for "field", field cannot be nil.')
107
+ end
108
+
109
+ if @message.nil?
110
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
111
+ end
112
+
113
+ invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ warn '[DEPRECATED] the `valid?` method is obsolete'
120
+ return false if @code.nil?
121
+ return false if @field.nil?
122
+ return false if @message.nil?
123
+ true
124
+ end
125
+
126
+ # Custom attribute writer method with validation
127
+ # @param [Object] code Value to be assigned
128
+ def code=(code)
129
+ if code.nil?
130
+ fail ArgumentError, 'code cannot be nil'
131
+ end
132
+
133
+ @code = code
134
+ end
135
+
136
+ # Custom attribute writer method with validation
137
+ # @param [Object] field Value to be assigned
138
+ def field=(field)
139
+ if field.nil?
140
+ fail ArgumentError, 'field cannot be nil'
141
+ end
142
+
143
+ @field = field
144
+ end
145
+
146
+ # Custom attribute writer method with validation
147
+ # @param [Object] message Value to be assigned
148
+ def message=(message)
149
+ if message.nil?
150
+ fail ArgumentError, 'message cannot be nil'
151
+ end
152
+
153
+ @message = message
154
+ end
155
+
156
+ # Checks equality by comparing each attribute.
157
+ # @param [Object] Object to be compared
158
+ def ==(o)
159
+ return true if self.equal?(o)
160
+ self.class == o.class &&
161
+ code == o.code &&
162
+ field == o.field &&
163
+ message == o.message
164
+ end
165
+
166
+ # @see the `==` method
167
+ # @param [Object] Object to be compared
168
+ def eql?(o)
169
+ self == o
170
+ end
171
+
172
+ # Calculates hash code according to all attributes.
173
+ # @return [Integer] Hash code
174
+ def hash
175
+ [code, field, message].hash
176
+ end
177
+
178
+ # Builds the object from hash
179
+ # @param [Hash] attributes Model attributes in the form of hash
180
+ # @return [Object] Returns the model itself
181
+ def self.build_from_hash(attributes)
182
+ return nil unless attributes.is_a?(Hash)
183
+ attributes = attributes.transform_keys(&:to_sym)
184
+ transformed_hash = {}
185
+ openapi_types.each_pair do |key, type|
186
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
187
+ transformed_hash["#{key}"] = nil
188
+ elsif type =~ /\AArray<(.*)>/i
189
+ # check to ensure the input is an array given that the attribute
190
+ # is documented as an array but the input is not
191
+ if attributes[attribute_map[key]].is_a?(Array)
192
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
193
+ end
194
+ elsif !attributes[attribute_map[key]].nil?
195
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
196
+ end
197
+ end
198
+ new(transformed_hash)
199
+ end
200
+
201
+ # Returns the object in the form of hash
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_hash
204
+ hash = {}
205
+ self.class.attribute_map.each_pair do |attr, param|
206
+ value = self.send(attr)
207
+ if value.nil?
208
+ is_nullable = self.class.openapi_nullable.include?(attr)
209
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
210
+ end
211
+
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ end
218
+
219
+ end
@@ -0,0 +1,216 @@
1
+ =begin
2
+ #Qubrics Sending API
3
+
4
+ #Send emails programmatically via the Qubrics email infrastructure. Every response carries an `X-Request-Id` header; errors include a `retryable` flag. 429 and 503 responses include `Retry-After`. Mutating endpoints accept an `Idempotency-Key` header for safe retries.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Qubrics::Sending::Generated
17
+ class ErrorResponse < ApiModelBase
18
+ attr_accessor :error
19
+
20
+ attr_accessor :meta
21
+
22
+ attr_accessor :ok
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'error' => :'error',
28
+ :'meta' => :'meta',
29
+ :'ok' => :'ok'
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
+ :'error' => :'ErrorDetail',
47
+ :'meta' => :'Meta',
48
+ :'ok' => :'Boolean'
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 `Qubrics::Sending::Generated::ErrorResponse` 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 `Qubrics::Sending::Generated::ErrorResponse`. 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?(:'error')
75
+ self.error = attributes[:'error']
76
+ else
77
+ self.error = nil
78
+ end
79
+
80
+ if attributes.key?(:'meta')
81
+ self.meta = attributes[:'meta']
82
+ else
83
+ self.meta = nil
84
+ end
85
+
86
+ if attributes.key?(:'ok')
87
+ self.ok = attributes[:'ok']
88
+ else
89
+ self.ok = 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 @error.nil?
99
+ invalid_properties.push('invalid value for "error", error cannot be nil.')
100
+ end
101
+
102
+ if @meta.nil?
103
+ invalid_properties.push('invalid value for "meta", meta cannot be nil.')
104
+ end
105
+
106
+ if @ok.nil?
107
+ invalid_properties.push('invalid value for "ok", ok 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 @error.nil?
118
+ return false if @meta.nil?
119
+ return false if @ok.nil?
120
+ true
121
+ end
122
+
123
+ # Custom attribute writer method with validation
124
+ # @param [Object] error Value to be assigned
125
+ def error=(error)
126
+ if error.nil?
127
+ fail ArgumentError, 'error cannot be nil'
128
+ end
129
+
130
+ @error = error
131
+ end
132
+
133
+ # Custom attribute writer method with validation
134
+ # @param [Object] meta Value to be assigned
135
+ def meta=(meta)
136
+ if meta.nil?
137
+ fail ArgumentError, 'meta cannot be nil'
138
+ end
139
+
140
+ @meta = meta
141
+ end
142
+
143
+ # Custom attribute writer method with validation
144
+ # @param [Object] ok Value to be assigned
145
+ def ok=(ok)
146
+ if ok.nil?
147
+ fail ArgumentError, 'ok cannot be nil'
148
+ end
149
+
150
+ @ok = ok
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
+ error == o.error &&
159
+ meta == o.meta &&
160
+ ok == o.ok
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
+ [error, meta, ok].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