Class: LetsencryptWebfaction::CertificateInstaller
- Inherits:
-
Object
- Object
- LetsencryptWebfaction::CertificateInstaller
- Defined in:
- lib/letsencrypt_webfaction/certificate_installer.rb
Instance Method Summary collapse
-
#initialize(cert_name, certificate, private_key, credentials) ⇒ CertificateInstaller
constructor
A new instance of CertificateInstaller.
- #install! ⇒ Object
Constructor Details
#initialize(cert_name, certificate, private_key, credentials) ⇒ CertificateInstaller
Returns a new instance of CertificateInstaller.
7 8 9 10 11 12 |
# File 'lib/letsencrypt_webfaction/certificate_installer.rb', line 7 def initialize(cert_name, certificate, private_key, credentials) @cert_name = cert_name @certificate = certificate @private_key = private_key @credentials = credentials end |
Instance Method Details
#install! ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/letsencrypt_webfaction/certificate_installer.rb', line 14 def install! cert_list = @credentials.call('list_certificates') action = if cert_list.find { |cert| cert['name'] == @cert_name } 'update_certificate' else 'create_certificate' end @credentials.call(action, @cert_name, @certificate, @private_key.to_pem) true end |