Class: VerifyPagesDomainService

Inherits:
Object
  • Object
show all
Defined in:
app/services/verify_pages_domain_service.rb

Constant Summary collapse

RESOLVER_TIMEOUT_SECONDS =

The maximum number of seconds to be spent on each DNS lookup

15
VERIFICATION_PERIOD =

How long verification lasts for

7.days
REMOVAL_DELAY =
1.week.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(domain) ⇒ VerifyPagesDomainService

Returns a new instance of VerifyPagesDomainService.



15
16
17
# File 'app/services/verify_pages_domain_service.rb', line 15

def initialize(domain)
  @domain = domain
end

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain.



13
14
15
# File 'app/services/verify_pages_domain_service.rb', line 13

def domain
  @domain
end

Instance Method Details

#executeObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/services/verify_pages_domain_service.rb', line 19

def execute
  unless domain.verification_code.present?
    return ServiceResponse.error(message: "No verification code set for #{domain.domain}")
  end

  if !verification_enabled? || dns_record_present?
    verify_domain!
  elsif expired?
    disable_domain!
  else
    unverify_domain!
  end
end