Sha256: 4b9263ab00ab9541b9eecf7447eeed0ec746bdda4333215c2d58c6d09025c7b1

Contents?: true

Size: 666 Bytes

Versions: 6

Compression:

Stored size: 666 Bytes

Contents

require 'xmlrpc/client'

module LetsencryptWebfaction
  class CertificateInstaller
    def initialize(cert_name, certificate, credentials)
      @cert_name = cert_name
      @certificate = certificate
      @credentials = credentials
    end

    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.to_pem, @certificate.request.private_key.to_pem, @certificate.chain_to_pem)

      true
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
letsencrypt_webfaction-3.2.0 lib/letsencrypt_webfaction/certificate_installer.rb
letsencrypt_webfaction-3.1.2 lib/letsencrypt_webfaction/certificate_installer.rb
letsencrypt_webfaction-3.1.1 lib/letsencrypt_webfaction/certificate_installer.rb
letsencrypt_webfaction-3.1.0 lib/letsencrypt_webfaction/certificate_installer.rb
letsencrypt_webfaction-3.0.1 lib/letsencrypt_webfaction/certificate_installer.rb
letsencrypt_webfaction-3.0.0 lib/letsencrypt_webfaction/certificate_installer.rb