/crunchbase_v2

Library for pulling data from the CrunchBase Version 2 API.

Primary LanguageRubyMIT LicenseMIT

Crunchbase API

Ruby API wrapper for [Crunchbase API](developer.crunchbase.com/docs) version 2.

Installation

Add this line to your application’s Gemfile:

gem 'crunchbase_v2'

And then execute:

$ bundle

Or install it yourself as:

$ gem install crunchbase_v2

Usage Examples

Config your user_key, debug somewhere like development.rb, Recommended directory config/initializers/crunchbase.rb

require 'crunchbase'

Crunchbase::API.key   = 'user_key'
Crunchbase::API.debug = false

Searching the Crunchbase is possible with the Search class, The Search will return a list consisting of objects of the SearchResult type.

response = Crunchbase::Search.search("facebook")
OR
response = Crunchbase::Search.search({ domain_name: 'facebook.com' }, 'organizations')
response.total_items || response.per_page || response.pages || response.current_page
all_results = response.results
all_results.each { |r| puts r.name }

Organizations && RelationShip List Items

Get information by the permalink, Example:

response = Crunchbase::Organization.get("facebook")
Relationship objects [ competitors customers founders funding_rounds ipos products sub_organizations, acquisitions ]
response.competitors               Only return Top 8 items
response.competitors_total_items   Return competitors total items count
response.competitors.each do |e|
  competitor = (a.fetch || 
  puts competitor.name
end
OR
Friendly relationship objects [ past_teams current_teams offices headquarters categories investments primary_images images websites new_items board_members_and_advisors ]
response.websites

If you want all competitors items, Please do:

response = Crunchbase::Competitor.lists_for_permalink(response.permalink)
response.per_page
response.current_page
response.size
response.results           Return all competitors items

People

person = Crunchbase::Person.get( permalink )

#<Crunchbase::Person:0x007fc95bca3880 @type_name="Person" ..... > 

people = Crunchbase::Person.list( page )

people.results

[ #<Crunchbase::SearchResult:0x007fd16ae18b40 ...>, 
#<Crunchbase::SearchResult:0x007fd16ae18870 ...>, 
#<Crunchbase::SearchResult:0x007fd16ae185a0 ...>, 
#<Crunchbase::SearchResult:0x007fd16ae182f8 ...>
...... ]

How to use Location & Category .…

Such as a Person

Contributing

Contributions are welcome. Note that in order to run the test suite, you need to include an API key in spec/apikey.yml. This file is ignored by git. An example file is provided for convenience.

Copyright © 2014-08 Encore Shao. See LICENSE for details.