class Varanus::Domain

A connection to the Domain API

Public Instance Methods

create(domain, delegations, opts = {}) click to toggle source

Create a new domain. The domain may need to be manually approved after this is called. name is the domain delegations is an Array of Hashes. Each Hash should have an 'orgId' and

'certTypes' key

opts may include the following keys:

- :description - optional - String
- :active - optional - Boolean (defaults to +true+)
- :allow_subdomains - optional - set to +false+ if you don't want to allow sub
                                 domains for this entry

@returns [String] - URL for newly created domain

# File lib/varanus/domain.rb, line 17
def create domain, delegations, opts = {}
  opts = opts.dup
  allow_subdomains = opts.delete(:allow_subdomains)
  domain = "*.#{domain}" if allow_subdomains != false && !domain.start_with?('*.')

  result = @varanus.connection.post('domain/v1',
                                    opts.merge(name: domain, delegations: delegations))
  check_result result
  result.headers['Location']
end
info(id) click to toggle source

Return info on domain. id must be the id returned by list

# File lib/varanus/domain.rb, line 29
def info id
  get("domain/v1/#{id}")
end
list(opts = {}) click to toggle source
# File lib/varanus/domain.rb, line 33
def list opts = {}
  get_with_size_and_position('domain/v1', opts)
end
list_with_info(opts = {}) click to toggle source
# File lib/varanus/domain.rb, line 37
def list_with_info opts = {}
  domains = list(opts)
  domains.map! { |domain| info(domain['id']) }
  domains
end
report() click to toggle source
# File lib/varanus/domain.rb, line 43
def report
  post('report/v1/domains', {})['reports']
end