Sha256: c26ea96a14b04482183754cde3693e28d21829247cf60c7cc1cacbe0859ab3e5

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

require 'json'

module Xolphin
  module Api
    module CertificateRequests
      class RenewCertificateRequest
        attr_accessor :product, :years, :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(product, years, csr, dcv_type)
          @product = product
          @years = years
          @csr = csr
          @dcv_type = dcv_type
        end

        def to_param
          result = {
            "product" => @product,
            "years" => @years,
            "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_renew.rb