The Demandbase gem is a Ruby wrapper for the [Demandbase](http://www.demandbase.com?affiliate_id=LOL_JK_MAYBE) real-time targeting and personalization platform's [API](http://wiki.demandbaselabs.com/mwiki/index.php?title=Demandbase_API_Documentation). ### Prerequisites You'll need an active Demandbase account with at least one Real Time Identification (RTID) key. You can sign up for a trial developer key [here](http://www.demandbase.com/who-is-demandbase/contact-demandbase/?affiliate_id=LOL_JK_MAYBE). ### Installation Install the Demandbase wrapper with: `gem install demandbase` or add the following to your `Gemfile`: `gem 'demandbase', '~> 0.1.1'` ### Configuraton Set an environment variable called `$DEMANDBASE_RTID_KEY` with the your RTID key value. #### Bash Example ``` export DEMANDBASE_RTID_KEY=1234deadbeef4321 ``` #### Heroku Example ``` heroku config:add DEMANDBASE_RTID_KEY=1234deadbeef4321 ``` ### Usage #### Domain Lookup If everything's installed and configured you should be able to look up companies' information via their domain name as follows: ```ruby record = Demandbase::lookup_domain 'microsoft.com' # => record.company_name # => "Microsoft Corporation" record.is_academic? # => false record.is_government? # => false record.demandbase_sid # => 457441 record.marketing_alias # => "Microsoft" record.industry # => "Software & Technology" record.sub_industry # => "Software Applications" record.employee_count # => 94050 record.primary_sic # => "7372" record.street_address # => "1 Microsoft Way" record.city # => "Redmond" record.state # => "WA" record.zip # => "98052" record.country # => "US" record.country_name # => "United States" record.phone # => "425-882-8080" record.stock_ticker # => "MSFT" record.web_site # => "microsoft.com" record.annual_sales # => 73723000000 record.revenue_range # => "Over $5B" record.employee_range # => "Enterprise" record.b2b # => true record.b2c # => true record.traffic # => "Very High" record.latitude # => 47.6401 record.longitude # => -122.13 record.fortune_1000 # => true record.forbes_2000 # => true ``` #### IP Lookup The IP lookup returns some additional information e.g. ```ruby record = Demandbase::lookup_ip 'microsoft.com' # => ``` #### Lazy Lookup If you have an IP, domain name, email address, or craptacular URL and just want to use that use `lookup` ```ruby ip_looking_thing = '12.12.12.12' domain_looking_thing 'http://google.com' url_looking_thing 'www.google.com/lol?seriously=true' email_looking_thing 'willy@microsoft.com' (Demandbase::lookup ip_looking_thing).class # => Demanbase::IPRecord (Demandbase::lookup domain_looking_thing).class # => Demanbase::DomainRecord (Demandbase::lookup url_looking_thing).class # => Demanbase::DomainRecord (Demandbase::lookup email_looking_thing).class # => Demanbase::DomainRecord ``` ### Field Info
Field name (click for description) DomainRecord Presence? IPRecord Presence?
registry_company_name :finnadie: :metal:
registry_city :finnadie: :metal:
registry_state :finnadie: :metal:
registry_country :finnadie: :metal:
registry_latitude :finnadie: :metal:
registry_longitude :finnadie: :metal:
ip :finnadie: :metal:
information_level :finnadie: :metal:
worldhq_sid :finnadie: :metal:
domestichq_sid :finnadie: :metal:
hq_sid :finnadie: :metal:
isp :finnadie: :metal:
company_name :metal: :metal:
demandbase_sid :metal: :metal:
marketing_alias :metal: :metal:
industry :metal: :metal:
sub_industry :metal: :metal:
employee_count :metal: :metal:
primary_sic :metal: :metal:
street_address :metal: :metal:
city :metal: :metal:
state :metal: :metal:
zip :metal: :metal:
country :metal: :metal:
country_name :metal: :metal:
phone :metal: :metal:
web_site :metal: :metal:
annual_sales :metal: :metal:
revenue_range :metal: :metal:
employee_range :metal: :metal:
b2b :metal: :metal:
b2c :metal: :metal:
traffic :metal: :metal:
latitude :metal: :metal:
longitude :metal: :metal:
fortune_1000 :metal: :metal:
forbes_2000 :metal: :metal:
#### Registry Company Name #### Registry City #### Registry State #### Registry Country #### Registry Latitude #### Registry Longitude #### IP #### Information Level #### World HQ SID #### Domestic HQ SID #### HQ SID #### ISP #### Company Name #### Demandbase SID #### Marketing Alias #### Industry #### Sub Industry #### Employee Count #### Primary SIC #### Street Address #### City #### State #### Zip #### Country #### Country Name #### Phone #### Web Site #### Annual Sales #### Revenue Range #### Revenue Range
Value Description
$1 - $1M :credit_card:
$1M - $5M :dollar:
$5M - $10M :dollar: :dollar:
$10M - $25M :dollar: :dollar: :dollar: :dollar: :dollar: :dollar: :dollar: :dollar: :dollar: :dollar:
$25M - $50M :dollar: :dollar: :dollar: :dollar: :dollar: :dollar: :dollar: :dollar: :dollar: :dollar: :dollar: :dollar: :dollar: :dollar: :dollar: :dollar: :dollar: :dollar: :dollar: :dollar:
$50M - $100M :moneybag:
$100M - $250M :moneybag::moneybag:
$250M - $500M :moneybag::moneybag::moneybag:
$500M - $1B :moneybag::moneybag::moneybag::moneybag:
$1B - $2.5B :moneybag::moneybag::moneybag::moneybag::moneybag:
$2.5B - $5B :moneybag::moneybag::moneybag::moneybag::moneybag::moneybag:
Over $5B :money_with_wings:
#### Employee Range
Value Description
Unknown :house:
Small :school:1-99 employees
Mid-Market :department_store: 100-999 employees
Enterprise :office: 1000+ employees
#### Audience
Company Size Vertical Origination
Enterprise
Mid-Market
SMB
Government
Education
Wireless
Residential
SOHO
Unknown
#### Audience Segment
Company Size Government Education Wireless Residential/SOHO/Unknown
Industry
Search Engine
Federal
International
State
City
Local
Military
Public Safety
University
K12
Vocational
Educational Services
Educational ISP
Wireless Device
Wireless Hotspot
Bots
#### B2B #### B2C #### Traffic #### Latitude #### Longitude #### Fortune 1000 #### Forbes 2000 ### DLC / Enhancements * Use the [csi](https://github.com/leereilly/csi) gem if you'd like to correlate SIC codes with NAICS codes. * Use the [fortune-finder](https://github.com/leereilly/fortune-finder) gem if you'd like to retrieve the ranking of a Fortune 500 company. * Use the [forbes-finder](https://github.com/leereilly/forbes-finder) gem if you'd like to retrieve the ranking of a Fortune 1000 company. # License MIT.