class Coppertone::Mechanism::DomainSpecRequired

Parent class for mechanisms that use a required.

Public Class Methods

create(attributes) click to toggle source
# File lib/coppertone/mechanism/domain_spec_required.rb, line 5
def self.create(attributes)
  new(attributes)
end
new(attributes) click to toggle source
Calls superclass method Coppertone::Mechanism::new
# File lib/coppertone/mechanism/domain_spec_required.rb, line 9
def initialize(attributes)
  super(attributes)
  raw_domain_spec = trim_domain_spec(attributes)
  raise InvalidMechanismError if raw_domain_spec.blank?

  @domain_spec = Coppertone::DomainSpec.new(raw_domain_spec)
rescue Coppertone::MacroStringParsingError
  raise Coppertone::InvalidMechanismError
end

Public Instance Methods

handle_invalid_domain(_macro_context, _options) click to toggle source
# File lib/coppertone/mechanism/domain_spec_required.rb, line 30
def handle_invalid_domain(_macro_context, _options)
  raise RecordParsingError
end
match?(macro_context, request_context) click to toggle source
# File lib/coppertone/mechanism/domain_spec_required.rb, line 19
def match?(macro_context, request_context)
  request_context.register_dns_lookup_term
  target_name =
    target_name_from_domain_spec(macro_context, request_context)
  if target_name
    match_target_name(macro_context, request_context, target_name)
  else
    handle_invalid_domain(macro_context, request_context)
  end
end