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.



67
68
69
70
# File 'lib/letsencrypt_webfaction/domain_validator.rb', line 67

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

Instance Method Details

rubocop:disable Metrics/MethodLength



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

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



86
87
88
# File 'lib/letsencrypt_webfaction/domain_validator.rb', line 86

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