Class: MailSlurpClient::GenerateDmarcRecordOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/mailslurp_client/models/generate_dmarc_record_options.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ GenerateDmarcRecordOptions

Initializes the object

Parameters:

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

    Model attributes in the form of hash



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 107

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `MailSlurpClient::GenerateDmarcRecordOptions` 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 `MailSlurpClient::GenerateDmarcRecordOptions`. 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?(:'domain')
    self.domain = attributes[:'domain']
  end

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

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

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

  if attributes.key?(:'report_email_address')
    if (value = attributes[:'report_email_address']).is_a?(Array)
      self.report_email_address = value
    end
  end

  if attributes.key?(:'forensic_email_address')
    if (value = attributes[:'forensic_email_address']).is_a?(Array)
      self.forensic_email_address = value
    end
  end

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

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

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

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

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

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

Instance Attribute Details

#adkimObject

Returns the value of attribute adkim.



35
36
37
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 35

def adkim
  @adkim
end

#aspfObject

Returns the value of attribute aspf.



37
38
39
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 37

def aspf
  @aspf
end

#domainObject

Returns the value of attribute domain.



17
18
19
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 17

def domain
  @domain
end

#foObject

Returns the value of attribute fo.



39
40
41
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 39

def fo
  @fo
end

#forensic_email_addressObject

Returns the value of attribute forensic_email_address.



27
28
29
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 27

def forensic_email_address
  @forensic_email_address
end

#percentageObject

Returns the value of attribute percentage.



29
30
31
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 29

def percentage
  @percentage
end

#policyObject

Returns the value of attribute policy.



21
22
23
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 21

def policy
  @policy
end

#report_email_addressObject

Returns the value of attribute report_email_address.



25
26
27
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 25

def report_email_address
  @report_email_address
end

#report_formatObject

Returns the value of attribute report_format.



31
32
33
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 31

def report_format
  @report_format
end

#seconds_between_reportsObject

Returns the value of attribute seconds_between_reports.



33
34
35
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 33

def seconds_between_reports
  @seconds_between_reports
end

#subdomain_policyObject

Returns the value of attribute subdomain_policy.



23
24
25
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 23

def subdomain_policy
  @subdomain_policy
end

#versionObject

Returns the value of attribute version.



19
20
21
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 19

def version
  @version
end

Class Method Details

.attribute_mapObject

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



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 64

def self.attribute_map
  {
    :'domain' => :'domain',
    :'version' => :'version',
    :'policy' => :'policy',
    :'subdomain_policy' => :'subdomainPolicy',
    :'report_email_address' => :'reportEmailAddress',
    :'forensic_email_address' => :'forensicEmailAddress',
    :'percentage' => :'percentage',
    :'report_format' => :'reportFormat',
    :'seconds_between_reports' => :'secondsBetweenReports',
    :'adkim' => :'adkim',
    :'aspf' => :'aspf',
    :'fo' => :'fo'
  }
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



343
344
345
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 343

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



100
101
102
103
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 100

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 82

def self.openapi_types
  {
    :'domain' => :'String',
    :'version' => :'String',
    :'policy' => :'String',
    :'subdomain_policy' => :'String',
    :'report_email_address' => :'Array<String>',
    :'forensic_email_address' => :'Array<String>',
    :'percentage' => :'Integer',
    :'report_format' => :'String',
    :'seconds_between_reports' => :'Integer',
    :'adkim' => :'String',
    :'aspf' => :'String',
    :'fo' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 311

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      domain == o.domain &&
      version == o.version &&
      policy == o.policy &&
      subdomain_policy == o.subdomain_policy &&
      report_email_address == o.report_email_address &&
      forensic_email_address == o.forensic_email_address &&
      percentage == o.percentage &&
      report_format == o.report_format &&
      seconds_between_reports == o.seconds_between_reports &&
      adkim == o.adkim &&
      aspf == o.aspf &&
      fo == o.fo
end

#_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



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
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 371

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.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
    MailSlurpClient.const_get(type).build_from_hash(value)
  end
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



440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 440

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

#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



350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 350

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if 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[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


330
331
332
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 330

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



336
337
338
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 336

def hash
  [domain, version, policy, subdomain_policy, report_email_address, forensic_email_address, percentage, report_format, seconds_between_reports, adkim, aspf, fo].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 175

def list_invalid_properties
  invalid_properties = Array.new
  if @domain.nil?
    invalid_properties.push('invalid value for "domain", domain cannot be nil.')
  end

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

  if @policy.nil?
    invalid_properties.push('invalid value for "policy", policy cannot be nil.')
  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 < 1
    invalid_properties.push('invalid value for "percentage", must be greater than or equal to 1.')
  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



416
417
418
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 416

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



422
423
424
425
426
427
428
429
430
431
432
433
434
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 422

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



410
411
412
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 410

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



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/mailslurp_client/models/generate_dmarc_record_options.rb', line 202

def valid?
  return false if @domain.nil?
  return false if @version.nil?
  version_validator = EnumAttributeValidator.new('String', ["DMARC1"])
  return false unless version_validator.valid?(@version)
  return false if @policy.nil?
  policy_validator = EnumAttributeValidator.new('String', ["NONE", "QUARANTINE", "REJECT"])
  return false unless policy_validator.valid?(@policy)
  subdomain_policy_validator = EnumAttributeValidator.new('String', ["NONE", "QUARANTINE", "REJECT"])
  return false unless subdomain_policy_validator.valid?(@subdomain_policy)
  return false if !@percentage.nil? && @percentage > 100
  return false if !@percentage.nil? && @percentage < 1
  report_format_validator = EnumAttributeValidator.new('String', ["AFRF"])
  return false unless report_format_validator.valid?(@report_format)
  adkim_validator = EnumAttributeValidator.new('String', ["STRICT", "RELAXED"])
  return false unless adkim_validator.valid?(@adkim)
  aspf_validator = EnumAttributeValidator.new('String', ["STRICT", "RELAXED"])
  return false unless aspf_validator.valid?(@aspf)
  fo_validator = EnumAttributeValidator.new('String', ["FO_0", "FO_1", "FO_D", "FO_S"])
  return false unless fo_validator.valid?(@fo)
  true
end