Class: LetsencryptWebfaction::DomainValidator::Validation

Inherits:
Object
  • Object
show all
Defined in:
lib/letsencrypt_webfaction/domain_validator.rb

Instance Method Summary collapse

Constructor Details

#initialize(domain, challenge) ⇒ Validation

Returns a new instance of Validation.



69
70
71
72
# File 'lib/letsencrypt_webfaction/domain_validator.rb', line 69

def initialize(domain, challenge)
  @domain = domain
  @challenge = challenge
end

Instance Method Details

rubocop:disable Metrics/MethodLength



74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/letsencrypt_webfaction/domain_validator.rb', line 74

def print_error # rubocop:disable Metrics/MethodLength
  case @challenge.status
  when 'valid'
    $stderr.puts "#{@domain}: Success"
  when 'invalid'
    $stderr.puts "#{@domain}: #{@challenge.error['detail']}"
    $stderr.puts "Make sure that you can access #{url}"
  when 'pending'
    $stderr.puts "#{@domain}: Still pending, but timed out"
  else
    $stderr.puts "#{@domain}: Unexpected authorization status #{@challenge.status}"
  end
end

#urlObject



88
89
90
# File 'lib/letsencrypt_webfaction/domain_validator.rb', line 88

def url
  "http://#{@domain}/#{@challenge.filename}"
end