Class: LetsencryptStandalone::Client

Inherits:
Base
  • Object
show all
Defined in:
lib/letsencrypt_standalone/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#endpoint_url, #logger, logger, #output_dir, #path, #ssl_subdir

Constructor Details

#initialize(account: nil, email:) ⇒ Client

Returns a new instance of Client.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/letsencrypt_standalone/client.rb', line 9

def initialize(account: nil, email:)
  @email = email
  @account = 
  @acme_client = Acme::Client.new(private_key: private_key, endpoint: endpoint_url)

  if !
    logger.info "Account key not found. Creating..."
    @account = 'account.pem'
    create(email)
    
    raise 'No email specified' if !email
  end
end

Instance Attribute Details

#accountObject (readonly)

Returns the value of attribute account.



7
8
9
# File 'lib/letsencrypt_standalone/client.rb', line 7

def 
  @account
end

#acme_clientObject (readonly)

Returns the value of attribute acme_client.



7
8
9
# File 'lib/letsencrypt_standalone/client.rb', line 7

def acme_client
  @acme_client
end

#emailObject (readonly)

Returns the value of attribute email.



7
8
9
# File 'lib/letsencrypt_standalone/client.rb', line 7

def email
  @email
end

Instance Method Details

#authorize(domain:) ⇒ Object



28
29
30
# File 'lib/letsencrypt_standalone/client.rb', line 28

def authorize(domain:)
  @acme_client.authorize(domain: domain)
end

#create(email) ⇒ Object



23
24
25
26
# File 'lib/letsencrypt_standalone/client.rb', line 23

def create(email)
  contact = 'mailto:' + email #https://github.com/schubergphilis/letsencrypt/issues/3
  @acme_client.register(contact: contact).agree_terms
end