crunchbase4  is a ruby wrapper based on Crunchbase version 4 API, which provides easy to get the API data by each endpoint. CrunchBase v4 document

Most of the time, CrunchBase site APIs will update their API endpoints and data structures every few years. I built CrunchBase V2, CrunchBase V3 before, For now, for our business, I need to rebuild the ruby wrapper for CrunchBase v4.

I want to introduce how to use it in your project.


Add the gem into your project, or install it

gem 'crunchbase4'

Getting Started

1. Configure your certificate for API

require 'crunchbase4'

Crunchbase.config.user_key = 'user_key' # You need to apply a new user key for v4 from CrunchBase, old version 3.1, can't use the new API endpoint
Crunchbase.config.user_key = false # If you want to know the request information, can set the debug = true

How to Usage

- Client for API

client = Crunchbase::Client.new

- Get the organization data

pry(main)> response = client.organization('ekohe', card_id: 'press_references')
=> #<Crunchbase::Models::Organization:0x00007f8047c4d370
 @aliases=nil,
 @description=
  "At Ekohe, we believe in the positive, transformational power of technology. For 13 years, we've harnessed best-in-class strategy, design, and technical know-how to create innovative, elegant, and practical AI solutions for a variety of global organizations.\n\nFrom partnering with leading PE/VC's to multinational retail to USAID-backed development NGO’s to the worlds largest sporting event, we deliver AI and Machine Learning-driven automation that is both useful and impactful, benefiting lives daily.\n\nLocations: China, Japan, US, France, Canada",
 @identifier=["9fe491b2-b6a1-5c87-0f4d-226dd0cc97a9", "Ekohe", "ekohe"],
 @legal_name=nil,
 @linkedin="http://www.linkedin.com/company/ekohe",
 @name="Ekohe",
 @permalink="ekohe",
 @permalink_aliases=[],
 @press_references=[],
 @rank_org=146782,
 @rank_org_company=nil,
 @short_description="Creating cutting-edge, useful technical solutions to move you forward -- we deliver on the promise of AI.",
 @twitter="http://twitter.com/ekohe",
 @uuid="9fe491b2-b6a1-5c87-0f4d-226dd0cc97a9",
 @website="http://ekohe.com">
[5] pry(main)> response = client.organization('ekohe')
=> #<Crunchbase::Models::Organization:0x00007f80501b4450
 @acquirer_identifier=nil,
 @aliases=nil,
 @categories=["Apps", "Artificial Intelligence", "Big Data", "Enterprise Software", "iOS", "Retail", "UX Design"],
 @category_groups=["Apps", "Artificial Intelligence", "Commerce and Shopping", "Data and Analytics", "Design", "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=
  "At Ekohe, we believe in the positive, transformational power of technology. For 13 years, we've harnessed best-in-class strategy, design, and technical know-how to create innovative, elegant, and practical AI solutions for a variety of global organizations.\n\nFrom partnering with leading PE/VC's to multinational retail to USAID-backed development NGO’s to the worlds largest sporting event, we deliver AI and Machine Learning-driven automation that is both useful and impactful, benefiting lives daily.\n\nLocations: China, Japan, US, France, Canada",
...>
=> pry(main)> response.name
=> "Ekohe"
=> pry(main)> response.permalink
=> "ekohe"
=> pry(main)> response.permalink_aliases
=> []

- Get the organization's card data

=> pry(main)> response = client.organization('ekohe', card_id: 'press_references')
=> #<Crunchbase::Models::Organization:0x00007f8047c4d370
 @aliases=nil,
 @description=
  "At Ekohe, we believe in the positive, transformational power of technology. For 13 years, we've harnessed best-in-class strategy, design, and technical know-how to create innovative, elegant, and practical AI solutions for a variety of global organizations.\n\nFrom partnering with leading PE/VC's to multinational retail to USAID-backed development NGO’s to the worlds largest sporting event, we deliver AI and Machine Learning-driven automation that is both useful and impactful, benefiting lives daily.\n\nLocations: China, Japan, US, France, Canada",
 @identifier=["9fe491b2-b6a1-5c87-0f4d-226dd0cc97a9", "Ekohe", "ekohe"],
 @legal_name=nil,
 @linkedin="http://www.linkedin.com/company/ekohe",
 @name="Ekohe",
 @permalink="ekohe",
 @permalink_aliases=[],
 @press_references=[],
 @rank_org=146782,
 @rank_org_company=nil,
 @short_description="Creating cutting-edge, useful technical solutions to move you forward -- we deliver on the promise of AI.",
 @twitter="http://twitter.com/ekohe",
 @uuid="9fe491b2-b6a1-5c87-0f4d-226dd0cc97a9",
 @website="http://ekohe.com">
=> response.press_references
=> []


=> pry(main)> response = client.organization('facebook', card_id: 'press_references', limit: 3)
=> #<Crunchbase::Models::Organization:0x00007f8051c4c1c8
 @aliases=[],
 @description=
  "Facebook is an online social networking service that allows its users to connect with friends and family as well as make new connections. It provides its users with the ability to create a profile, update information, add images, send friend requests, and accept requests from other users. Its features include status update, photo tagging and sharing, and more.\n\n\nFacebook’s profile structure includes a timeline, information related to the user, images of the user, images added by friends of the user, notes, pages, groups, and more. It enables its users to create pages related to entertainment, sports, business, finance, preferences, hobbies, culture, religion, causes, organizations, and a number of other categories. It also enables its users to join or create groups related to a vast number of categories.\n\n\nWith millions of more users, [Friendster](http://www.crunchbase.com/organization/friendster) attempted to acquire the company for $10 million in mid-2004. Facebook turned down the offer and subsequently received $12.7 million in funding from [Accel Partners](http://www.crunchbase.com/organization/accel-partners) at a valuation of around $100 million. Facebook continued to grow opening up to high school students in September 2005 and adding a photo sharing feature the next month. The next spring, Facebook received $25 million in funding from [Greylock Partners](http://www.crunchbase.com/organization/greylock) and [Meritech Capital](http://www.crunchbase.com/organization/meritech-capital-partners) as well as previous investors [Accel Partners](http://www.crunchbase.com/organization/accel-partners) and [Peter Thiel](http://www.crunchbase.com/person/peter-thiel). The pre-money valuation for this deal was about $525 million. Facebook subsequently opened up to work networks eventually amassing over 20,000 work networks. Finally in September 2006, Facebook was opened to anyone with an email address.\n\n\nFacebook continued to receive funding most notably in January 2011 receiving $1.5 billion and valuing the company at $50 billion. A year later in February 2012, Facebook announced that it was filing for its long-anticipated initial public offering. The company went public on May 18, 2012 opening in [NASDAQ](http://www.crunchbase.com/organization/nasdaq-private-market) with shares trading at $42.05.\n\n\nFacebook announced positive numbers in February 2012 upon filing for its IPO. As of July 2013 over 1.15 billion users have logged into Facebook every month and 669 million users daily. Mobile users now make up half of Facebook’s user base with 819 million monthly actives. Facebook is one of the most trafficked sites in the United States. Additionally, Facebook is the top photo sharing site with 250 million photos uploaded per day.\n\n\nThe company has strategic partnership with AXA Group to develop marketing and commercial collaboration in the digital, social, and mobile sphere.\n\n\nFacebook is currently the owner of many applications and services such as Pagemodo Pagebuilder, [RSS Graffiti](http://www.crunchbase.com/organization/rss-graffiti), Huddle, and more. It is the world’s largest social network with over 1.32 billion monthly active users.\n\n\nFacebook was founded by Mark Zuckerberg on February 4, 2004 in Menlo Park, California.",
 @identifier=["df662812-7f97-0b43-9d3e-12f64f504fbb", "Facebook", "facebook"],
 @legal_name="Facebook, Inc.",
 @linkedin="http://www.linkedin.com/company/facebook",
 @name="Facebook",
 @permalink="facebook",
 @permalink_aliases=[],
 @press_references=
  [#<Crunchbase::Models::PressReference:0x00007f8051c8cd90
    @author=nil,
    @posted_on="2020-06-26",
    @publisher="Yahoo News",
    @title="George Floyd: US phone giant Verizon joins Facebook ad boycott",
    @url="https://finance.yahoo.com/news/george-floyd-us-phone-giant-030123422.html",
    @uuid="550817fb-02a0-43a9-9873-17aeaf63e560">,
   #<Crunchbase::Models::PressReference:0x00007f8051c8c2f0
    @author=nil,
    @posted_on="2020-06-26",
    @publisher="The Street",
    @title="Will Facebook Faceplant on Ad Boycott?",
    @url="https://www.thestreet.com/charts/latest-news/facebook-verizon-social-media-boycott-ads",
    @uuid="b437abde-68c8-40c3-ba5c-8c954c17824e">,
   #<Crunchbase::Models::PressReference:0x00007f8051c9f800
    @author="Kieren McCarthy",
    @posted_on="2020-06-25",
    @publisher="The Register",
    @title="Facebook offers end-to-end encrypted chat – if you find the right setting",
    @url="https://www.theregister.co.uk/2016/07/08/facebook_offers_endtoend_encryption/",
    @uuid="069dac77-0ff9-4416-bb78-1eed06d70211">],
 @rank_org=4,
 @rank_org_company=nil,
 @short_description="Facebook is an online social networking service that enables its users to connect with friends and family.",
 @twitter="https://twitter.com/facebook",
 @uuid="df662812-7f97-0b43-9d3e-12f64f504fbb",
 @website="http://www.facebook.com">
=> pry(main)> response.press_references.size
=> 3

- Get the person data

=> pry(main)> response = client.person('mark-zuckerberg')
=> #<Crunchbase::Models::Person:0x00007ff51d724e20
 @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",
 @facebook="https://www.facebook.com/zuck",
 @facet_ids=["investor", "rank"],
 @first_name="Mark",
 @gender="male",
 @identifier=["a01b8d46-d311-3333-7c34-aa3ae9c03f22", "Mark Zuckerberg", "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,
 @name="Mark Zuckerberg",
 @num_articles=31108,
 @num_current_advisor_jobs=4,
 @num_current_jobs=7,
 @num_event_appearances=6,
 @num_exits=nil,
 @num_exits_ipo=nil,
 @num_founded_organizations=9,
 @num_investments=8,
 @num_investments_funding_rounds=nil,
 @num_jobs=14,
 @num_lead_investments=1
...>
=> pry(main)> response.name
=> "Mark Zuckerberg"
=> pry(main)> response.permalink
=> "mark-zuckerberg"
=> pry(main)> response.permalink_aliases
=> []

API request for endpoints we completed in `crunchbase4`

<!-- Examples of organization and single card -->
response                = client.organization('ekohe')
ipos                    = client.organization('ekohe', card_id: 'ipos')
fund                    = client.organization('ekohe', card_id: 'fund')
ownership               = client.organization('ekohe', card_id: 'ownership')
founders                = client.organization('ekohe', card_id: 'founders')
investors               = client.organization('ekohe', card_id: 'investors')
jobs                    = client.organization('ekohe', card_id: 'jobs')
headquarters_address    = client.organization('ekohe', card_id: 'headquarters_address')
top_2_press_references  = client.organization('ekohe', card_id: 'press_references', limit: 2)

<!-- Examples to get the funding rounds of the organization through paging -->
response = client.organization(
  'facebook', card_id: 'participated_funding_rounds',
  limit: 5,
  order: 'announced_on:desc',
  after_id: '3cdfcecd-5377-439b-acab-cefcf6fe21a5'
)

<!-- Examples of person and single card -->

response = client.person('mark-zuckerberg')
response = client.person('mark-zuckerberg', card_id: 'participated_investments')
response = client.funding_round('3cdfcecd-5377-439b-acab-cefcf6fe21a5')
response = client.funding_round('3cdfcecd-5377-439b-acab-cefcf6fe21a5', card_id: 'investors')
response = client.acquisition('7638eae9-07b7-4fc6-ad20-5d99de3ff928')
response = client.fund('aeaac12b-df56-7039-40f9-f1992f88e20e')
response = client.ownership('4506d9ce-85d3-4a8f-89cd-07a225359d55')

<!-- Get the JSON response of entity -->

response.as_json

<!-- Search -->
client.search_organizations(query_data)
client.search_people(query_data)
client.search_funding_rounds(query_data)
client.recent_updates({
                        scope_name: 'organization',
                        field_ids: %w[name website permalink],
                        date: '2020-05-05',
                        limit: 100
                      })

<!-- Autocompletes -->
response = client.autocomplete('ekohe')
response = client.autocomplete('ekohe', collection_ids: 'organizations')
response = client.autocomplete('ekohe', collection_ids: 'organizations', limit: 3)
response = client.autocomplete('encore', collection_ids: 'people')
response = client.autocomplete('facebook', collection_ids: 'funding_rounds')
response = client.autocomplete('facebook', collection_ids: 'press_references')

<!-- Deleted Entities -->
response = client.deledeted_entities(collection_ids: 'organizations')
response = client.deledeted_entities(collection_ids: 'people')
response = client.deledeted_entities(collection_ids: 'funding_rounds')

Hopes the ruby package helps you with your project!!!

If you have any questions, ideas, suggestions or comments, or you just want to share the info to me,  please visit our from Github.


- Encore Shao