crunchbase_v2 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/.gitignore +25 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.rdoc +88 -0
  5. data/Rakefile +7 -0
  6. data/crunchbase.gemspec +24 -0
  7. data/lib/crunchbase.rb +36 -0
  8. data/lib/crunchbase/acquisition.rb +66 -0
  9. data/lib/crunchbase/api.rb +153 -0
  10. data/lib/crunchbase/board_members_and_advisor.rb +23 -0
  11. data/lib/crunchbase/category.rb +22 -0
  12. data/lib/crunchbase/cb_entity.rb +70 -0
  13. data/lib/crunchbase/competitor.rb +25 -0
  14. data/lib/crunchbase/crunch_exception.rb +6 -0
  15. data/lib/crunchbase/current_team.rb +26 -0
  16. data/lib/crunchbase/customer.rb +21 -0
  17. data/lib/crunchbase/founder.rb +21 -0
  18. data/lib/crunchbase/funding_round.rb +69 -0
  19. data/lib/crunchbase/headquarter.rb +27 -0
  20. data/lib/crunchbase/image.rb +21 -0
  21. data/lib/crunchbase/investment.rb +33 -0
  22. data/lib/crunchbase/ipo.rb +57 -0
  23. data/lib/crunchbase/location.rb +24 -0
  24. data/lib/crunchbase/new_item.rb +22 -0
  25. data/lib/crunchbase/office.rb +28 -0
  26. data/lib/crunchbase/organization.rb +246 -0
  27. data/lib/crunchbase/past_team.rb +29 -0
  28. data/lib/crunchbase/person.rb +31 -0
  29. data/lib/crunchbase/primary_image.rb +21 -0
  30. data/lib/crunchbase/product.rb +78 -0
  31. data/lib/crunchbase/relationship.rb +17 -0
  32. data/lib/crunchbase/search.rb +45 -0
  33. data/lib/crunchbase/search_result.rb +11 -0
  34. data/lib/crunchbase/sub_organization.rb +21 -0
  35. data/lib/crunchbase/version.rb +3 -0
  36. data/lib/crunchbase/website.rb +20 -0
  37. data/spec/apikey.example.yml +2 -0
  38. data/spec/bootstrap.rb +9 -0
  39. data/spec/crunchbase/acquisition_spec.rb +26 -0
  40. data/spec/crunchbase/api_spec.rb +8 -0
  41. data/spec/crunchbase/board_members_and_advisor_spec.rb +16 -0
  42. data/spec/crunchbase/category_spec.rb +25 -0
  43. data/spec/crunchbase/competitor_spec.rb +19 -0
  44. data/spec/crunchbase/current_team_spec.rb +17 -0
  45. data/spec/crunchbase/customer_spec.rb +20 -0
  46. data/spec/crunchbase/founder_spec.rb +20 -0
  47. data/spec/crunchbase/funding_round_spec.rb +26 -0
  48. data/spec/crunchbase/headquarter_spec.rb +17 -0
  49. data/spec/crunchbase/investment_spec.rb +20 -0
  50. data/spec/crunchbase/ipo_spec.rb +29 -0
  51. data/spec/crunchbase/location_spec.rb +16 -0
  52. data/spec/crunchbase/new_item_spec.rb +33 -0
  53. data/spec/crunchbase/office_spec.rb +19 -0
  54. data/spec/crunchbase/organization_spec.rb +62 -0
  55. data/spec/crunchbase/past_team_spec.rb +16 -0
  56. data/spec/crunchbase/person_spec.rb +23 -0
  57. data/spec/crunchbase/primary_image_spec.rb +21 -0
  58. data/spec/crunchbase/product_spec.rb +28 -0
  59. data/spec/crunchbase/search_result_spec.rb +16 -0
  60. data/spec/crunchbase/search_spec.rb +17 -0
  61. data/spec/crunchbase/sub_organization_spec.rb +21 -0
  62. data/spec/crunchbase/website_spec.rb +25 -0
  63. data/spec/fixtures/facebook-acquisition.js +82 -0
  64. data/spec/fixtures/facebook-funding-round.js +96 -0
  65. data/spec/fixtures/organization-facebook.js +1023 -0
  66. data/spec/fixtures/person-randi-zuckerberg.js +233 -0
  67. data/spec/spec_helper.rb +10 -0
  68. metadata +192 -0
@@ -0,0 +1,19 @@
1
+ require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
2
+
3
+ module Crunchbase
4
+ describe Office do
5
+ describe "advanced indexing" do
6
+ before(:all) do
7
+ @all_offices = Office.lists_for_permalink("facebook")
8
+ end
9
+
10
+ it "should pull from web api" do
11
+ @all_offices.per_page.should == 1000
12
+ @all_offices.current_page.should == 1
13
+ @all_offices.items.count.should == 3
14
+
15
+ puts @all_offices.items.inspect
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,62 @@
1
+ require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
2
+
3
+ module Crunchbase
4
+ describe Organization do
5
+
6
+ describe "Get Organization object from premalink" do
7
+ before(:all) do
8
+ @company = Organization.get("facebook")
9
+ end
10
+
11
+ it "should loading relationship data" do
12
+ puts @company.websites_total_items
13
+ puts @company.websites.inspect
14
+ teams = Website.lists_for_permalink(@company.permalink)
15
+ end
16
+
17
+ it "should organization's websites data" do
18
+ # Top 8 websites
19
+ puts @company.websites
20
+ # Show websites total count
21
+ puts @company.websites_total_items
22
+ # Show organization's websites list search by organization permalink
23
+ teams = Website.lists_for_permalink(@company.permalink)
24
+ end
25
+
26
+ it "should pull from web api" do
27
+ @company.name.should == "Facebook"
28
+ @company.competitors_total_items.should == 9
29
+ @company.customers_total_items.should == 1
30
+ @company.founders_total_items.should == 5
31
+ @company.funding_rounds_total_items.should == 11
32
+ @company.ipos_total_items.should == 3
33
+ @company.products_total_items.should == 16
34
+ @company.sub_organizations_total_items.should == 2
35
+
36
+ @company.past_teams_total_items.should == 186
37
+ @company.current_teams_total_items.should == 137
38
+ @company.acquisitions_total_items.should == 49
39
+ @company.offices_total_items.should == 3
40
+ @company.headquarters_total_items.should == 1
41
+ @company.categories_total_items.should == 7
42
+ @company.investments_total_items.should == 3
43
+ @company.primary_images_total_items.should == 1
44
+ @company.images_total_items.should == 1
45
+ @company.websites_total_items.should == 6
46
+ @company.new_items_total_items.should == 3116
47
+ @company.board_members_and_advisors_total_items.should == 12
48
+ end
49
+
50
+
51
+ end
52
+
53
+ it "Search organizations by name" do
54
+ results = Organization.search({ domain_name: "facebook.com", organization_types: 'company' })
55
+
56
+ results.per_page.should == 1000
57
+ results.current_page.should == 1
58
+ puts results.results[0].inspect
59
+ end
60
+
61
+ end
62
+ end
@@ -0,0 +1,16 @@
1
+ require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
2
+
3
+ module Crunchbase
4
+ describe PastTeam do
5
+ describe "advanced indexing" do
6
+ before(:all) do
7
+ @all_past_teams = PastTeam.lists_for_permalink("facebook")
8
+ end
9
+
10
+ it "should pull from web api" do
11
+ @all_past_teams.per_page.should == 1000
12
+ @all_past_teams.current_page.should == 1
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,23 @@
1
+ require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
2
+ require 'json'
3
+
4
+ module Crunchbase
5
+ describe Person do
6
+ describe "advanced indexing" do
7
+ before(:all) do
8
+ @all_person = Person.list
9
+ end
10
+
11
+ it "should pull from web api" do
12
+ @all_person.per_page.should == 1000
13
+ @all_person.current_page.should == 1
14
+ puts @all_person.results[0..10].inspect
15
+ end
16
+ end
17
+
18
+ # it "should pull from web api" do
19
+ # person = Crunchbase::Person.get('eduardo-saverin')
20
+ # person.permalink.should == 'eduardo-saverin'
21
+ # end
22
+ end
23
+ end
@@ -0,0 +1,21 @@
1
+ require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
2
+
3
+ module Crunchbase
4
+ describe PrimaryImage do
5
+
6
+ describe "advanced indexing" do
7
+ before(:all) do
8
+ @all_primary_image = PrimaryImage.lists_for_permalink("facebook")
9
+ end
10
+
11
+ it "should pull from web api" do
12
+ @all_primary_image.per_page.should == 1000
13
+ @all_primary_image.current_page.should == 1
14
+ end
15
+
16
+ it "should get a company all primary image list" do
17
+ @all_primary_image.items[0].title.should == nil
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,28 @@
1
+ require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
2
+
3
+ module Crunchbase
4
+ describe Product do
5
+
6
+ describe "advanced indexing" do
7
+ before(:all) do
8
+ @all_products = Product.lists_for_permalink("facebook")
9
+ end
10
+
11
+ it "should pull from web api" do
12
+ @all_products.per_page.should == 1000
13
+ @all_products.current_page.should == 1
14
+ @all_products.size.should == 16
15
+ @all_products.results.count.should == 16
16
+ puts @all_products.results.inspect
17
+ end
18
+ end
19
+
20
+ # it "should pull from web api" do
21
+ # product = Product.get("internet-org")
22
+
23
+ # product.name.should == "Internet.org"
24
+ # product.permalink.should == "internet-org"
25
+ # end
26
+
27
+ end
28
+ end
@@ -0,0 +1,16 @@
1
+ require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
2
+ require 'net/http'
3
+
4
+ module Crunchbase
5
+ describe SearchResult do
6
+
7
+ before(:all) do
8
+ @result = Search.find('google').results[0]
9
+ end
10
+
11
+ it "should return the entity which is named" do
12
+ @result.name.should == 'Google'
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
2
+ require 'net/http'
3
+
4
+ module Crunchbase
5
+ describe Search do
6
+
7
+ it "should retrieve search results" do
8
+ s = Search.search('google')
9
+ puts s.total_items
10
+ puts s.per_page
11
+ puts s.pages
12
+ puts s.current_page
13
+ s.results.each { |result| puts result.name }
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
2
+
3
+ module Crunchbase
4
+ describe SubOrganization do
5
+
6
+ describe "advanced indexing" do
7
+ before(:all) do
8
+ @all_sub_organizations = SubOrganization.lists_for_permalink("facebook")
9
+ end
10
+
11
+ it "should pull from web api" do
12
+ @all_sub_organizations.per_page.should == 1000
13
+ @all_sub_organizations.current_page.should == 1
14
+ @all_sub_organizations.size.should == 2
15
+
16
+ puts @all_sub_organizations.items.inspect
17
+ end
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,25 @@
1
+ require File.join(File.dirname(__FILE__), "..", "spec_helper.rb")
2
+
3
+ module Crunchbase
4
+ describe Website do
5
+
6
+ describe "advanced indexing" do
7
+ before(:all) do
8
+ @all_websites = Website.lists_for_permalink("facebook")
9
+ end
10
+
11
+ it "should pull from web api" do
12
+ puts @all_websites.items.first.title
13
+ puts @all_websites.next_page_url
14
+
15
+ @all_websites.per_page.should == 1000
16
+ @all_websites.current_page.should == 1
17
+ @all_websites.items.count.should == 6
18
+ end
19
+
20
+ it "Show Top 8 websites" do
21
+ puts @all_websites.items.inspect
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,82 @@
1
+ {
2
+ "metadata": {
3
+ "version": 2,
4
+ "www_path_prefix": "http://www.crunchbase.com/",
5
+ "api_path_prefix": "http://api.crunchbase.com/v/2/",
6
+ "image_path_prefix": "http://images.crunchbase.com/"
7
+ },
8
+ "data": {
9
+ "uuid": "7a3d7915ed43073c0e4b5b0d7601def8",
10
+ "type": "Acquisition",
11
+ "properties": {
12
+ "announced_on_year": 2014,
13
+ "announced_on_day": 7,
14
+ "announced_on_month": 8,
15
+ "announced_on": "2014-08-07",
16
+ "announced_on_trust_code": 7,
17
+ "price_currency_code": "USD",
18
+ "permalink": "7a3d7915ed43073c0e4b5b0d7601def8",
19
+ "name": "Acquisition",
20
+ "payment_type": null,
21
+ "price": null,
22
+ "disposition_of_acquired": null,
23
+ "acquisition_type": "Acquisition",
24
+ "acquisition_status": "Complete",
25
+ "price_usd": null,
26
+ "created_at": 1407440714,
27
+ "updated_at": 1407440714
28
+ },
29
+ "relationships": {
30
+ "acquirer": {
31
+ "paging": {
32
+ "total_items": 1,
33
+ "first_page_url": "http://api.crunchbase.com/v/2/acquisition/7a3d7915ed43073c0e4b5b0d7601def8/acquirer",
34
+ "sort_order": "created_at DESC"
35
+ },
36
+ "items": [
37
+ {
38
+ "type": "Organization",
39
+ "name": "Facebook",
40
+ "path": "organization/facebook",
41
+ "created_at": 1180153335,
42
+ "updated_at": 1408498922
43
+ }
44
+ ]
45
+ },
46
+ "acquiree": {
47
+ "paging": {
48
+ "total_items": 1,
49
+ "first_page_url": "http://api.crunchbase.com/v/2/acquisition/7a3d7915ed43073c0e4b5b0d7601def8/acquiree",
50
+ "sort_order": "created_at DESC"
51
+ },
52
+ "items": [
53
+ {
54
+ "type": "Organization",
55
+ "name": "PrivateCore",
56
+ "path": "organization/privatecore",
57
+ "created_at": 1339064229,
58
+ "updated_at": 1397987412
59
+ }
60
+ ]
61
+ },
62
+ "news": {
63
+ "paging": {
64
+ "total_items": 1,
65
+ "first_page_url": "http://api.crunchbase.com/v/2/acquisition/7a3d7915ed43073c0e4b5b0d7601def8/news",
66
+ "sort_order": "created_at DESC"
67
+ },
68
+ "items": [
69
+ {
70
+ "url": "http://techcrunch.com/2014/08/07/facebook-buys-secure-server-technology-provider-privatecore/",
71
+ "author": null,
72
+ "posted_on": null,
73
+ "type": "PressReference",
74
+ "title": "Facebook Buys Secure Server Technology Provider PrivateCore | TechCrunch",
75
+ "created_at": 1407466104,
76
+ "updated_at": 1407466104
77
+ }
78
+ ]
79
+ }
80
+ }
81
+ }
82
+ }
@@ -0,0 +1,96 @@
1
+ {
2
+ "metadata": {
3
+ "version": 2,
4
+ "www_path_prefix": "http://www.crunchbase.com/",
5
+ "api_path_prefix": "http://api.crunchbase.com/v/2/",
6
+ "image_path_prefix": "http://images.crunchbase.com/"
7
+ },
8
+ "data": {
9
+ "uuid": "37bd05f961af726ba3c1b279da842805",
10
+ "type": "FundingRound",
11
+ "properties": {
12
+ "post_money_valuation_currency_code": "USD",
13
+ "funding_type": "private_equity",
14
+ "money_raised_usd": 1500000000,
15
+ "announced_on_year": 2011,
16
+ "announced_on_day": 21,
17
+ "announced_on_month": 1,
18
+ "announced_on": "2011-01-21",
19
+ "announced_on_trust_code": 7,
20
+ "canonical_currency_code": "USD",
21
+ "money_raised": 1500000000,
22
+ "money_raised_currency_code": "USD",
23
+ "permalink": "37bd05f961af726ba3c1b279da842805",
24
+ "name": "Facebook raises 1500000000 in private_equity round",
25
+ "created_at": 1295843747,
26
+ "updated_at": 1398009912
27
+ },
28
+ "relationships": {
29
+ "investments": {
30
+ "paging": {
31
+ "total_items": 2,
32
+ "first_page_url": "http://api.crunchbase.com/v/2/funding-round/37bd05f961af726ba3c1b279da842805/investments",
33
+ "sort_order": "created_at DESC"
34
+ },
35
+ "items": [
36
+ {
37
+ "type": "InvestorInvestment",
38
+ "money_invested": null,
39
+ "money_invested_currency_code": null,
40
+ "money_invested_usd": null,
41
+ "investor": {
42
+ "type": "Organization",
43
+ "name": "Digital Sky Technologies",
44
+ "path": "organization/digital-sky-technologies-fo"
45
+ }
46
+ },
47
+ {
48
+ "type": "InvestorInvestment",
49
+ "money_invested": null,
50
+ "money_invested_currency_code": null,
51
+ "money_invested_usd": null,
52
+ "investor": {
53
+ "type": "Organization",
54
+ "name": "Goldman Sachs",
55
+ "path": "organization/goldman-sachs"
56
+ }
57
+ }
58
+ ]
59
+ },
60
+ "funded_organization": {
61
+ "paging": {
62
+ "total_items": 1,
63
+ "first_page_url": "http://api.crunchbase.com/v/2/funding-round/37bd05f961af726ba3c1b279da842805/funded_organization",
64
+ "sort_order": "created_at DESC"
65
+ },
66
+ "items": [
67
+ {
68
+ "type": "Organization",
69
+ "name": "Facebook",
70
+ "path": "organization/facebook",
71
+ "created_at": 1180153335,
72
+ "updated_at": 1408493973
73
+ }
74
+ ]
75
+ },
76
+ "news": {
77
+ "paging": {
78
+ "total_items": 1,
79
+ "first_page_url": "http://api.crunchbase.com/v/2/funding-round/37bd05f961af726ba3c1b279da842805/news",
80
+ "sort_order": "created_at DESC"
81
+ },
82
+ "items": [
83
+ {
84
+ "url": "http://www.prnewswire.com/news-releases/facebook-raises-15-billion-114383494.html",
85
+ "author": null,
86
+ "posted_on": null,
87
+ "type": "PressReference",
88
+ "title": "Facebook Raises $1.5 Billion -- PALO ALTO, Calif., Jan. 21, 2011 /PRNewswire/ --",
89
+ "created_at": 1295843747,
90
+ "updated_at": 1398009912
91
+ }
92
+ ]
93
+ }
94
+ }
95
+ }
96
+ }