class HerokuDnsimpleCert::DnsimpleCertificate
Attributes
account_id[R]
client[R]
common_name[R]
domain[R]
Public Class Methods
new(token:, account_id:, domain:, common_name:, client: nil)
click to toggle source
# File lib/heroku_dnsimple_cert/dnsimple_certificate.rb, line 7 def initialize(token:, account_id:, domain:, common_name:, client: nil) @client = client || Dnsimple::Client.new(access_token: token) @account_id = account_id.to_i @domain = domain @common_name = common_name end
Public Instance Methods
certificate()
click to toggle source
# File lib/heroku_dnsimple_cert/dnsimple_certificate.rb, line 29 def certificate @certificate ||= client .certificates.certificates(account_id, domain) .data.select { |certificate| certificate_for_common_name?(certificate) } .first end
certificate_chain()
click to toggle source
# File lib/heroku_dnsimple_cert/dnsimple_certificate.rb, line 14 def certificate_chain @certificate_key ||= begin cert = client.certificates .download_certificate(account_id, domain, certificate.id).data [cert.server, cert.root, cert.chain].join("\n") end end
private_key()
click to toggle source
# File lib/heroku_dnsimple_cert/dnsimple_certificate.rb, line 23 def private_key @certificate_private_key ||= client.certificates .certificate_private_key(account_id, domain, certificate.id) .data.private_key end
Private Instance Methods
certificate_for_common_name?(certificate)
click to toggle source
# File lib/heroku_dnsimple_cert/dnsimple_certificate.rb, line 38 def certificate_for_common_name?(certificate) certificate.state == "issued" && certificate.common_name == common_name end