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
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
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
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
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
# File lib/demandbase.rb, line 112 def lookup_domain(query) Demandbase::DomainRecord.new(query) end
# File lib/demandbase.rb, line 107 def lookup_ip(query) Demandbase::IPRecord.new(query) end