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,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 BatchSummary < ApiModelBase
18
+ # Failed count
19
+ attr_accessor :failed
20
+
21
+ # Successfully queued count
22
+ attr_accessor :queued
23
+
24
+ # Total messages in batch
25
+ attr_accessor :total
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'failed' => :'failed',
31
+ :'queued' => :'queued',
32
+ :'total' => :'total'
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
+ :'failed' => :'Integer',
50
+ :'queued' => :'Integer',
51
+ :'total' => :'Integer'
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::BatchSummary` 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::BatchSummary`. 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?(:'failed')
78
+ self.failed = attributes[:'failed']
79
+ else
80
+ self.failed = nil
81
+ end
82
+
83
+ if attributes.key?(:'queued')
84
+ self.queued = attributes[:'queued']
85
+ else
86
+ self.queued = nil
87
+ end
88
+
89
+ if attributes.key?(:'total')
90
+ self.total = attributes[:'total']
91
+ else
92
+ self.total = 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 @failed.nil?
102
+ invalid_properties.push('invalid value for "failed", failed cannot be nil.')
103
+ end
104
+
105
+ if @queued.nil?
106
+ invalid_properties.push('invalid value for "queued", queued cannot be nil.')
107
+ end
108
+
109
+ if @total.nil?
110
+ invalid_properties.push('invalid value for "total", total 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 @failed.nil?
121
+ return false if @queued.nil?
122
+ return false if @total.nil?
123
+ true
124
+ end
125
+
126
+ # Custom attribute writer method with validation
127
+ # @param [Object] failed Value to be assigned
128
+ def failed=(failed)
129
+ if failed.nil?
130
+ fail ArgumentError, 'failed cannot be nil'
131
+ end
132
+
133
+ @failed = failed
134
+ end
135
+
136
+ # Custom attribute writer method with validation
137
+ # @param [Object] queued Value to be assigned
138
+ def queued=(queued)
139
+ if queued.nil?
140
+ fail ArgumentError, 'queued cannot be nil'
141
+ end
142
+
143
+ @queued = queued
144
+ end
145
+
146
+ # Custom attribute writer method with validation
147
+ # @param [Object] total Value to be assigned
148
+ def total=(total)
149
+ if total.nil?
150
+ fail ArgumentError, 'total cannot be nil'
151
+ end
152
+
153
+ @total = total
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
+ failed == o.failed &&
162
+ queued == o.queued &&
163
+ total == o.total
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
+ [failed, queued, total].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,273 @@
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 Connection < ApiModelBase
18
+ attr_accessor :credential
19
+
20
+ # Display label for this connection.
21
+ attr_accessor :label
22
+
23
+ attr_accessor :mailboxes
24
+
25
+ attr_accessor :permissions
26
+
27
+ attr_accessor :team
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'credential' => :'credential',
33
+ :'label' => :'label',
34
+ :'mailboxes' => :'mailboxes',
35
+ :'permissions' => :'permissions',
36
+ :'team' => :'team'
37
+ }
38
+ end
39
+
40
+ # Returns attribute mapping this model knows about
41
+ def self.acceptable_attribute_map
42
+ attribute_map
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ acceptable_attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'credential' => :'ConnectionCredential',
54
+ :'label' => :'String',
55
+ :'mailboxes' => :'Array<ConnectionMailboxesInner>',
56
+ :'permissions' => :'Array<String>',
57
+ :'team' => :'ConnectionTeam'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Qubrics::Sending::Generated::Connection` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ acceptable_attribute_map = self.class.acceptable_attribute_map
76
+ attributes = attributes.each_with_object({}) { |(k, v), h|
77
+ if (!acceptable_attribute_map.key?(k.to_sym))
78
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Qubrics::Sending::Generated::Connection`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
79
+ end
80
+ h[k.to_sym] = v
81
+ }
82
+
83
+ if attributes.key?(:'credential')
84
+ self.credential = attributes[:'credential']
85
+ else
86
+ self.credential = nil
87
+ end
88
+
89
+ if attributes.key?(:'label')
90
+ self.label = attributes[:'label']
91
+ else
92
+ self.label = nil
93
+ end
94
+
95
+ if attributes.key?(:'mailboxes')
96
+ if (value = attributes[:'mailboxes']).is_a?(Array)
97
+ self.mailboxes = value
98
+ end
99
+ else
100
+ self.mailboxes = nil
101
+ end
102
+
103
+ if attributes.key?(:'permissions')
104
+ if (value = attributes[:'permissions']).is_a?(Array)
105
+ self.permissions = value
106
+ end
107
+ else
108
+ self.permissions = nil
109
+ end
110
+
111
+ if attributes.key?(:'team')
112
+ self.team = attributes[:'team']
113
+ else
114
+ self.team = nil
115
+ end
116
+ end
117
+
118
+ # Show invalid properties with the reasons. Usually used together with valid?
119
+ # @return Array for valid properties with the reasons
120
+ def list_invalid_properties
121
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
122
+ invalid_properties = Array.new
123
+ if @credential.nil?
124
+ invalid_properties.push('invalid value for "credential", credential cannot be nil.')
125
+ end
126
+
127
+ if @label.nil?
128
+ invalid_properties.push('invalid value for "label", label cannot be nil.')
129
+ end
130
+
131
+ if @mailboxes.nil?
132
+ invalid_properties.push('invalid value for "mailboxes", mailboxes cannot be nil.')
133
+ end
134
+
135
+ if @permissions.nil?
136
+ invalid_properties.push('invalid value for "permissions", permissions cannot be nil.')
137
+ end
138
+
139
+ if @team.nil?
140
+ invalid_properties.push('invalid value for "team", team cannot be nil.')
141
+ end
142
+
143
+ invalid_properties
144
+ end
145
+
146
+ # Check to see if the all the properties in the model are valid
147
+ # @return true if the model is valid
148
+ def valid?
149
+ warn '[DEPRECATED] the `valid?` method is obsolete'
150
+ return false if @credential.nil?
151
+ return false if @label.nil?
152
+ return false if @mailboxes.nil?
153
+ return false if @permissions.nil?
154
+ return false if @team.nil?
155
+ true
156
+ end
157
+
158
+ # Custom attribute writer method with validation
159
+ # @param [Object] credential Value to be assigned
160
+ def credential=(credential)
161
+ if credential.nil?
162
+ fail ArgumentError, 'credential cannot be nil'
163
+ end
164
+
165
+ @credential = credential
166
+ end
167
+
168
+ # Custom attribute writer method with validation
169
+ # @param [Object] label Value to be assigned
170
+ def label=(label)
171
+ if label.nil?
172
+ fail ArgumentError, 'label cannot be nil'
173
+ end
174
+
175
+ @label = label
176
+ end
177
+
178
+ # Custom attribute writer method with validation
179
+ # @param [Object] mailboxes Value to be assigned
180
+ def mailboxes=(mailboxes)
181
+ if mailboxes.nil?
182
+ fail ArgumentError, 'mailboxes cannot be nil'
183
+ end
184
+
185
+ @mailboxes = mailboxes
186
+ end
187
+
188
+ # Custom attribute writer method with validation
189
+ # @param [Object] permissions Value to be assigned
190
+ def permissions=(permissions)
191
+ if permissions.nil?
192
+ fail ArgumentError, 'permissions cannot be nil'
193
+ end
194
+
195
+ @permissions = permissions
196
+ end
197
+
198
+ # Custom attribute writer method with validation
199
+ # @param [Object] team Value to be assigned
200
+ def team=(team)
201
+ if team.nil?
202
+ fail ArgumentError, 'team cannot be nil'
203
+ end
204
+
205
+ @team = team
206
+ end
207
+
208
+ # Checks equality by comparing each attribute.
209
+ # @param [Object] Object to be compared
210
+ def ==(o)
211
+ return true if self.equal?(o)
212
+ self.class == o.class &&
213
+ credential == o.credential &&
214
+ label == o.label &&
215
+ mailboxes == o.mailboxes &&
216
+ permissions == o.permissions &&
217
+ team == o.team
218
+ end
219
+
220
+ # @see the `==` method
221
+ # @param [Object] Object to be compared
222
+ def eql?(o)
223
+ self == o
224
+ end
225
+
226
+ # Calculates hash code according to all attributes.
227
+ # @return [Integer] Hash code
228
+ def hash
229
+ [credential, label, mailboxes, permissions, team].hash
230
+ end
231
+
232
+ # Builds the object from hash
233
+ # @param [Hash] attributes Model attributes in the form of hash
234
+ # @return [Object] Returns the model itself
235
+ def self.build_from_hash(attributes)
236
+ return nil unless attributes.is_a?(Hash)
237
+ attributes = attributes.transform_keys(&:to_sym)
238
+ transformed_hash = {}
239
+ openapi_types.each_pair do |key, type|
240
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
241
+ transformed_hash["#{key}"] = nil
242
+ elsif type =~ /\AArray<(.*)>/i
243
+ # check to ensure the input is an array given that the attribute
244
+ # is documented as an array but the input is not
245
+ if attributes[attribute_map[key]].is_a?(Array)
246
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
247
+ end
248
+ elsif !attributes[attribute_map[key]].nil?
249
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
250
+ end
251
+ end
252
+ new(transformed_hash)
253
+ end
254
+
255
+ # Returns the object in the form of hash
256
+ # @return [Hash] Returns the object in the form of hash
257
+ def to_hash
258
+ hash = {}
259
+ self.class.attribute_map.each_pair do |attr, param|
260
+ value = self.send(attr)
261
+ if value.nil?
262
+ is_nullable = self.class.openapi_nullable.include?(attr)
263
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
264
+ end
265
+
266
+ hash[param] = _to_hash(value)
267
+ end
268
+ hash
269
+ end
270
+
271
+ end
272
+
273
+ end
@@ -0,0 +1,226 @@
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 ConnectionCredential < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :name
21
+
22
+ attr_accessor :type
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'id' => :'id',
50
+ :'name' => :'name',
51
+ :'type' => :'type'
52
+ }
53
+ end
54
+
55
+ # Returns attribute mapping this model knows about
56
+ def self.acceptable_attribute_map
57
+ attribute_map
58
+ end
59
+
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ acceptable_attribute_map.values
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'id' => :'String',
69
+ :'name' => :'String',
70
+ :'type' => :'String'
71
+ }
72
+ end
73
+
74
+ # List of attributes with nullable: true
75
+ def self.openapi_nullable
76
+ Set.new([
77
+ :'name',
78
+ ])
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ if (!attributes.is_a?(Hash))
85
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Qubrics::Sending::Generated::ConnectionCredential` initialize method"
86
+ end
87
+
88
+ # check to see if the attribute exists and convert string to symbol for hash key
89
+ acceptable_attribute_map = self.class.acceptable_attribute_map
90
+ attributes = attributes.each_with_object({}) { |(k, v), h|
91
+ if (!acceptable_attribute_map.key?(k.to_sym))
92
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Qubrics::Sending::Generated::ConnectionCredential`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
93
+ end
94
+ h[k.to_sym] = v
95
+ }
96
+
97
+ if attributes.key?(:'id')
98
+ self.id = attributes[:'id']
99
+ else
100
+ self.id = nil
101
+ end
102
+
103
+ if attributes.key?(:'name')
104
+ self.name = attributes[:'name']
105
+ else
106
+ self.name = nil
107
+ end
108
+
109
+ if attributes.key?(:'type')
110
+ self.type = attributes[:'type']
111
+ else
112
+ self.type = nil
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
120
+ invalid_properties = Array.new
121
+ if @id.nil?
122
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
123
+ end
124
+
125
+ if @type.nil?
126
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
127
+ end
128
+
129
+ invalid_properties
130
+ end
131
+
132
+ # Check to see if the all the properties in the model are valid
133
+ # @return true if the model is valid
134
+ def valid?
135
+ warn '[DEPRECATED] the `valid?` method is obsolete'
136
+ return false if @id.nil?
137
+ return false if @type.nil?
138
+ type_validator = EnumAttributeValidator.new('String', ["api_key", "oauth", "agent_token", "unknown_default_open_api"])
139
+ return false unless type_validator.valid?(@type)
140
+ true
141
+ end
142
+
143
+ # Custom attribute writer method with validation
144
+ # @param [Object] id Value to be assigned
145
+ def id=(id)
146
+ if id.nil?
147
+ fail ArgumentError, 'id cannot be nil'
148
+ end
149
+
150
+ @id = id
151
+ end
152
+
153
+ # Custom attribute writer method checking allowed values (enum).
154
+ # @param [Object] type Object to be assigned
155
+ def type=(type)
156
+ validator = EnumAttributeValidator.new('String', ["api_key", "oauth", "agent_token", "unknown_default_open_api"])
157
+ unless validator.valid?(type)
158
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
159
+ end
160
+ @type = type
161
+ end
162
+
163
+ # Checks equality by comparing each attribute.
164
+ # @param [Object] Object to be compared
165
+ def ==(o)
166
+ return true if self.equal?(o)
167
+ self.class == o.class &&
168
+ id == o.id &&
169
+ name == o.name &&
170
+ type == o.type
171
+ end
172
+
173
+ # @see the `==` method
174
+ # @param [Object] Object to be compared
175
+ def eql?(o)
176
+ self == o
177
+ end
178
+
179
+ # Calculates hash code according to all attributes.
180
+ # @return [Integer] Hash code
181
+ def hash
182
+ [id, name, type].hash
183
+ end
184
+
185
+ # Builds the object from hash
186
+ # @param [Hash] attributes Model attributes in the form of hash
187
+ # @return [Object] Returns the model itself
188
+ def self.build_from_hash(attributes)
189
+ return nil unless attributes.is_a?(Hash)
190
+ attributes = attributes.transform_keys(&:to_sym)
191
+ transformed_hash = {}
192
+ openapi_types.each_pair do |key, type|
193
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
194
+ transformed_hash["#{key}"] = nil
195
+ elsif type =~ /\AArray<(.*)>/i
196
+ # check to ensure the input is an array given that the attribute
197
+ # is documented as an array but the input is not
198
+ if attributes[attribute_map[key]].is_a?(Array)
199
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
200
+ end
201
+ elsif !attributes[attribute_map[key]].nil?
202
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
203
+ end
204
+ end
205
+ new(transformed_hash)
206
+ end
207
+
208
+ # Returns the object in the form of hash
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_hash
211
+ hash = {}
212
+ self.class.attribute_map.each_pair do |attr, param|
213
+ value = self.send(attr)
214
+ if value.nil?
215
+ is_nullable = self.class.openapi_nullable.include?(attr)
216
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
217
+ end
218
+
219
+ hash[param] = _to_hash(value)
220
+ end
221
+ hash
222
+ end
223
+
224
+ end
225
+
226
+ end