Sha256: 9dfae3cec541e9b165c4df2a25d620519548988bf7e1a49395dde1d2c9be6abc

Contents?: true

Size: 935 Bytes

Versions: 7

Compression:

Stored size: 935 Bytes

Contents

require "digicert/base"

module Digicert
  class Certificate < Digicert::Base
    extend Digicert::Findable

    def download(attributes = {})
      certificate_downloader.fetch(resource_id, attributes)
    end

    def download_content
      certificate_downloader.fetch_content(resource_id)
    end

    def revoke
      request_klass.new(:put, revocation_path, attributes).parse
    end

    def self.revoke(certificate_id, attributes = {})
      new(attributes.merge(resource_id: certificate_id)).revoke
    end

    def download_to_path(path:, ext: "zip", **attributes)
      certificate_downloader.fetch_to_path(
        resource_id, attributes.merge(path: path, ext: ext)
      )
    end

    private

    def resource_path
      "certificate"
    end

    def revocation_path
      [resource_path, resource_id, "revoke"].join("/")
    end

    def certificate_downloader
      Digicert::CertificateDownloader
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
digicert-0.5.0 lib/digicert/certificate.rb
digicert-0.4.1 lib/digicert/certificate.rb
digicert-0.4.0 lib/digicert/certificate.rb
digicert-0.3.1 lib/digicert/certificate.rb
digicert-0.3.0 lib/digicert/certificate.rb
digicert-0.2.0 lib/digicert/certificate.rb
digicert-0.1.2 lib/digicert/certificate.rb