lib/demandbase.rb in demandbase-0.1.3 vs lib/demandbase.rb in demandbase-0.1.4
- old
+ new
@@ -4,20 +4,58 @@
require 'demandbase/error'
require 'demandbase/record'
module Demandbase
- class << self
+ # Standard Industrial Classification (SIC) codes for organizations providing
+ # elementary, secondary, tertiary, or quaternary education.
+ #
+ # See https://github.com/leereilly/csi/blob/master/lib/data/master.toml for
+ # a complete list.
+ ACADEMIC_SIC_CODES = [
+ "82", # educational services
+ "821", # elementary and secondary schools
+ "8211", # elementary and secondary schools
+ "822", # colleges, universities, professional schools and junior colleges
+ "8221", # colleges, universities, and professional schools
+ "8222", # junior colleges and technical institutes
+ "824", # vocational schools
+ "8243", # data processing schools
+ "8244", # business and secretarila schools
+ "8249", # vocational schools, not elsewhere classified
+ "829", # schools and educational services, not elsewhere classified
+ "8299" # schools and educational services, not elsewhere classified
+ ]
+
+ class << self
+
# 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.
#
def lookup(domain)
Demandbase::Record.new(domain)
+ end
+
+ # 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.
+ #
+ def is_academic?(domain)
+ record = Demandbase::Record.new(domain)
+ if record && ACADEMIC_SIC_CODES.include?(record.primary_sic)
+ return true
+ else
+ return false
+ end
end
end
end
\ No newline at end of file