Module: Dnsimple::Client::Certificates

Included in:
CertificatesService
Defined in:
lib/dnsimple/client/certificates.rb

Instance Method Summary collapse

Instance Method Details

#certificate(account_id, domain_id, certificate_id, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::Certificate>

Gets a certificate associated to the domain.

Parameters:

  • account_id (Integer)

    the account ID

  • domain_id (#to_s)

    the domain ID or domain name

  • certificate_id (Integer)

    the certificate ID

  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



45
46
47
48
49
# File 'lib/dnsimple/client/certificates.rb', line 45

def certificate(, domain_id, certificate_id, options = {})
  response = client.get(Client.versioned("/%s/domains/%s/certificates/%s" % [, domain_id, certificate_id]), options)

  Dnsimple::Response.new(response, Struct::Certificate.new(response["data"]))
end

#certificate_private_key(account_id, domain_id, certificate_id, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::CertificateBundle>

Get certificate private key associated to the domain.

Parameters:

  • account_id (Integer)

    the account ID

  • domain_id (#to_s)

    the domain ID or domain name

  • certificate_id (Integer)

    the certificate ID

  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



81
82
83
84
85
# File 'lib/dnsimple/client/certificates.rb', line 81

def certificate_private_key(, domain_id, certificate_id, options = {})
  response = client.get(Client.versioned("/%s/domains/%s/certificates/%s/private_key" % [, domain_id, certificate_id]), options)

  Dnsimple::Response.new(response, Struct::CertificateBundle.new(response["data"]))
end

#certificates(account_id, domain_name, options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::Certificate>

Lists the certificates associated to the domain.

Examples:

List certificates in the first page

client.certificates.list(1010, "example.com")

List certificates, provide a specific page

client.certificates.list(1010, "example.com", page: 2)

List certificates, provide a sorting policy

client.certificates.list(1010, "example.com", sort: "email:asc")

Parameters:

  • account_id (Integer)

    the account ID

  • domain_name (#to_s)

    the domain name

  • options (Hash) (defaults to: {})

    the filtering and sorting options

Options Hash (options):

  • :page (Integer)

    current page (pagination)

  • :per_page (Integer)

    number of entries to return (pagination)

Returns:

Raises:

See Also:



27
28
29
30
31
# File 'lib/dnsimple/client/certificates.rb', line 27

def certificates(, domain_name, options = {})
  response = client.get(Client.versioned("/%s/domains/%s/certificates" % [, domain_name]), Options::ListOptions.new(options))

  Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Certificate.new(r) })
end

#download_certificate(account_id, domain_id, certificate_id, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::CertificateBundle>

Downloads a certificate associated to the domain.

Parameters:

  • account_id (Integer)

    the account ID

  • domain_id (#to_s)

    the domain ID or domain name

  • certificate_id (Integer)

    the certificate ID

  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



63
64
65
66
67
# File 'lib/dnsimple/client/certificates.rb', line 63

def download_certificate(, domain_id, certificate_id, options = {})
  response = client.get(Client.versioned("/%s/domains/%s/certificates/%s/download" % [, domain_id, certificate_id]), options)

  Dnsimple::Response.new(response, Struct::CertificateBundle.new(response["data"]))
end