sendmux-management 1.1.1 → 1.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/README.md +16 -1
- data/lib/sendmux/management/client.rb +13 -2
- data/lib/sendmux/management/version.rb +1 -1
- data/lib/sendmux_management_generated/api/billing_api.rb +5 -5
- data/lib/sendmux_management_generated/api/connection_api.rb +82 -0
- data/lib/sendmux_management_generated/api/domain_filters_api.rb +2 -2
- data/lib/sendmux_management_generated/api/domains_api.rb +7 -7
- data/lib/sendmux_management_generated/api/emails_api.rb +3 -3
- data/lib/sendmux_management_generated/api/inboxes_api.rb +2 -2
- data/lib/sendmux_management_generated/api/mailbox_filters_api.rb +2 -2
- data/lib/sendmux_management_generated/api/mailboxes_api.rb +10 -10
- data/lib/sendmux_management_generated/api/sending_accounts_api.rb +15 -15
- data/lib/sendmux_management_generated/api/webhooks_api.rb +9 -9
- data/lib/sendmux_management_generated/configuration.rb +7 -0
- data/lib/sendmux_management_generated/models/balance.rb +1 -1
- data/lib/sendmux_management_generated/models/connection.rb +273 -0
- data/lib/sendmux_management_generated/models/connection_credential.rb +226 -0
- data/lib/sendmux_management_generated/models/connection_mailboxes_inner.rb +190 -0
- data/lib/sendmux_management_generated/models/connection_response.rb +223 -0
- data/lib/sendmux_management_generated/models/connection_team.rb +190 -0
- data/lib/sendmux_management_generated/models/management_create_mailbox_request.rb +11 -0
- data/lib/sendmux_management_generated.rb +6 -0
- metadata +18 -6
|
@@ -71,7 +71,7 @@ module Sendmux::Management::Generated
|
|
|
71
71
|
return_type = opts[:debug_return_type] || 'WebhookSubscriptionWithSecretResponse'
|
|
72
72
|
|
|
73
73
|
# auth_names
|
|
74
|
-
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
74
|
+
auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
|
|
75
75
|
|
|
76
76
|
new_options = opts.merge(
|
|
77
77
|
:operation => :"WebhooksApi.management_create_webhook",
|
|
@@ -134,7 +134,7 @@ module Sendmux::Management::Generated
|
|
|
134
134
|
return_type = opts[:debug_return_type] || 'WebhookDeletedResponse'
|
|
135
135
|
|
|
136
136
|
# auth_names
|
|
137
|
-
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
137
|
+
auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
|
|
138
138
|
|
|
139
139
|
new_options = opts.merge(
|
|
140
140
|
:operation => :"WebhooksApi.management_delete_webhook",
|
|
@@ -203,7 +203,7 @@ module Sendmux::Management::Generated
|
|
|
203
203
|
return_type = opts[:debug_return_type] || 'WebhookDeliveryPayloadResponse'
|
|
204
204
|
|
|
205
205
|
# auth_names
|
|
206
|
-
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
206
|
+
auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
|
|
207
207
|
|
|
208
208
|
new_options = opts.merge(
|
|
209
209
|
:operation => :"WebhooksApi.management_get_delivery_payload",
|
|
@@ -269,7 +269,7 @@ module Sendmux::Management::Generated
|
|
|
269
269
|
return_type = opts[:debug_return_type] || 'WebhookSubscriptionResponse'
|
|
270
270
|
|
|
271
271
|
# auth_names
|
|
272
|
-
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
272
|
+
auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
|
|
273
273
|
|
|
274
274
|
new_options = opts.merge(
|
|
275
275
|
:operation => :"WebhooksApi.management_get_webhook",
|
|
@@ -360,7 +360,7 @@ module Sendmux::Management::Generated
|
|
|
360
360
|
return_type = opts[:debug_return_type] || 'WebhookDeliveryAttemptCursorListResponse'
|
|
361
361
|
|
|
362
362
|
# auth_names
|
|
363
|
-
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
363
|
+
auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
|
|
364
364
|
|
|
365
365
|
new_options = opts.merge(
|
|
366
366
|
:operation => :"WebhooksApi.management_list_delivery",
|
|
@@ -431,7 +431,7 @@ module Sendmux::Management::Generated
|
|
|
431
431
|
return_type = opts[:debug_return_type] || 'WebhookSubscriptionCursorListResponse'
|
|
432
432
|
|
|
433
433
|
# auth_names
|
|
434
|
-
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
434
|
+
auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
|
|
435
435
|
|
|
436
436
|
new_options = opts.merge(
|
|
437
437
|
:operation => :"WebhooksApi.management_list_webhooks",
|
|
@@ -501,7 +501,7 @@ module Sendmux::Management::Generated
|
|
|
501
501
|
return_type = opts[:debug_return_type] || 'WebhookSubscriptionWithSecretResponse'
|
|
502
502
|
|
|
503
503
|
# auth_names
|
|
504
|
-
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
504
|
+
auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
|
|
505
505
|
|
|
506
506
|
new_options = opts.merge(
|
|
507
507
|
:operation => :"WebhooksApi.management_rotate_webhook_secret",
|
|
@@ -571,7 +571,7 @@ module Sendmux::Management::Generated
|
|
|
571
571
|
return_type = opts[:debug_return_type] || 'ManagementTestWebhook200Response'
|
|
572
572
|
|
|
573
573
|
# auth_names
|
|
574
|
-
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
574
|
+
auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
|
|
575
575
|
|
|
576
576
|
new_options = opts.merge(
|
|
577
577
|
:operation => :"WebhooksApi.management_test_webhook",
|
|
@@ -644,7 +644,7 @@ module Sendmux::Management::Generated
|
|
|
644
644
|
return_type = opts[:debug_return_type] || 'WebhookSubscriptionResponse'
|
|
645
645
|
|
|
646
646
|
# auth_names
|
|
647
|
-
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
647
|
+
auth_names = opts[:debug_auth_names] || ['oauth2', 'bearerAuth']
|
|
648
648
|
|
|
649
649
|
new_options = opts.merge(
|
|
650
650
|
:operation => :"WebhooksApi.management_update_webhook",
|
|
@@ -256,6 +256,13 @@ module Sendmux::Management::Generated
|
|
|
256
256
|
key: 'Authorization',
|
|
257
257
|
value: "Bearer #{access_token_with_refresh}"
|
|
258
258
|
},
|
|
259
|
+
'oauth2' =>
|
|
260
|
+
{
|
|
261
|
+
type: 'oauth2',
|
|
262
|
+
in: 'header',
|
|
263
|
+
key: 'Authorization',
|
|
264
|
+
value: "Bearer #{access_token_with_refresh}"
|
|
265
|
+
},
|
|
259
266
|
}
|
|
260
267
|
end
|
|
261
268
|
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Sendmux API
|
|
3
|
+
|
|
4
|
+
#Programmatic access to your Sendmux email infrastructure.
|
|
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 Sendmux::Management::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 `Sendmux::Management::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 `Sendmux::Management::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
|
+
#Sendmux API
|
|
3
|
+
|
|
4
|
+
#Programmatic access to your Sendmux email infrastructure.
|
|
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 Sendmux::Management::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 `Sendmux::Management::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 `Sendmux::Management::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
|