https://github.com/encoreshao/crunchbase-ruby-library
Ruby Library for Crunchbase API version 3.1
https://github.com/encoreshao/crunchbase-ruby-library
crunchbase-api ruby-library
Last synced: 10 months ago
JSON representation
Ruby Library for Crunchbase API version 3.1
- Host: GitHub
- URL: https://github.com/encoreshao/crunchbase-ruby-library
- Owner: encoreshao
- License: mit
- Created: 2015-05-26T10:44:31.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-06-06T14:46:34.000Z (over 5 years ago)
- Last Synced: 2025-04-27T12:09:22.945Z (10 months ago)
- Topics: crunchbase-api, ruby-library
- Language: Ruby
- Homepage:
- Size: 434 KB
- Stars: 8
- Watchers: 2
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# CrunchBase
A Ruby wrapper fo Crunchbase API v3.1 [CrunchBase Data Hub](https://data.crunchbase.com/v3.1/docs/using-the-api).
[](https://badge.fury.io/rb/crunchbase-ruby-library)
[](https://travis-ci.org/encoreshao/crunchbase-ruby-library)
[](https://coveralls.io/github/encoreshao/crunchbase-ruby-library)
-------
We are building a new gem for Crunchbase API v4.0, it will move to [Ekohe](https://github.com/ekohe/crunchbase4)
### How to installation
Add this line to your application's Gemfile:
gem 'crunchbase-ruby-library'
And then execute:
$ bundle
Or install it yourself as:
$ gem install crunchbase-ruby-library
### Certificate (User Key)
Create the file `config/initializers/crunchbase.rb` in your rails project and add user key.
require 'crunchbase'
Crunchbase::API.key = 'user_key'
Crunchbase::API.debug = false
Crunchbase::API.timeout = 60 # Default value is 60
### Creating request client
client = Crunchbase::Client.new
### Searchable items
- Organization
- Person
- Product
- IPO
- Acquisitions
- Funding Rounds
#### Searching By...
* client.search({query: "Google"}, 'organizations') # Full text search of an Organization's name, aliases
* client.search({name: "Google"}, 'organizations') # Full text search limited to name and aliases
* client.search({domain_name: "google.com"}, 'organizations') # Text search of an Organization's domain_name
* client.search({locations: "China,Shanghai"}, 'organizations') # Filter by location names (comma separated, AND'd together)
* client.search({name: "encore"}, 'people') # A full-text query of name only
* client.search({query: "encore"}, 'people') # A full-text query of name, title, and company
* client.search({types: "investor"}, 'people') # Filter by type (currently, either this is empty, or is simply "investor")
* client.search({}, 'products')
* client.search({}, 'ipos')
* client.search({}, 'acquisitions')
* client.search({}, 'funding-rounds')
returned response included data on below:
* results
* total_items
* per_page
* pages
* current_page
### Get Organization By The Permalink
* response = client.get('facebook', 'Organization')
- Relationship objects
[
primary_image founders current_team investors owned_by sub_organizations
headquarters offices products categories customers competitors
members memberships funding_rounds investments acquisitions acquired_by
ipo funds websites images videos news
]
- Methods: Get Organization with one relationship data
* response = client.get('facebook', 'Organization', 'PastTeam')
* past_team.results.collect { |p| [p.title, p.person.first_name] }
....
### Get Person By The Permalink
=> person = client.get(permalink, 'Person')
=> #
=> people = client.list('Person', page: page)
=> people.results
=> [
#,
#,
#,
#
......
]
### Batch Search
Pass in an array of requests to perform a batch search. Following parameters should be present in each request: `type`, `uuid` and `relationships` (https://data.crunchbase.com/docs/using-the-api#batch-search-capabilities).
Max 10 requests per search allowed.
=> requests = [
{ type: 'Organization', uuid: 'valid_uuid', relationships: [""] },
{ type: 'Person', uuid: 'valid_uuid', relationships: [""] },
{ type: 'Organization', uuid: 'invalid_uuid', relationships: [] },
]
=> batch_search = client.batch_search(requests)
=> batch_search = #]>
=> batch_search.results
=> [
#,
#,
# // Error object returned due to invalid uuid passed
]
### How to debug in the console
$ 1. ruby bin/console
$ 2. ./bin/console
=> client = Crunchbase::Client.new
=> ...
### Contributing
1. Fork it ( https://github.com/encoreshao/crunchbase-ruby-library/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
### Copyright
Copyright © 2017-10 Encore Shao. See LICENSE for details.