Class: Encryptbot::Heroku
- Inherits:
-
Object
- Object
- Encryptbot::Heroku
- Defined in:
- lib/encryptbot/heroku.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #add_certificate(certificate, private_key) ⇒ Object
-
#initialize ⇒ Heroku
constructor
A new instance of Heroku.
Constructor Details
#initialize ⇒ Heroku
Returns a new instance of Heroku.
8 9 10 11 |
# File 'lib/encryptbot/heroku.rb', line 8 def initialize @app = Encryptbot.configuration.heroku_app @token = Encryptbot.configuration.heroku_token end |
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
6 7 8 |
# File 'lib/encryptbot/heroku.rb', line 6 def app @app end |
#token ⇒ Object
Returns the value of attribute token.
6 7 8 |
# File 'lib/encryptbot/heroku.rb', line 6 def token @token end |
Instance Method Details
#add_certificate(certificate, private_key) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# 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 |