class Encryptbot::Heroku
Attributes
app[RW]
token[RW]
Public Class Methods
new()
click to toggle source
# File lib/encryptbot/heroku.rb, line 8 def initialize @app = Encryptbot.configuration.heroku_app @token = Encryptbot.configuration.heroku_token end
Public Instance Methods
add_certificate(certificate, private_key)
click to toggle source
# File lib/encryptbot/heroku.rb, line 13 def add_certificate(certificate, private_key) # list certificate to check if one already exists sni_endpoints = platform.sni_endpoint.list(@app) begin if sni_endpoints.any? # update existing ssl certificate platform.sni_endpoint.update(@app, sni_endpoints[0]["name"], { certificate_chain: certificate, private_key: private_key }) else # add new ssl certificate platform.sni_endpoint.create(@app, { certificate_chain: certificate, private_key: private_key }) end rescue => e raise Encryptbot::Error::HerokuCertificateError, e end end
Private Instance Methods
platform()
click to toggle source
# File lib/encryptbot/heroku.rb, line 38 def platform @platform ||= PlatformAPI.connect_oauth(@token) end