Class: InternetBS::DomainRecord

Inherits:
Base
  • Object
show all
Defined in:
lib/internetbs/domain_record.rb

Constant Summary collapse

TYPES =
['A', 'AAAA', 'DYNAMIC', 'CNAME', 'MX', 'SRV', 'TXT', 'NS'].freeze

Instance Method Summary collapse

Methods inherited from Base

#inspect

Instance Method Details

#valid?Boolean

attribute :dyn_dns_login, String # Required for DYNAMIC records, ignored for all others, 1 - 30 chars attribute :dyn_dns_password, String # Required for DYNAMIC records, ignored for all others, 1 - 30 chars attribute :at_registry, Boolean # Only valid for .de & will be ignored for all other domains

Returns:

  • (Boolean)


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/internetbs/domain_record.rb', line 15

def valid?
  ensure_attribute_has_value :full_record_name, :type, :value

  if @type
    unless TYPES.include?(@type.upcase!)
      @errors << "type must be one of: #{TYPES.join(', ')}"
    end
  end

  if @errors.any?
    return false
  else
    return true
  end
end