Library for pulling data from the CrunchBase API.


The Crunchbase API is entirely JSON-based. By default, if present, the gem will use the YAJL gem; if not, it will fall back to the JSON gem. Please ensure one of the two is installed.


If you already know the permalink for a given entity, you can grab the entry with the get method.

require 'crunchbase'
steve = Crunchbase::Person.get("steve-jobs")
facebook = Crunchbase::Company.get("facebook")

If you know the name of the entity but not the permalink, you can use the find method.

steve = Crunchbase::Person.find("Steve", "Jobs")
github = Crunchbase::Company.find("Github")

Note that finding using a name performs two HTTP requests internally, the first returning the permalink associated with the name, and the second which returns the actual data.


Searching the Crunchbase is possible with the Search class.

s = Crunchbase::Search.find("widgets")

You can access the search results by treating the returned Search instance as an array.

first_result = s[0]
s.each { |result| puts }

The Search will return a list consisting of objects of the SearchResult type. To access the full entity object, call the entity method of the SearchResult.

While Search does include the Enumerable module, it does not implement all of the methods of Array. If you need to treat the results as an array in a way not supported, you can call to_ary; this prefetches all result pages (if they have not already been loaded), so it may entail a slight delay, depending on the number of results.

all_results = s.to_ary

List all Items

If you've gone insane and want a list of every single item for a given entity type, you can do so with the all method.

all_companies = Company.all
company = all_companies[105]

This returns an array containing objects representing each entity. Just like Search, the full item can be grabbed with the entity method. Unlike Search, however, all of the result objects are fetched at once, so iterating through the list does not entail a delay every ten items. Of course, the list is enormous (the list of all companies returns over 84,500 entries as of this writing), so it's little consolation.


Copyright © 2011-12 Tyler Cunnion. This software is made available under the MIT/X11 license. See LICENSE.txt for further details.

I am not affiliated in any way with AOL, TechCrunch, Crunchbase, or anyone really.