Module: Dnsimple::Client::Certificates
- Included in:
- CertificatesService
- Defined in:
- lib/dnsimple/client/certificates.rb
Instance Method Summary collapse
-
#certificate(domain, certificate_id, options = {}) ⇒ Struct::Certificate
Gets a certificate for a domain.
-
#certificates(domain, options = {}) ⇒ Array<Struct::Certificate>
(also: #list, #list_certificates)
Lists the certificates for a domain.
-
#configure(domain, certificate_id, options = {}) ⇒ Struct::Certificate
Configures a certificate.
-
#purchase(domain, name, contact_id, options = {}) ⇒ Struct::Certificate
Purchases a certificate under the given domain with the given name.
-
#submit(domain, certificate_id, email, options = {}) ⇒ Struct::Certificate
Submits a certificate for approval.
Instance Method Details
#certificate(domain, certificate_id, options = {}) ⇒ Struct::Certificate
Gets a certificate for a domain.
33 34 35 36 37 |
# File 'lib/dnsimple/client/certificates.rb', line 33 def certificate(domain, certificate_id, = {}) response = client.get(Client.versioned("/domains/#{domain}/certificates/#{certificate_id}"), ) Struct::Certificate.new(response["certificate"]) end |
#certificates(domain, options = {}) ⇒ Array<Struct::Certificate> Also known as: list, list_certificates
Lists the certificates for a domain.
15 16 17 18 19 |
# File 'lib/dnsimple/client/certificates.rb', line 15 def certificates(domain, = {}) response = client.get(Client.versioned("/domains/#{domain}/certificates"), ) response.map { |r| Struct::Certificate.new(r["certificate"]) } end |
#configure(domain, certificate_id, options = {}) ⇒ Struct::Certificate
Configures a certificate.
76 77 78 79 80 |
# File 'lib/dnsimple/client/certificates.rb', line 76 def configure(domain, certificate_id, = {}) response = client.put(Client.versioned("/domains/#{domain}/certificates/#{certificate_id}/configure"), ) Struct::Certificate.new(response["certificate"]) end |
#purchase(domain, name, contact_id, options = {}) ⇒ Struct::Certificate
Purchases a certificate under the given domain with the given name.
The name will be appended to the domain name, and thus should only be the subdomain part.
Invoking this method DNSimple will immediately charge your credit card on file at DNSimple for the full certificate price.
For wildcard certificates an asterisk must appear in the name.
61 62 63 64 65 66 |
# File 'lib/dnsimple/client/certificates.rb', line 61 def purchase(domain, name, contact_id, = {}) = Extra.deep_merge(, { certificate: { name: name, contact_id: contact_id }}) response = client.post(Client.versioned("/domains/#{domain}/certificates"), ) Struct::Certificate.new(response["certificate"]) end |
#submit(domain, certificate_id, email, options = {}) ⇒ Struct::Certificate
Submits a certificate for approval.
91 92 93 94 95 96 |
# File 'lib/dnsimple/client/certificates.rb', line 91 def submit(domain, certificate_id, email, = {}) = .merge(certificate: { approver_email: email }) response = client.put(Client.versioned("/domains/#{domain}/certificates/#{certificate_id}/submit"), ) Struct::Certificate.new(response["certificate"]) end |