Class: GlobalSign::DnsVerification::Request

Inherits:
UrlVerification::Request show all
Defined in:
lib/global_sign/dns_verification/request.rb

Instance Method Summary collapse

Methods inherited from Request

#auth_token_hash, #auth_token_params, #to_xml

Constructor Details

#initialize(product_code:, order_kind:, validity_period_months:, csr:, renewal_target_order_id: nil, contract_info: nil) ⇒ Request

Returns a new instance of Request.



4
5
6
7
8
9
10
11
# File 'lib/global_sign/dns_verification/request.rb', line 4

def initialize(product_code:, order_kind:, validity_period_months:, csr:, renewal_target_order_id: nil, contract_info: nil)
  @product_code            = product_code
  @order_kind              = order_kind
  @validity_period_months  = validity_period_months
  @csr                     = csr
  @renewal_target_order_id = renewal_target_order_id
  @contract_info           = contract_info || GlobalSign.contract
end

Instance Method Details

#actionObject



17
18
19
# File 'lib/global_sign/dns_verification/request.rb', line 17

def action
  'DVDNSOrder'
end

#paramsObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/global_sign/dns_verification/request.rb', line 25

def params
  _params = {
    OrderRequestParameter: {
      ProductCode: @product_code,
      OrderKind:   @order_kind,
      Licenses:    1,
      ValidityPeriod: {
        Months: @validity_period_months
      },
      CSR: @csr,
    },
    ContactInfo: {
      FirstName: @contract_info.first_name,
      LastName:  @contract_info.last_name,
      Phone:     @contract_info.phone_number,
      Email:     @contract_info.email
    }
  }

  # require `RenewalTargetOrderID` to request a renewal certificate
  if @order_kind == 'renewal'
    _params[:OrderRequestParameter].merge!(
      { RenewalTargetOrderID: @renewal_target_order_id }
    )
  end

  _params
end

#pathObject



13
14
15
# File 'lib/global_sign/dns_verification/request.rb', line 13

def path
  'ServerSSLService'
end

#request_headerObject



21
22
23
# File 'lib/global_sign/dns_verification/request.rb', line 21

def request_header
  :OrderRequestHeader
end