Class: VerifyPagesDomainService

Inherits:
BaseService 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

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

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
# File 'app/services/verify_pages_domain_service.rb', line 19

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

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