module Demandbase

Constants

ACADEMIC_SIC_CODES

Standard Industrial Classification (SIC) codes for organizations providing elementary, secondary, tertiary, or quaternary education.

See github.com/leereilly/csi/blob/master/lib/data/master.toml for a complete list.

GOVERNMENT_SIC_CODES

SIC codes for government.

NONPROFIT_SIC_CODES

SIC codes for registered nonprofits.

Public Class Methods

is_academic?(domain) click to toggle source

Find out if a particular domain is associated with an academic institution.

Returns true if it looks like an academic organization; false otherwise.

Raises a Demandbase::RTIDNotSetError if a RTID key is not set. Raises a Demandbase::ParseError if the domain doesn’t look legit. Raises a Demandbase::ServerError if the Demandbase server is unresponsive.

# File lib/demandbase.rb, line 144
def is_academic?(domain)
  record = Demandbase::DomainRecord.new(domain)

  if record && ACADEMIC_SIC_CODES.include?(record.primary_sic)
    return true
  else
    return false
  end
end
is_government?(domain) click to toggle source

Find out if a particular domain is associated with an government agency.

Returns true if it looks like an government agency; false otherwise.

Raises a Demandbase::RTIDNotSetError if a RTID key is not set. Raises a Demandbase::ParseError if the domain doesn’t look legit. Raises a Demandbase::ServerError if the Demandbase server is unresponsive.

# File lib/demandbase.rb, line 162
def is_government?(domain)
  record = Demandbase::DomainRecord.new(domain)

  if record && GOVERNMENT_SIC_CODES.include?(record.primary_sic)
    return true
  else
    return false
  end
end
is_nonprofit?(domain) click to toggle source

Find out if a particular domain is associated with a nonprofit.

Returns true if it looks like a nonprofit; false otherwise.

Raises a Demandbase::RTIDNotSetError if a RTID key is not set. Raises a Demandbase::ParseError if the domain doesn’t look legit. Raises a Demandbase::ServerError if the Demandbase server is unresponsive.

# File lib/demandbase.rb, line 180
def is_nonprofit?(domain)
  record = Demandbase::DomainRecord.new(domain)

  if record && NONPROFIT_SIC_CODES.include?(record.primary_sic)
    return true
  else
    return false
  end
end
lazy_lookup(query)
Alias for: lookup
lookup(query) click to toggle source

Look up a Demandbase record for a given domain name.

Returns a Demandbase::Record if the record is found; nil otherwise.

Raises a Demandbase::RTIDNotSetError if a RTID key is not set. Raises a Demandbase::ParseError if the domain doesn’t look legit. Raises a Demandbase::ServerError if the Demandbase server is unresponsive.

# File lib/demandbase.rb, line 125
def lookup(query)
  if Demandbase::IPRecord.is_ip(query)
    Demandbase::IPRecord.new(query)
  elsif Demandbase::DomainRecord.is_domain(query)
    Demandbase::DomainRecord.new(query)
  else
    raise Demandbase::ParseError
  end
end
Also aliased as: lazy_lookup
lookup_domain(query) click to toggle source
# File lib/demandbase.rb, line 112
def lookup_domain(query)
  Demandbase::DomainRecord.new(query)
end
Also aliased as: lookup_domain_name
lookup_domain_name(query)
Alias for: lookup_domain
lookup_ip(query) click to toggle source
# File lib/demandbase.rb, line 107
def lookup_ip(query)
  Demandbase::IPRecord.new(query)
end
Also aliased as: lookup_ip_address
lookup_ip_address(query)
Alias for: lookup_ip