Class: HerokuDnsimpleCert::HerokuCertificate

Inherits:
Object
  • Object
show all
Defined in:
lib/heroku_dnsimple_cert/heroku_certificate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token:, app:, certificate_chain:, private_key:, client: nil) ⇒ HerokuCertificate

Returns a new instance of HerokuCertificate.



5
6
7
8
9
10
# File 'lib/heroku_dnsimple_cert/heroku_certificate.rb', line 5

def initialize(token:, app:, certificate_chain:, private_key:, client: nil)
  @client = client || HerokuSni.new(token, app)
  @certificate_chain = certificate_chain
  @private_key = private_key
  @app = app
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



3
4
5
# File 'lib/heroku_dnsimple_cert/heroku_certificate.rb', line 3

def app
  @app
end

#certificate_chainObject (readonly)

Returns the value of attribute certificate_chain.



3
4
5
# File 'lib/heroku_dnsimple_cert/heroku_certificate.rb', line 3

def certificate_chain
  @certificate_chain
end

#clientObject (readonly)

Returns the value of attribute client.



3
4
5
# File 'lib/heroku_dnsimple_cert/heroku_certificate.rb', line 3

def client
  @client
end

#private_keyObject (readonly)

Returns the value of attribute private_key.



3
4
5
# File 'lib/heroku_dnsimple_cert/heroku_certificate.rb', line 3

def private_key
  @private_key
end

Instance Method Details

#certificatesObject



12
13
14
# File 'lib/heroku_dnsimple_cert/heroku_certificate.rb', line 12

def certificates
  @certificates ||= client.list
end

#createObject



20
21
22
# File 'lib/heroku_dnsimple_cert/heroku_certificate.rb', line 20

def create
  client.create(create_or_update_options)
end

#updateObject



16
17
18
# File 'lib/heroku_dnsimple_cert/heroku_certificate.rb', line 16

def update
  client.update(certificates[0]["name"], create_or_update_options)
end