Sha256: 1ad5729e759f9f813209dc05f550f5af72b4b8a7f0481d219a8e0c040a4d423d

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

require 'json'

module Xolphin
  module Api
    module CertificateRequests
      class ReissueCertificateRequest
        attr_accessor :csr, :dcv_type, :subject_alternative_names, :dcv
        attr_accessor :company, :department, :address, :zipcode, :city, :kvk, :reference
        attr_accessor :approver_first_name, :approver_last_name, :approver_email, :approver_phone

        def initialize(csr, dcv_type)
          @csr = csr
          @dcv_type = dcv_type
        end

        def to_param
          result = {
            "csr" => @csr,
            "dcvType" => @dcv_type
          }

          result.merge!({
            "company" => @company,
            "department" => @department,
            "address" => @address,
            "zipcode" => @zipcode,
            "city" => @city,
            "kvk" => @kvk,
            "reference" => @reference,
            "approverFirstName" => @approver_first_name,
            "approverLastName" => @approver_last_name,
            "approverEmail" => @approver_email,
            "approverPhone" => @approver_phone
          }.reject { |_key, value| value.nil? })

          if @subject_alternative_names
            result["subjectAlternativeNames"] = @subject_alternative_names.join(",")
          end

          result["dcv"] = JSON.dump(@dcv) if @dcv

          result
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xolphin-api-1.8.0 lib/xolphin/api/certificate_requests/certificate_reissue.rb