Class: Sendmux::Management::Generated::ProviderCreateBody

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/sendmux_management_generated/models/provider_create_body.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ ProviderCreateBody

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 127

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Sendmux::Management::Generated::ProviderCreateBody` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Sendmux::Management::Generated::ProviderCreateBody`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'from_email')
    self.from_email = attributes[:'from_email']
  end

  if attributes.key?(:'from_name')
    self.from_name = attributes[:'from_name']
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  else
    self.name = nil
  end

  if attributes.key?(:'percentage')
    self.percentage = attributes[:'percentage']
  end

  if attributes.key?(:'quotas')
    self.quotas = attributes[:'quotas']
  end

  if attributes.key?(:'reply_to_email')
    self.reply_to_email = attributes[:'reply_to_email']
  end

  if attributes.key?(:'reply_to_name')
    self.reply_to_name = attributes[:'reply_to_name']
  end

  if attributes.key?(:'smtp_host')
    self.smtp_host = attributes[:'smtp_host']
  else
    self.smtp_host = nil
  end

  if attributes.key?(:'smtp_password')
    self.smtp_password = attributes[:'smtp_password']
  else
    self.smtp_password = nil
  end

  if attributes.key?(:'smtp_port')
    self.smtp_port = attributes[:'smtp_port']
  else
    self.smtp_port = nil
  end

  if attributes.key?(:'smtp_protocol')
    self.smtp_protocol = attributes[:'smtp_protocol']
  else
    self.smtp_protocol = nil
  end

  if attributes.key?(:'smtp_username')
    self.smtp_username = attributes[:'smtp_username']
  else
    self.smtp_username = nil
  end

  if attributes.key?(:'tracking_domain')
    self.tracking_domain = attributes[:'tracking_domain']
  end
end

Instance Attribute Details

#from_emailObject

Returns the value of attribute from_email.



18
19
20
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 18

def from_email
  @from_email
end

#from_nameObject

Returns the value of attribute from_name.



20
21
22
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 20

def from_name
  @from_name
end

#nameObject

Returns the value of attribute name.



22
23
24
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 22

def name
  @name
end

#percentageObject

Returns the value of attribute percentage.



24
25
26
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 24

def percentage
  @percentage
end

#quotasObject

Returns the value of attribute quotas.



26
27
28
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 26

def quotas
  @quotas
end

#reply_to_emailObject

Returns the value of attribute reply_to_email.



28
29
30
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 28

def reply_to_email
  @reply_to_email
end

#reply_to_nameObject

Returns the value of attribute reply_to_name.



30
31
32
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 30

def reply_to_name
  @reply_to_name
end

#smtp_hostObject

Returns the value of attribute smtp_host.



32
33
34
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 32

def smtp_host
  @smtp_host
end

#smtp_passwordObject

Returns the value of attribute smtp_password.



34
35
36
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 34

def smtp_password
  @smtp_password
end

#smtp_portObject

Returns the value of attribute smtp_port.



36
37
38
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 36

def smtp_port
  @smtp_port
end

#smtp_protocolObject

Returns the value of attribute smtp_protocol.



38
39
40
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 38

def smtp_protocol
  @smtp_protocol
end

#smtp_usernameObject

Returns the value of attribute smtp_username.



40
41
42
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 40

def smtp_username
  @smtp_username
end

#tracking_domainObject

Returns the value of attribute tracking_domain.



42
43
44
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 42

def tracking_domain
  @tracking_domain
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



86
87
88
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 86

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



91
92
93
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 91

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 67

def self.attribute_map
  {
    :'from_email' => :'from_email',
    :'from_name' => :'from_name',
    :'name' => :'name',
    :'percentage' => :'percentage',
    :'quotas' => :'quotas',
    :'reply_to_email' => :'reply_to_email',
    :'reply_to_name' => :'reply_to_name',
    :'smtp_host' => :'smtp_host',
    :'smtp_password' => :'smtp_password',
    :'smtp_port' => :'smtp_port',
    :'smtp_protocol' => :'smtp_protocol',
    :'smtp_username' => :'smtp_username',
    :'tracking_domain' => :'tracking_domain'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 541

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



115
116
117
118
119
120
121
122
123
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 115

def self.openapi_nullable
  Set.new([
    :'from_email',
    :'from_name',
    :'reply_to_email',
    :'reply_to_name',
    :'tracking_domain'
  ])
end

.openapi_typesObject

Attribute type mapping.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 96

def self.openapi_types
  {
    :'from_email' => :'String',
    :'from_name' => :'String',
    :'name' => :'String',
    :'percentage' => :'Integer',
    :'quotas' => :'ProviderCreateBodyQuotas',
    :'reply_to_email' => :'String',
    :'reply_to_name' => :'String',
    :'smtp_host' => :'String',
    :'smtp_password' => :'String',
    :'smtp_port' => :'Integer',
    :'smtp_protocol' => :'String',
    :'smtp_username' => :'String',
    :'tracking_domain' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 508

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      from_email == o.from_email &&
      from_name == o.from_name &&
      name == o.name &&
      percentage == o.percentage &&
      quotas == o.quotas &&
      reply_to_email == o.reply_to_email &&
      reply_to_name == o.reply_to_name &&
      smtp_host == o.smtp_host &&
      smtp_password == o.smtp_password &&
      smtp_port == o.smtp_port &&
      smtp_protocol == o.smtp_protocol &&
      smtp_username == o.smtp_username &&
      tracking_domain == o.tracking_domain
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


528
529
530
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 528

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



534
535
536
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 534

def hash
  [from_email, from_name, name, percentage, quotas, reply_to_email, reply_to_name, smtp_host, smtp_password, smtp_port, smtp_protocol, smtp_username, tracking_domain].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 208

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@from_email.nil? && @from_email.to_s.length > 255
    invalid_properties.push('invalid value for "from_email", the character length must be smaller than or equal to 255.')
  end

  if !@from_name.nil? && @from_name.to_s.length > 255
    invalid_properties.push('invalid value for "from_name", the character length must be smaller than or equal to 255.')
  end

  if @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

  if @name.to_s.length > 255
    invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 255.')
  end

  if @name.to_s.length < 1
    invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
  end

  if !@percentage.nil? && @percentage > 100
    invalid_properties.push('invalid value for "percentage", must be smaller than or equal to 100.')
  end

  if !@percentage.nil? && @percentage < 0
    invalid_properties.push('invalid value for "percentage", must be greater than or equal to 0.')
  end

  if !@reply_to_email.nil? && @reply_to_email.to_s.length > 255
    invalid_properties.push('invalid value for "reply_to_email", the character length must be smaller than or equal to 255.')
  end

  if !@reply_to_name.nil? && @reply_to_name.to_s.length > 255
    invalid_properties.push('invalid value for "reply_to_name", the character length must be smaller than or equal to 255.')
  end

  if @smtp_host.nil?
    invalid_properties.push('invalid value for "smtp_host", smtp_host cannot be nil.')
  end

  if @smtp_host.to_s.length > 255
    invalid_properties.push('invalid value for "smtp_host", the character length must be smaller than or equal to 255.')
  end

  if @smtp_host.to_s.length < 1
    invalid_properties.push('invalid value for "smtp_host", the character length must be greater than or equal to 1.')
  end

  if @smtp_password.nil?
    invalid_properties.push('invalid value for "smtp_password", smtp_password cannot be nil.')
  end

  if @smtp_password.to_s.length > 500
    invalid_properties.push('invalid value for "smtp_password", the character length must be smaller than or equal to 500.')
  end

  if @smtp_password.to_s.length < 1
    invalid_properties.push('invalid value for "smtp_password", the character length must be greater than or equal to 1.')
  end

  if @smtp_port.nil?
    invalid_properties.push('invalid value for "smtp_port", smtp_port cannot be nil.')
  end

  if @smtp_port > 65535
    invalid_properties.push('invalid value for "smtp_port", must be smaller than or equal to 65535.')
  end

  if @smtp_port < 1
    invalid_properties.push('invalid value for "smtp_port", must be greater than or equal to 1.')
  end

  if @smtp_protocol.nil?
    invalid_properties.push('invalid value for "smtp_protocol", smtp_protocol cannot be nil.')
  end

  if @smtp_username.nil?
    invalid_properties.push('invalid value for "smtp_username", smtp_username cannot be nil.')
  end

  if @smtp_username.to_s.length > 255
    invalid_properties.push('invalid value for "smtp_username", the character length must be smaller than or equal to 255.')
  end

  if @smtp_username.to_s.length < 1
    invalid_properties.push('invalid value for "smtp_username", the character length must be greater than or equal to 1.')
  end

  if !@tracking_domain.nil? && @tracking_domain.to_s.length > 255
    invalid_properties.push('invalid value for "tracking_domain", the character length must be smaller than or equal to 255.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



563
564
565
566
567
568
569
570
571
572
573
574
575
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 563

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
# File 'lib/sendmux_management_generated/models/provider_create_body.rb', line 308

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@from_email.nil? && @from_email.to_s.length > 255
  return false if !@from_name.nil? && @from_name.to_s.length > 255
  return false if @name.nil?
  return false if @name.to_s.length > 255
  return false if @name.to_s.length < 1
  return false if !@percentage.nil? && @percentage > 100
  return false if !@percentage.nil? && @percentage < 0
  return false if !@reply_to_email.nil? && @reply_to_email.to_s.length > 255
  return false if !@reply_to_name.nil? && @reply_to_name.to_s.length > 255
  return false if @smtp_host.nil?
  return false if @smtp_host.to_s.length > 255
  return false if @smtp_host.to_s.length < 1
  return false if @smtp_password.nil?
  return false if @smtp_password.to_s.length > 500
  return false if @smtp_password.to_s.length < 1
  return false if @smtp_port.nil?
  return false if @smtp_port > 65535
  return false if @smtp_port < 1
  return false if @smtp_protocol.nil?
  smtp_protocol_validator = EnumAttributeValidator.new('String', ["tls", "ssl", "none", "starttls", "unknown_default_open_api"])
  return false unless smtp_protocol_validator.valid?(@smtp_protocol)
  return false if @smtp_username.nil?
  return false if @smtp_username.to_s.length > 255
  return false if @smtp_username.to_s.length < 1
  return false if !@tracking_domain.nil? && @tracking_domain.to_s.length > 255
  true
end