README.md in crunchbase4-0.1.0 vs README.md in crunchbase4-0.1.1
- old
+ new
@@ -1,12 +1,11 @@
# Crunchbase
-A Ruby Library for Crunchbase API v4 - [CB-v4 Doc](https://app.swaggerhub.com/apis/Crunchbase/crunchbase-enterprise_api/1.0.1)
+Crunchbase is a ruby wrapper base on Crunchbase V4 API. It provides easy to get the API data by each endpoint. [CB-v4 doc](https://app.swaggerhub.com/apis/Crunchbase/crunchbase-enterprise_api/1.0.1)
[![Gem Version](https://badge.fury.io/rb/crunchbase4.svg)](https://badge.fury.io/rb/crunchbase4)
[![Build Status](https://travis-ci.org/encoreshao/crunchbase4.svg?branch=master)](https://travis-ci.org/encoreshao/crunchbase4)
-[![Coverage Status](https://coveralls.io/repos/github/encoreshao/crunchbase4/badge.svg)](https://coveralls.io/github/encoreshao/crunchbase4)
## Installation
Add this line to your application's Gemfile:
@@ -16,14 +15,18 @@
And then execute:
$ bundle install
-## Usage
+Or install it yourself as:
-## Configure your API certificate
+ $ gem install crunchbase4
+## Getting Started
+
+### Configure your API certificate
+
```
require 'crunchbase4'
CB_CONFIG = YAML.load(File.read('crunchbase.yml'))
Crunchbase.config do |c|
@@ -33,107 +36,272 @@
OR
Crunchbase.config.user_key = CB_CONFIG['user_key']
```
-## get the organization data
+## Usage
+### The first step is to build an API client
+
```
pry(main)> client = Crunchbase::Client.new
+```
+
+### Entity
+
+#### Get the organization data
+
+```
pry(main)> response = client.organization('ekohe')
-=> #<Crunchbase::Entities::Organization:0x00007fbc5cfdf2f8
- @acquirer_identifier=nil,
- @aliases=nil,
+=> #<Crunchbase::Models::Organization:0x00007fbc5cfdf2f8
@categories=["Apps", "Artificial Intelligence", "Big Data", "E-Commerce", "Enterprise Software", "FinTech", "iOS", "Retail", "UX Design"],
@category_groups=["Apps", "Artificial Intelligence", "Commerce and Shopping", "Data and Analytics", "Design", "Financial Services", "Mobile", "Platforms", "Science and Engineering", "Software"],
- @closed_on=nil,
@company_type="for_profit",
@contact_email="info@ekohe.com",
@created_at="2013-05-14T14:28:38Z",
- @delisted_on=nil,
- @demo_days=nil,
- @description=
+ ...
...>
pry(main)> response.name
=> "Ekohe"
pry(main)> response.permalink
=> "ekohe"
```
-OR if you want to get the json data, please call `response.as_json` in your project.
+Or, if you want to use json data, please call `response.as_json` in your project.
+#### Get the person data
-## get the person data
-
```
-pry(main)> client = Crunchbase::Client.new
pry(main)> response = client.person('mark-zuckerberg')
-=> #<Crunchbase::Entities::Person:0x00007ffbf201d178
+=> #<Crunchbase::Models::Person:0x00007ffbf201d178
@aliases=["Zuck"],
@born_on="1984-05-14",
@created_at="2007-05-26T04:51:46Z",
- @description=
- "Mark Zuckerberg is the founder and CEO of Facebook, which he started in his college dorm room in 2004 with roomates Dustin Moskovitz and Chris Hughes and from New York.\r\n\r\nZuckerberg is responsible for setting the overall direction and product strategy for the company. He leads the design of Facebook's service and development of its core technology and infrastructure. Mark studied computer science at Harvard University before moving the company to Palo Alto, California.\r\n\r\nEarlier in life, Zuckerberg developed a music recommendation system called Synapse and a peer-to-peer client called Wirehog. However, he abandoned both to pursue new projects.\r\n\r\nZuckerberg attended Harvard University and studied computer science before founding Facebook.\r\n\r\nWhile at Harvard, Zuckerberg created Facemash, a website that compared students' dorm photos side-by-side in a fashion similar to HOT or NOT. Harvard administration was not amused, and Zuckerberg faced subsequent disciplinary action. Less than three months later, he launched Facebook.\r\n\r\nIn September 2010, Zuckerberg donated $100 million to the Newark Public School System to help renovate and revamp the system.\r\n\r\nZuckerberg won the 2007 Crunchie Award for 'Best Startup CEO.' He was the Time Magazine 2010 Person Of The Year. He also won the 2012 Crunchie Award for CEO of the year.",
- @died_on=nil,
@entity_def_id="person",
@entity_id="mark-zuckerberg",
@facebook="https://www.facebook.com/zuck",
@facet_ids=["investor", "rank"],
@first_name="Mark",
@gender="male",
- @identifier="Mark Zuckerberg",
...>
pry(main)> response.name
=> "Mark Zuckerberg"
pry(main)> response.permalink
=> "mark-zuckerberg"
```
-OR if you want to get the json data, please call `response.as_json` in your project.
+#### Get the funding round data
```
-pry(main)> response.as_json
-=> {:born_on=>"1984-05-14",
- :created_at=>"2007-05-26T04:51:46Z",
- :died_on=>nil,
- :entity_def_id=>"person",
- :facebook=>"https://www.facebook.com/zuck",
- :facet_ids=>["investor", "rank"],
- :first_name=>"Mark",
- :gender=>"male",
- :identifier=>"Mark Zuckerberg",
- :image_id=>"v1448830269/gzcifut4c2xah95x0ewd.jpg",
- :image_url=>"https://res.cloudinary.com/crunchbase-production/image/upload/v1448830269/gzcifut4c2xah95x0ewd.jpg",
- :investor_stage=>["seed"],
- :investor_type=>["investment_partner", "angel"],
- :last_name=>"Zuckerberg",
- :layout_id=>"investor",
- :linkedin=>nil,
- :location_group_identifiers=>["San Francisco Bay Area", "Silicon Valley", "West Coast", "Western US"],
- :location_identifiers=>["Palo Alto", "California", "United States", "North America"],
- :middle_name=>nil,
- :num_articles=>31046,
- :num_current_advisor_jobs=>4,
- :num_current_jobs=>7,
- :num_event_appearances=>6,
- :num_exits=>nil,
+=> #<Crunchbase::Client:0x00007f8806824c28>
+pry(main)> response = client.funding_round('371c20af-8aa9-4bcb-a8da-0694d138f247')
+=> #<Crunchbase::Models::FundingRound:0x00007f8806b55ca8
+ @announced_on="2013-06-30",
+ @closed_on=nil,
+ @created_at="2020-04-02T12:17:59Z",
+ @entity_def_id="funding_round",
+ @funded_organization_categories=nil,
+ @funded_organization_description="Facebook is an online social networking service that enables its users to connect with friends and family.",
+ @funded_organization_funding_stage="ipo",
+ @funded_organization_funding_total=2335700000,
+ @funded_organization_identifier="Facebook",
+ @funded_organization_location=["Menlo Park", "California", "United States", "North America"],
+ @funded_organization_revenue_range="r_10000000",
....>
+pry(main)> response.name
+=> "Secondary Market - Facebook"
+pry(main)> response.uuid
+=> "371c20af-8aa9-4bcb-a8da-0694d138f247"
```
+#### Get the acquisition data
+
+```
+pry(main)> response = client.acquisition('7638eae9-07b7-4fc6-ad20-5d99de3ff928')
+=> #<Crunchbase::Models::Acquisition:0x00007fa01134da60
+ @acquiree_categories=["Communities", "Internet", "Photo Sharing", "Publishing", "Search Engine", "Social Media"],
+ @acquiree_funding_total=150949998,
+ @acquiree_identifier="Giphy",
+ @acquiree_last_funding_type="series_d",
+ @acquiree_locations=["New York", "New York", "United States", "North America"],
+ ...>
+pry(main)> response.uuid
+=> "7638eae9-07b7-4fc6-ad20-5d99de3ff928"
+pry(main)> response.acquiree_funding_total
+=> 150949998
+```
+
+#### Get the press reference data
+
+```
+pry(main)> response = client.press_reference('0171b30e-9cf8-4ad5-8288-2993e4308e0f')
+=> #<Crunchbase::Models::PressReference:0x00007fce2d33dbc0
+ @activity_entities=["Facebook", "General Atlantic", "KKR", "Reliance Industries", "Vista Equity Partners"],
+ @author=nil,
+ @created_at="2020-06-05T17:41:10Z",
+ @entity_def_id="press_reference",
+ @identifier="Jio Platforms to receive $1.2b from Abu Dhabi’s sovereign investment firm",
+ @posted_on="2020-06-05",
+ @publisher="Tech in Asia",
+ @thumbnail_url="https://cdn.techinasia.com/wp-content/uploads/2016/07/Flickr_-_World_Economic_Forum_-_Ambani.jpg",
+ @title="Jio Platforms to receive $1.2b from Abu Dhabi’s sovereign investment firm",
+ @updated_at="2020-06-05T17:41:10Z",
+ @url="https://ift.tt/3cByFh1",
+ @uuid="0171b30e-9cf8-4ad5-8288-2993e4308e0f">
+```
+
+#### Get the investment data
+
+```
+pry(main)> response = client.investment('1368da0c-07b0-46ef-9a86-b518367e60d6')
+=> #<Crunchbase::Models::Investment:0x00007f8c15105830
+ @announced_on="2013-06-30",
+ @created_at="2020-04-02T12:17:59Z",
+ @entity_def_id="investment",
+ @funding_round_identifier="Secondary Market - Facebook",
+ @funding_round_money_raised=nil,
+ @identifier="Jean-Brice Abrial investment in Secondary Market - Facebook",
+ @investor_identifier="Jean-Brice Abrial",
+ @investor_stage=["early_stage_venture", "seed"],
+ @investor_type=["angel"],
+ @is_lead_investor=nil,
+ @money_invested=1500000.0,
+ @name="Jean-Brice Abrial investment in Secondary Market - Facebook",
+ @organization_identifier="Facebook",
+ @partner_identifiers=nil,
+ @permalink="jean-brice-abrial-invested-in-facebook-secondary-market--371c20af--1368da0c",
+ @updated_at="2020-04-02T12:17:59Z",
+ @uuid="1368da0c-07b0-46ef-9a86-b518367e60d6">
+```
+
+### Search
+
+* Search query parameters for each endpoint
+
+```
+{
+ "field_ids": [],
+ "query": [],
+ "order": [],
+ "limit": 0
+}
+```
+
+#### Search organizations by query conditions and order
+
+* Step1: Needs to build the query conditions
+
+```
+query_data = {
+ 'field_ids' => %w[
+ name
+ website
+ uuid
+ short_description
+ company_type
+ ],
+ 'order' => [
+ {
+ 'field_id' => 'company_type',
+ 'sort' => 'asc'
+ }
+ ],
+ 'query' => [
+ {
+ 'type' => 'predicate',
+ 'field_id' => 'funding_total',
+ 'operator_id' => 'between',
+ 'values' => [
+ {
+ 'value' => 1_000_000,
+ 'currency' => 'usd'
+ },
+ {
+ 'value' => 10_000_000,
+ 'currency' => 'usd'
+ }
+ ]
+ },
+ {
+ 'type' => 'predicate',
+ 'field_id' => 'facet_ids',
+ 'operator_id' => 'includes',
+ 'values' => %w[company investor]
+ }
+ ],
+ 'limit' => 4
+}
+```
+
+* Use `client` to send a request and parse response
+
+```
+pry(main)> response = client.search_organizations(query_data)
+=> #<Crunchbase::Searches::Client:0x00007fdfc1ad6eb8
+ @conditions=
+ {"field_ids"=>["name", "website", "uuid", "short_description", "company_type"],
+ "order"=>[{"field_id"=>"company_type", "sort"=>"asc"}],
+ "query"=>
+ [{"type"=>"predicate", "field_id"=>"funding_total", "operator_id"=>"between", "values"=>[{"value"=>1000000, "currency"=>"usd"}, {"value"=>10000000, "currency"=>"usd"}]},
+ {"type"=>"predicate", "field_id"=>"facet_ids", "operator_id"=>"includes", "values"=>["company", "investor"]}],
+ "limit"=>4},
+ @count=4,
+ @entities=
+ [#<Crunchbase::Models::Organization:0x00007fdfc1b06460
+ @company_type="for_profit",
+ @name="360VUZ",
+ @short_description="360VUZ is an immersive virtual video mobile app that enables users to teleport from their smartphone in 360°",
+ @uuid="cb32a4d7-2bd0-1727-a055-63aa6a545380",
+ @website="http://www.360VUZ.com">,
+ #<Crunchbase::Models::Organization:0x00007fdfc1b05b78
+ @company_type="for_profit",
+ @name="HATCHER+",
+ @short_description="Hatcher+ is a data-driven venture investment platform.",
+ @uuid="a0ed41b8-8031-adad-dbb3-2e8f8e1e6848",
+ @website="https://h2.hatcher.com">,
+ #<Crunchbase::Models::Organization:0x00007fdfc1b05290
+ @company_type="for_profit",
+ @name="Merck",
+ @short_description="Merck is a biopharmaceutical company that offers medicines and vaccines for various diseases.",
+ @uuid="2f9b212a-d3aa-a8c2-6317-516127c8ba88",
+ @website="http://www.merck.com">,
+ #<Crunchbase::Models::Organization:0x00007fdfc1b049a8
+ @company_type="for_profit",
+ @name="Archistar.ai",
+ @short_description="World-first artificial intelligence helping professionals find development sites, assess for feasibility and generate architectural designs",
+ @uuid="3be8b43a-1143-4e26-8ecb-660a5a78edc5",
+ @website="https://archistar.ai/">],
+ @entity_type="organization",
+ @kclass_name=Crunchbase::Models::Organization,
+ @total_count=44871>
+```
+
+- Get all entities: `response.entities`
+- Get total count: `response.total_count`
+- Get entities count: `response.count`
+
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
-To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
+### Examples of API requests
+```
+Crunchbase.config.user_key = 'user_key'
+client = Crunchbase::Client.new
+response = client.organization('ekohe')
+response = client.person('mark-zuckerberg')
+response = client.funding_round('371c20af8aa94bcba8da0694d138f247')
+response = client.acquisition('7638eae9-07b7-4fc6-ad20-5d99de3ff928')
+```
+
## Contributing
-Bug reports and pull requests are welcome on GitHub at https://github.com/encoreshao/crunchbase4. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/encoreshao/crunchbase4/blob/master/CODE_OF_CONDUCT.md).
+Bug reports and pull requests are welcome on GitHub at https://github.com/ekohe/crunchbase4. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/ekohe/crunchbase4/blob/master/CODE_OF_CONDUCT.md).
-
## License
-The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
+Crunchbase is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
## Code of Conduct
-Everyone interacting in the Crunchbase project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/encoreshao/crunchbase4/blob/master/CODE_OF_CONDUCT.md).
+Everyone interacting in the Crunchbase project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ekohe/crunchbase4/blob/master/CODE_OF_CONDUCT.md).