Class: Varanus::DCV

Inherits:
RestResource show all
Defined in:
lib/varanus/dcv.rb

Overview

An connection to the DCV API. This should not be initialized directly. Instead, use Varanus#dcv

Instance Method Summary collapse

Methods inherited from RestResource

#initialize

Constructor Details

This class inherits a constructor from Varanus::RestResource

Instance Method Details

#search(opts = {}) ⇒ Object

Returns an Array of DCV information about searched for domains. This method will automatically page through all results Results will included an extra ‘expiration_date_obj’ if ‘expirationDate’ is in the response

Parameters:

  • opts (Hash) (defaults to: {})
    • all opts are optional

Options Hash (opts):

  • :domain (String)

    Domain to search for

  • :org (Integer)

    ID of organization

  • :department (Integer)

    ID of department

  • :dcvStatus (String)
  • :orderStatus (String)
  • :expiresIn (Integer)

    Expires in (days)



18
19
20
# File 'lib/varanus/dcv.rb', line 18

def search opts = {}
  get_with_size_and_position('dcv/v2/validation', opts).map(&method(:_format_status))
end

#start(domain, type) ⇒ Object

Start domain validation process. This must be called before #submit is called

Parameters:

  • domain (Hash)

    a customizable set of options

  • type (Hash)

    a customizable set of options

Options Hash (domain):

  • domain (String)

    to validate

Options Hash (type):

  • Type (String)

    of validation. Must be one of ‘http’, ‘https’, ‘cname’, or ‘email’



26
27
28
# File 'lib/varanus/dcv.rb', line 26

def start domain, type
  post("dcv/v1/validation/start/domain/#{type}", domain: domain)
end

#status(domain) ⇒ Object

Retrieve DCV status for a single domain Result will included an extra ‘expiration_date_obj’ if ‘expirationDate’ is in the response



33
34
35
# File 'lib/varanus/dcv.rb', line 33

def status domain
  _format_status(post('dcv/v2/validation/status', domain: domain))
end

#submit(domain, type, email_address = nil) ⇒ Object

Submit domain validation for verficiation. This must be called after #start

Parameters:

  • domain (Hash)

    a customizable set of options

  • type (Hash)

    a customizable set of options

  • email_address (Hash) (defaults to: nil)

    a customizable set of options

Options Hash (domain):

  • domain (String)

    to validate

Options Hash (type):

  • Type (String)

    of validation. Must be one of ‘http’, ‘https’, ‘cname’, or ‘email’

Options Hash (email_address):

  • This (String)

    is required of type is ‘email’. Otherwise, it is ignored.



43
44
45
46
47
48
49
50
51
52
# File 'lib/varanus/dcv.rb', line 43

def submit domain, type, email_address = nil
  if type.to_s == 'email'
    raise ArgumentError, 'email_address must be specified' if email_address.nil?

    post('dcv/v1/validation/submit/domain/email', domain: domain,
                                                  email: email_address)
  else
    post("dcv/v1/validation/submit/domain/#{type}", domain: domain)
  end
end