Class: Norbelys::Sender

Inherits:
Object
  • Object
show all
Defined in:
lib/norbelys/models/sender.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Sender

Initializes the object

Parameters:

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

    Model attributes in the form of hash



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
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
305
306
307
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
337
338
339
340
341
342
# File 'lib/norbelys/models/sender.rb', line 190

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#archived_atObject

Returns the value of attribute archived_at.



18
19
20
# File 'lib/norbelys/models/sender.rb', line 18

def archived_at
  @archived_at
end

#bcc_crm_emailObject

Returns the value of attribute bcc_crm_email.



20
21
22
# File 'lib/norbelys/models/sender.rb', line 20

def bcc_crm_email
  @bcc_crm_email
end

#client_labelObject

Returns the value of attribute client_label.



22
23
24
# File 'lib/norbelys/models/sender.rb', line 22

def client_label
  @client_label
end

#created_atObject

Returns the value of attribute created_at.



24
25
26
# File 'lib/norbelys/models/sender.rb', line 24

def created_at
  @created_at
end

#daily_limitObject

Max sends per day for this mailbox.



27
28
29
# File 'lib/norbelys/models/sender.rb', line 27

def daily_limit
  @daily_limit
end

#from_emailObject

The sending address.



30
31
32
# File 'lib/norbelys/models/sender.rb', line 30

def from_email
  @from_email
end

#from_nameObject

Display name.



33
34
35
# File 'lib/norbelys/models/sender.rb', line 33

def from_name
  @from_name
end

#health_updated_atObject

Returns the value of attribute health_updated_at.



35
36
37
# File 'lib/norbelys/models/sender.rb', line 35

def health_updated_at
  @health_updated_at
end

#idObject

The sender id.



38
39
40
# File 'lib/norbelys/models/sender.rb', line 38

def id
  @id
end

#imap_hostObject

Returns the value of attribute imap_host.



40
41
42
# File 'lib/norbelys/models/sender.rb', line 40

def imap_host
  @imap_host
end

#imap_portObject

Returns the value of attribute imap_port.



42
43
44
# File 'lib/norbelys/models/sender.rb', line 42

def imap_port
  @imap_port
end

#imap_securityObject

Returns the value of attribute imap_security.



44
45
46
# File 'lib/norbelys/models/sender.rb', line 44

def imap_security
  @imap_security
end

#min_gap_minutesObject

Minimum gap between sends from this mailbox.



47
48
49
# File 'lib/norbelys/models/sender.rb', line 47

def min_gap_minutes
  @min_gap_minutes
end

#objectObject

Returns the value of attribute object.



49
50
51
# File 'lib/norbelys/models/sender.rb', line 49

def object
  @object
end

#reply_toObject

Returns the value of attribute reply_to.



51
52
53
# File 'lib/norbelys/models/sender.rb', line 51

def reply_to
  @reply_to
end

#reputationObject

System-computed reputation tier: good, warning, or bad.



54
55
56
# File 'lib/norbelys/models/sender.rb', line 54

def reputation
  @reputation
end

#sending_domain_idObject

The sending domain this mailbox lives under.



57
58
59
# File 'lib/norbelys/models/sender.rb', line 57

def sending_domain_id
  @sending_domain_id
end

#signature_htmlObject

Returns the value of attribute signature_html.



59
60
61
# File 'lib/norbelys/models/sender.rb', line 59

def signature_html
  @signature_html
end

#smtp_hostObject

Returns the value of attribute smtp_host.



61
62
63
# File 'lib/norbelys/models/sender.rb', line 61

def smtp_host
  @smtp_host
end

#smtp_portObject

Returns the value of attribute smtp_port.



63
64
65
# File 'lib/norbelys/models/sender.rb', line 63

def smtp_port
  @smtp_port
end

#smtp_securityObject

Returns the value of attribute smtp_security.



65
66
67
# File 'lib/norbelys/models/sender.rb', line 65

def smtp_security
  @smtp_security
end

#stateObject

Operational state: healthy, throttled, or paused.



68
69
70
# File 'lib/norbelys/models/sender.rb', line 68

def state
  @state
end

#transport_modeObject

How messages are carried: smtp, provider_api, self_hosted, or voice.



71
72
73
# File 'lib/norbelys/models/sender.rb', line 71

def transport_mode
  @transport_mode
end

#transport_providerObject

Returns the value of attribute transport_provider.



73
74
75
# File 'lib/norbelys/models/sender.rb', line 73

def transport_provider
  @transport_provider
end

#updated_atObject

Returns the value of attribute updated_at.



75
76
77
# File 'lib/norbelys/models/sender.rb', line 75

def updated_at
  @updated_at
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
# File 'lib/norbelys/models/sender.rb', line 621

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = Norbelys.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



131
132
133
# File 'lib/norbelys/models/sender.rb', line 131

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/norbelys/models/sender.rb', line 100

def self.attribute_map
  {
    :'archived_at' => :'archivedAt',
    :'bcc_crm_email' => :'bccCrmEmail',
    :'client_label' => :'clientLabel',
    :'created_at' => :'createdAt',
    :'daily_limit' => :'dailyLimit',
    :'from_email' => :'fromEmail',
    :'from_name' => :'fromName',
    :'health_updated_at' => :'healthUpdatedAt',
    :'id' => :'id',
    :'imap_host' => :'imapHost',
    :'imap_port' => :'imapPort',
    :'imap_security' => :'imapSecurity',
    :'min_gap_minutes' => :'minGapMinutes',
    :'object' => :'object',
    :'reply_to' => :'replyTo',
    :'reputation' => :'reputation',
    :'sending_domain_id' => :'sendingDomainId',
    :'signature_html' => :'signatureHtml',
    :'smtp_host' => :'smtpHost',
    :'smtp_port' => :'smtpPort',
    :'smtp_security' => :'smtpSecurity',
    :'state' => :'state',
    :'transport_mode' => :'transportMode',
    :'transport_provider' => :'transportProvider',
    :'updated_at' => :'updatedAt'
  }
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



597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
# File 'lib/norbelys/models/sender.rb', line 597

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



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/norbelys/models/sender.rb', line 167

def self.openapi_nullable
  Set.new([
    :'archived_at',
    :'bcc_crm_email',
    :'client_label',
    :'created_at',
    :'health_updated_at',
    :'imap_host',
    :'imap_port',
    :'imap_security',
    :'object',
    :'reply_to',
    :'signature_html',
    :'smtp_host',
    :'smtp_port',
    :'smtp_security',
    :'transport_provider',
    :'updated_at'
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/norbelys/models/sender.rb', line 136

def self.openapi_types
  {
    :'archived_at' => :'Object',
    :'bcc_crm_email' => :'String',
    :'client_label' => :'String',
    :'created_at' => :'Object',
    :'daily_limit' => :'Integer',
    :'from_email' => :'String',
    :'from_name' => :'String',
    :'health_updated_at' => :'Object',
    :'id' => :'String',
    :'imap_host' => :'String',
    :'imap_port' => :'Integer',
    :'imap_security' => :'String',
    :'min_gap_minutes' => :'Integer',
    :'object' => :'Object',
    :'reply_to' => :'String',
    :'reputation' => :'String',
    :'sending_domain_id' => :'String',
    :'signature_html' => :'String',
    :'smtp_host' => :'String',
    :'smtp_port' => :'Integer',
    :'smtp_security' => :'String',
    :'state' => :'String',
    :'transport_mode' => :'String',
    :'transport_provider' => :'String',
    :'updated_at' => :'Object'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
# File 'lib/norbelys/models/sender.rb', line 552

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      archived_at == o.archived_at &&
      bcc_crm_email == o.bcc_crm_email &&
      client_label == o.client_label &&
      created_at == o.created_at &&
      daily_limit == o.daily_limit &&
      from_email == o.from_email &&
      from_name == o.from_name &&
      health_updated_at == o.health_updated_at &&
      id == o.id &&
      imap_host == o.imap_host &&
      imap_port == o.imap_port &&
      imap_security == o.imap_security &&
      min_gap_minutes == o.min_gap_minutes &&
      object == o.object &&
      reply_to == o.reply_to &&
      reputation == o.reputation &&
      sending_domain_id == o.sending_domain_id &&
      signature_html == o.signature_html &&
      smtp_host == o.smtp_host &&
      smtp_port == o.smtp_port &&
      smtp_security == o.smtp_security &&
      state == o.state &&
      transport_mode == o.transport_mode &&
      transport_provider == o.transport_provider &&
      updated_at == o.updated_at
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



692
693
694
695
696
697
698
699
700
701
702
703
704
# File 'lib/norbelys/models/sender.rb', line 692

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


584
585
586
# File 'lib/norbelys/models/sender.rb', line 584

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



590
591
592
# File 'lib/norbelys/models/sender.rb', line 590

def hash
  [archived_at, bcc_crm_email, client_label, created_at, daily_limit, from_email, from_name, health_updated_at, id, imap_host, imap_port, imap_security, min_gap_minutes, object, reply_to, reputation, sending_domain_id, signature_html, smtp_host, smtp_port, smtp_security, state, transport_mode, transport_provider, updated_at].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/norbelys/models/sender.rb', line 346

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @daily_limit.nil?
    invalid_properties.push('invalid value for "daily_limit", daily_limit cannot be nil.')
  end

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

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

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

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

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

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

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

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

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

  if @sending_domain_id.nil?
    invalid_properties.push('invalid value for "sending_domain_id", sending_domain_id 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 @state.nil?
    invalid_properties.push('invalid value for "state", state cannot be nil.')
  end

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

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



668
669
670
# File 'lib/norbelys/models/sender.rb', line 668

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



674
675
676
677
678
679
680
681
682
683
684
685
686
# File 'lib/norbelys/models/sender.rb', line 674

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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



662
663
664
# File 'lib/norbelys/models/sender.rb', line 662

def to_s
  to_hash.to_s
end

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
# File 'lib/norbelys/models/sender.rb', line 414

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @daily_limit.nil?
  return false if @daily_limit < 0
  return false if @from_email.nil?
  return false if @from_name.nil?
  return false if @id.nil?
  return false if @imap_port > 65535
  return false if @imap_port < 1
  imap_security_validator = EnumAttributeValidator.new('String', ["ssl", "tls", "none"])
  return false unless imap_security_validator.valid?(@imap_security)
  return false if @min_gap_minutes.nil?
  return false if @min_gap_minutes < 0
  return false if @reputation.nil?
  reputation_validator = EnumAttributeValidator.new('String', ["good", "warning", "bad"])
  return false unless reputation_validator.valid?(@reputation)
  return false if @sending_domain_id.nil?
  return false if @smtp_port > 65535
  return false if @smtp_port < 1
  smtp_security_validator = EnumAttributeValidator.new('String', ["ssl", "tls", "none"])
  return false unless smtp_security_validator.valid?(@smtp_security)
  return false if @state.nil?
  state_validator = EnumAttributeValidator.new('String', ["healthy", "throttled", "paused"])
  return false unless state_validator.valid?(@state)
  return false if @transport_mode.nil?
  transport_mode_validator = EnumAttributeValidator.new('String', ["smtp", "provider_api", "self_hosted", "voice"])
  return false unless transport_mode_validator.valid?(@transport_mode)
  true
end