Sha256: 08a777e9a233945f387c9a092bbebfdcf879ea82d93def6a3066a5fb469ef52a

Contents?: true

Size: 919 Bytes

Versions: 3

Compression:

Stored size: 919 Bytes

Contents

require "digicert/base"

module Digicert
  class OrderManager < Digicert::Base
    include Digicert::Actions::Create

    def self.create(order_id:, **attributes)
      new(resource_id: order_id, **attributes).create
    end

    private

    def validate(attributes)
      { certificate: order_attributes.merge(attributes) }
    end

    def order_attributes
      {
        common_name: order.certificate.common_name,
        dns_names: order.certificate.dns_names,
        csr: order.certificate.csr,
        signature_hash: order.certificate.signature_hash,
        server_platform: { id: order.certificate.server_platform.id },
      }
    end

    def order
      @order ||= Digicert::Order.fetch(order_id)
    end

    # Expose the resource_id as order_id, as it sounds
    # more readable and all of it's subclasses are only
    # gonna deal with order.
    #
    alias_method :order_id, :resource_id
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
digicert-0.3.1 lib/digicert/order_manager.rb
digicert-0.3.0 lib/digicert/order_manager.rb
digicert-0.2.0 lib/digicert/order_manager.rb