crunchbase-ruby-library 0.1.7 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +66 -0
- data/.rubocop_todo.yml +47 -0
- data/.travis.yml +12 -0
- data/Gemfile +4 -0
- data/README.md +44 -54
- data/Rakefile +4 -1
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/crunchbase-ruby-library.gemspec +15 -12
- data/lib/crunchbase.rb +12 -3
- data/lib/crunchbase/api.rb +110 -102
- data/lib/crunchbase/client.rb +50 -0
- data/lib/crunchbase/exception.rb +13 -11
- data/lib/crunchbase/model.rb +50 -48
- data/lib/crunchbase/model/acquired_by.rb +23 -20
- data/lib/crunchbase/model/acquiree.rb +2 -1
- data/lib/crunchbase/model/acquirer.rb +2 -1
- data/lib/crunchbase/model/acquisition.rb +16 -19
- data/lib/crunchbase/model/address.rb +4 -6
- data/lib/crunchbase/model/advisory_role.rb +2 -2
- data/lib/crunchbase/model/board_members_and_advisor.rb +10 -9
- data/lib/crunchbase/model/category.rb +6 -7
- data/lib/crunchbase/model/competitor.rb +3 -2
- data/lib/crunchbase/model/current_team.rb +7 -11
- data/lib/crunchbase/model/customer.rb +3 -2
- data/lib/crunchbase/model/degree.rb +4 -5
- data/lib/crunchbase/model/entity.rb +98 -108
- data/lib/crunchbase/model/error.rb +3 -4
- data/lib/crunchbase/model/featured_team.rb +19 -0
- data/lib/crunchbase/model/founded_company.rb +2 -3
- data/lib/crunchbase/model/founder.rb +3 -4
- data/lib/crunchbase/model/fund.rb +8 -11
- data/lib/crunchbase/model/fund_raise.rb +7 -8
- data/lib/crunchbase/model/funding_round.rb +29 -24
- data/lib/crunchbase/model/headquarter.rb +2 -1
- data/lib/crunchbase/model/image.rb +6 -7
- data/lib/crunchbase/model/investment.rb +20 -27
- data/lib/crunchbase/model/investor.rb +6 -7
- data/lib/crunchbase/model/ipo.rb +12 -12
- data/lib/crunchbase/model/job.rb +11 -10
- data/lib/crunchbase/model/location.rb +20 -11
- data/lib/crunchbase/model/member.rb +3 -4
- data/lib/crunchbase/model/membership.rb +7 -8
- data/lib/crunchbase/model/new.rb +5 -6
- data/lib/crunchbase/model/office.rb +3 -4
- data/lib/crunchbase/model/organization.rb +39 -38
- data/lib/crunchbase/model/organization_summary.rb +7 -8
- data/lib/crunchbase/model/owned_by.rb +4 -5
- data/lib/crunchbase/model/parent_location.rb +3 -3
- data/lib/crunchbase/model/past_team.rb +7 -11
- data/lib/crunchbase/model/person.rb +53 -46
- data/lib/crunchbase/model/person_summary.rb +13 -14
- data/lib/crunchbase/model/primary_affiliation.rb +6 -6
- data/lib/crunchbase/model/primary_image.rb +3 -3
- data/lib/crunchbase/model/primary_location.rb +8 -7
- data/lib/crunchbase/model/product.rb +14 -13
- data/lib/crunchbase/model/product_summary.rb +4 -5
- data/lib/crunchbase/model/school.rb +3 -2
- data/lib/crunchbase/model/search.rb +39 -40
- data/lib/crunchbase/model/search_result.rb +7 -6
- data/lib/crunchbase/model/simple_organization.rb +9 -10
- data/lib/crunchbase/model/sub_organization.rb +3 -4
- data/lib/crunchbase/model/video.rb +4 -5
- data/lib/crunchbase/model/website.rb +7 -11
- data/lib/crunchbase/request.rb +8 -0
- data/lib/crunchbase/request/client.rb +69 -0
- data/lib/crunchbase/version.rb +2 -1
- data/spec/crunchbase.yml.example +2 -2
- data/spec/crunchbase/client_spec.rb +25 -0
- data/spec/crunchbase/data/board_members_and_advisors/facebook.json +462 -0
- data/spec/crunchbase/data/categories/facebook.json +67 -0
- data/spec/crunchbase/data/current_team/facebook.json +4335 -0
- data/spec/crunchbase/data/featured_team/facebook.json +286 -0
- data/spec/crunchbase/data/funding_rounds/37bd05f961af726ba3c1b279da842805.json +484 -0
- data/spec/crunchbase/data/funding_rounds/facebook.json +2049 -0
- data/spec/crunchbase/data/headquarters/facebook.json +50 -0
- data/spec/crunchbase/data/investors/facebook.json +776 -0
- data/spec/crunchbase/data/news/facebook.json +1426 -0
- data/spec/crunchbase/data/news/facebook_2.json +1426 -0
- data/spec/crunchbase/data/offices/facebook.json +50 -0
- data/spec/crunchbase/data/organizations/crunchbase.json +2845 -0
- data/spec/crunchbase/data/organizations/ekohe.json +654 -0
- data/spec/crunchbase/data/organizations/facebook-without-relationships.json +45 -0
- data/spec/crunchbase/data/organizations/facebook.json +6723 -0
- data/spec/crunchbase/data/organizations/mx-media-llc.json +7 -0
- data/spec/crunchbase/data/past_team/facebook.json +4336 -0
- data/spec/crunchbase/data/people/facebook_founders.json +148 -0
- data/spec/crunchbase/data/people/mark-zuckerberg.json +2602 -0
- data/spec/crunchbase/data/websites/facebook.json +74 -0
- data/spec/crunchbase/model/board_members_and_advisor_spec.rb +39 -11
- data/spec/crunchbase/model/category_spec.rb +47 -0
- data/spec/crunchbase/model/current_team_spec.rb +50 -0
- data/spec/crunchbase/model/featured_team_spec.rb +40 -0
- data/spec/crunchbase/model/founders_spec.rb +49 -0
- data/spec/crunchbase/model/fund_raise_spec.rb +4 -24
- data/spec/crunchbase/model/funding_round_spec.rb +75 -32
- data/spec/crunchbase/model/headquarter_spec.rb +37 -0
- data/spec/crunchbase/model/investment_spec.rb +4 -15
- data/spec/crunchbase/model/investor_spec.rb +37 -0
- data/spec/crunchbase/model/new_spec.rb +86 -0
- data/spec/crunchbase/model/office_spec.rb +29 -9
- data/spec/crunchbase/model/organization_spec.rb +160 -34
- data/spec/crunchbase/model/past_team_spec.rb +36 -14
- data/spec/crunchbase/model/person_spec.rb +21 -19
- data/spec/crunchbase/model/product_spec.rb +4 -31
- data/spec/crunchbase/model/search_spec.rb +25 -49
- data/spec/crunchbase/model/website_spec.rb +36 -9
- data/spec/crunchbase/support/api_helper.rb +19 -0
- data/spec/spec_helper.rb +14 -4
- metadata +103 -6
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"metadata":
|
|
3
|
+
{
|
|
4
|
+
"version": 31,
|
|
5
|
+
"www_path_prefix": "https://www.crunchbase.com",
|
|
6
|
+
"api_path_prefix": "https://api.crunchbase.com",
|
|
7
|
+
"image_path_prefix": "http://public.crunchbase.com/t_api_images/"
|
|
8
|
+
},
|
|
9
|
+
"data":
|
|
10
|
+
{
|
|
11
|
+
"paging":
|
|
12
|
+
{
|
|
13
|
+
"total_items": 4,
|
|
14
|
+
"number_of_pages": 1,
|
|
15
|
+
"current_page": 1,
|
|
16
|
+
"sort_order": "created_at DESC",
|
|
17
|
+
"items_per_page": 100,
|
|
18
|
+
"next_page_url": null,
|
|
19
|
+
"prev_page_url": null,
|
|
20
|
+
"key_set_url": null,
|
|
21
|
+
"collection_url": "https://api.crunchbase.com/v3.1/organizations/facebook/websites",
|
|
22
|
+
"updated_since": null
|
|
23
|
+
},
|
|
24
|
+
"items": [
|
|
25
|
+
{
|
|
26
|
+
"type": "Website",
|
|
27
|
+
"uuid": "df6628127f970b439d3e12f64f504fbb",
|
|
28
|
+
"properties":
|
|
29
|
+
{
|
|
30
|
+
"website_type": "homepage",
|
|
31
|
+
"website_name": "homepage",
|
|
32
|
+
"url": "http://www.facebook.com",
|
|
33
|
+
"created_at": 1180153335,
|
|
34
|
+
"updated_at": 1509356721
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"type": "Website",
|
|
39
|
+
"uuid": "df6628127f970b439d3e12f64f504fbb",
|
|
40
|
+
"properties":
|
|
41
|
+
{
|
|
42
|
+
"website_type": "facebook",
|
|
43
|
+
"website_name": "facebook",
|
|
44
|
+
"url": "https://www.facebook.com/facebook/",
|
|
45
|
+
"created_at": 1180153335,
|
|
46
|
+
"updated_at": 1509356721
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"type": "Website",
|
|
51
|
+
"uuid": "df6628127f970b439d3e12f64f504fbb",
|
|
52
|
+
"properties":
|
|
53
|
+
{
|
|
54
|
+
"website_type": "twitter",
|
|
55
|
+
"website_name": "twitter",
|
|
56
|
+
"url": "https://twitter.com/facebook",
|
|
57
|
+
"created_at": 1180153335,
|
|
58
|
+
"updated_at": 1509356721
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"type": "Website",
|
|
63
|
+
"uuid": "df6628127f970b439d3e12f64f504fbb",
|
|
64
|
+
"properties":
|
|
65
|
+
{
|
|
66
|
+
"website_type": "linkedin",
|
|
67
|
+
"website_name": "linkedin",
|
|
68
|
+
"url": "http://www.linkedin.com/company/facebook",
|
|
69
|
+
"created_at": 1180153335,
|
|
70
|
+
"updated_at": 1509356721
|
|
71
|
+
}
|
|
72
|
+
}]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -1,20 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Crunchbase
|
|
4
4
|
module Model
|
|
5
|
+
RSpec.describe BoardMembersAndAdvisor do
|
|
6
|
+
let(:board_members_and_advisors_data) { parse_json('board_members_and_advisors', 'facebook') }
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
o = BoardMembersAndAdvisor.organization_lists("apple")
|
|
9
|
-
|
|
10
|
-
puts o.total_items
|
|
8
|
+
context 'board_members_and_advisors of facebook' do
|
|
9
|
+
let(:board_members_and_advisors) { BoardMembersAndAdvisor.organization_lists('facebook') }
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
before :each do
|
|
12
|
+
result = search_results(board_members_and_advisors_data, PastTeam)
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
allow(BoardMembersAndAdvisor).to receive(:organization_lists).and_return(result)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'should return 4 of total count with board_members_and_advisors' do
|
|
18
|
+
expect(board_members_and_advisors.results.size).to eq(10)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'should paging values from board_members_and_advisors response' do
|
|
22
|
+
expect(board_members_and_advisors.total_items).to eq(10)
|
|
23
|
+
expect(board_members_and_advisors.pages).to eq(1)
|
|
24
|
+
expect(board_members_and_advisors.current_page).to eq(1)
|
|
25
|
+
expect(board_members_and_advisors.per_page).to eq(100)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 'should return first board members and advisor record' do
|
|
29
|
+
first_item = board_members_and_advisors.results.first
|
|
30
|
+
|
|
31
|
+
expect(first_item.type_name).to eq('Job')
|
|
32
|
+
expect(first_item.uuid).to eq('151a676d610d420a887640cf7b922945')
|
|
33
|
+
expect(first_item.title).to eq('Member of the Board of Directors')
|
|
34
|
+
expect(first_item.person.first_name).to eq('Jan')
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'should return last board members and advisor record' do
|
|
38
|
+
last_item = board_members_and_advisors.results.last
|
|
39
|
+
|
|
40
|
+
expect(last_item.type_name).to eq('Job')
|
|
41
|
+
expect(last_item.uuid).to eq('cd41d147b61114099ca309ced2cae6de')
|
|
42
|
+
expect(last_item.title).to eq('Board Observer')
|
|
43
|
+
expect(last_item.person.first_name).to eq('Paul')
|
|
44
|
+
end
|
|
16
45
|
end
|
|
17
46
|
end
|
|
18
|
-
|
|
19
47
|
end
|
|
20
|
-
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Crunchbase
|
|
4
|
+
module Model
|
|
5
|
+
RSpec.describe Category do
|
|
6
|
+
let(:categories_data) { parse_json('categories', 'facebook') }
|
|
7
|
+
|
|
8
|
+
context 'categories of facebook' do
|
|
9
|
+
let(:categories) { Category.organization_lists('facebook') }
|
|
10
|
+
|
|
11
|
+
before :each do
|
|
12
|
+
result = search_results(categories_data, Category)
|
|
13
|
+
|
|
14
|
+
allow(Category).to receive(:organization_lists).and_return(result)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'should return 3 of total count with categories' do
|
|
18
|
+
expect(categories.results.size).to eq(3)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'should paging values from categories response' do
|
|
22
|
+
expect(categories.pages).to eq(1)
|
|
23
|
+
expect(categories.current_page).to eq(1)
|
|
24
|
+
expect(categories.per_page).to eq(100)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'should return first category record' do
|
|
28
|
+
first_item = categories.results.first
|
|
29
|
+
|
|
30
|
+
expect(first_item.type_name).to eq('Category')
|
|
31
|
+
expect(first_item.uuid).to eq('5349a2f214d89727c32a19ebea5db78c')
|
|
32
|
+
expect(first_item.name).to eq('Social Media')
|
|
33
|
+
expect(first_item.web_path).to eq('category/social-media/5349a2f214d89727c32a19ebea5db78c')
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'should return last category record' do
|
|
37
|
+
first_item = categories.results.last
|
|
38
|
+
|
|
39
|
+
expect(first_item.type_name).to eq('Category')
|
|
40
|
+
expect(first_item.uuid).to eq('80de9bf4789eb80e051cdc079493803f')
|
|
41
|
+
expect(first_item.name).to eq('Social')
|
|
42
|
+
expect(first_item.web_path).to eq('category/social/80de9bf4789eb80e051cdc079493803f')
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Crunchbase
|
|
4
|
+
module Model
|
|
5
|
+
RSpec.describe CurrentTeam do
|
|
6
|
+
let(:current_team_data) { parse_json('current_team', 'facebook') }
|
|
7
|
+
|
|
8
|
+
context 'current_team of facebook' do
|
|
9
|
+
let(:current_team) { CurrentTeam.organization_lists('facebook') }
|
|
10
|
+
|
|
11
|
+
before :each do
|
|
12
|
+
result = search_results(current_team_data, CurrentTeam)
|
|
13
|
+
|
|
14
|
+
allow(CurrentTeam).to receive(:organization_lists).and_return(result)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'should return 4 of total count with current_team' do
|
|
18
|
+
expect(current_team.results.size).to eq(100)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'should paging values from current_team response' do
|
|
22
|
+
expect(current_team.total_items).to eq(491)
|
|
23
|
+
expect(current_team.pages).to eq(5)
|
|
24
|
+
expect(current_team.current_page).to eq(1)
|
|
25
|
+
expect(current_team.per_page).to eq(100)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 'should return first past team record' do
|
|
29
|
+
first_item = current_team.results.first
|
|
30
|
+
|
|
31
|
+
expect(first_item.type_name).to eq('Job')
|
|
32
|
+
expect(first_item.uuid).to eq('24ba8e19092e4b6e9a62cf009fd367a0')
|
|
33
|
+
expect(first_item.title).to eq('Product Manager')
|
|
34
|
+
expect(first_item.person.first_name).to eq('Chetan')
|
|
35
|
+
expect(first_item.person.last_name).to eq('Gupta')
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'should return last past team record' do
|
|
39
|
+
last_item = current_team.results.last
|
|
40
|
+
|
|
41
|
+
expect(last_item.type_name).to eq('Job')
|
|
42
|
+
expect(last_item.uuid).to eq('0636f8716c9ca7ec00c6fc8bfab030f0')
|
|
43
|
+
expect(last_item.title).to eq('Production Engineer')
|
|
44
|
+
expect(last_item.person.first_name).to eq('Richard')
|
|
45
|
+
expect(last_item.person.last_name).to eq('Wareing')
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Crunchbase
|
|
4
|
+
module Model
|
|
5
|
+
RSpec.describe FeaturedTeam do
|
|
6
|
+
let(:featured_team_data) { parse_json('featured_team', 'facebook') }
|
|
7
|
+
|
|
8
|
+
context 'featured_team of facebook' do
|
|
9
|
+
let(:featured_team) { FeaturedTeam.organization_lists('facebook') }
|
|
10
|
+
|
|
11
|
+
before :each do
|
|
12
|
+
result = search_results(featured_team_data, FeaturedTeam)
|
|
13
|
+
|
|
14
|
+
allow(FeaturedTeam).to receive(:organization_lists).and_return(result)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'should return 4 of total count with featured_team' do
|
|
18
|
+
expect(featured_team.results.size).to eq(6)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'should paging values from featured_team response' do
|
|
22
|
+
expect(featured_team.total_items).to eq(6)
|
|
23
|
+
expect(featured_team.pages).to eq(1)
|
|
24
|
+
expect(featured_team.current_page).to eq(1)
|
|
25
|
+
expect(featured_team.per_page).to eq(100)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 'should return first past team record' do
|
|
29
|
+
first_item = featured_team.results.first
|
|
30
|
+
|
|
31
|
+
expect(first_item.type_name).to eq('Job')
|
|
32
|
+
expect(first_item.uuid).to eq('befc22dec7892096e4d6919935cf4204')
|
|
33
|
+
expect(first_item.title).to eq('Founder & CEO')
|
|
34
|
+
expect(first_item.person.first_name).to eq('Mark')
|
|
35
|
+
expect(first_item.person.last_name).to eq('Zuckerberg')
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Crunchbase
|
|
4
|
+
module Model
|
|
5
|
+
RSpec.describe Founder do
|
|
6
|
+
let(:founders_data) { parse_json('people', 'facebook_founders') }
|
|
7
|
+
|
|
8
|
+
context 'founders of facebook' do
|
|
9
|
+
let(:founders) { Founder.organization_lists('facebook') }
|
|
10
|
+
|
|
11
|
+
before :each do
|
|
12
|
+
result = search_results(founders_data, Founder)
|
|
13
|
+
|
|
14
|
+
allow(Founder).to receive(:organization_lists).and_return(result)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'should return 5 of total count with founders' do
|
|
18
|
+
expect(founders.results.size).to eq(5)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'should paging values from founders response' do
|
|
22
|
+
expect(founders.pages).to eq(1)
|
|
23
|
+
expect(founders.current_page).to eq(1)
|
|
24
|
+
expect(founders.per_page).to eq(100)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'should return first founder record' do
|
|
28
|
+
first_item = founders.results.first
|
|
29
|
+
|
|
30
|
+
expect(first_item.type_name).to eq('Person')
|
|
31
|
+
expect(first_item.uuid).to eq('084aaa0707951fe89c4698bbeb02cd64')
|
|
32
|
+
expect(first_item.first_name).to eq('Dustin')
|
|
33
|
+
expect(first_item.last_name).to eq('Moskovitz')
|
|
34
|
+
expect(first_item.web_path).to eq('person/dustin-moskovitz')
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'should return last founder record' do
|
|
38
|
+
first_item = founders.results.last
|
|
39
|
+
|
|
40
|
+
expect(first_item.type_name).to eq('Person')
|
|
41
|
+
expect(first_item.uuid).to eq('fb5b458c0aaba97771b9ecf78d3ec756')
|
|
42
|
+
expect(first_item.first_name).to eq('Eduardo')
|
|
43
|
+
expect(first_item.last_name).to eq('Saverin')
|
|
44
|
+
expect(first_item.web_path).to eq('person/eduardo-saverin')
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -1,26 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
module Crunchbase
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
describe FundRaise do
|
|
7
|
-
|
|
8
|
-
before(:all) do
|
|
9
|
-
begin
|
|
10
|
-
@funds = FundRaise.organization_lists("apple")
|
|
11
|
-
rescue Exception => e
|
|
12
|
-
@funds = nil
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it 'show funds results' do
|
|
17
|
-
unless @funds.nil?
|
|
18
|
-
puts @funds.total_items
|
|
19
|
-
|
|
20
|
-
puts @funds.results.collect { |p| [p.name] }.inspect
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
end
|
|
3
|
+
module Crunchbase::Model
|
|
4
|
+
RSpec.describe FundRaise do
|
|
25
5
|
end
|
|
26
|
-
end
|
|
6
|
+
end
|
|
@@ -1,45 +1,88 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Crunchbase
|
|
4
4
|
module Model
|
|
5
|
+
RSpec.describe FundingRound do
|
|
6
|
+
let(:funding_rounds_data) { parse_json('funding_rounds', 'facebook') }
|
|
7
|
+
let(:funding_round_data) { parse_json('funding_rounds', '37bd05f961af726ba3c1b279da842805') }
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
context 'funding_rounds of facebook' do
|
|
10
|
+
let(:funding_rounds) { FundingRound.organization_lists('facebook') }
|
|
11
|
+
|
|
12
|
+
before :each do
|
|
13
|
+
result = search_results(funding_rounds_data, FundingRound)
|
|
14
|
+
|
|
15
|
+
allow(FundingRound).to receive(:organization_lists).and_return(result)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'should paging values from funding_rounds response' do
|
|
19
|
+
expect(funding_rounds.pages).to eq(1)
|
|
20
|
+
expect(funding_rounds.current_page).to eq(1)
|
|
21
|
+
expect(funding_rounds.per_page).to eq(100)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'should return 11 of total count with funding_rounds' do
|
|
25
|
+
expect(funding_rounds.results.size).to eq(11)
|
|
26
|
+
expect(funding_rounds.total_items).to eq(11)
|
|
27
|
+
end
|
|
17
28
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
results = FundingRound.organization_lists("xiaomi").results
|
|
21
|
-
results.collect {|e| puts e.funding_type }
|
|
29
|
+
it 'should return first funding_round record' do
|
|
30
|
+
first_item = funding_rounds.results.first
|
|
22
31
|
|
|
23
|
-
|
|
24
|
-
|
|
32
|
+
expect(first_item.uuid).to eq('37bd05f961af726ba3c1b279da842805')
|
|
33
|
+
expect(first_item.type_name).to eq('FundingRound')
|
|
34
|
+
end
|
|
25
35
|
end
|
|
26
|
-
end
|
|
27
36
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
puts news.map {|e| e.title }
|
|
31
|
-
end
|
|
37
|
+
context 'funding_round of facebook' do
|
|
38
|
+
let(:funding_round) { FundingRound.get('37bd05f961af726ba3c1b279da842805') }
|
|
32
39
|
|
|
40
|
+
before :each do
|
|
41
|
+
result = FundingRound.new(funding_round_data)
|
|
33
42
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
puts images.map {|e| e.inspect }
|
|
37
|
-
end
|
|
43
|
+
allow(FundingRound).to receive(:get).and_return(result)
|
|
44
|
+
end
|
|
38
45
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
end
|
|
46
|
+
it 'should return current founding round record uuid' do
|
|
47
|
+
expect(funding_round.uuid).to eq('37bd05f961af726ba3c1b279da842805')
|
|
48
|
+
end
|
|
43
49
|
|
|
50
|
+
it 'should return 2 investments records of founding round' do
|
|
51
|
+
expect(funding_round.investments.size).to eq(2)
|
|
52
|
+
expect(funding_round.investments_total_items).to eq(2)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it 'should return the first investment of founding round' do
|
|
56
|
+
first_investment = funding_round.investments[0]
|
|
57
|
+
|
|
58
|
+
expect(first_investment.investors.nil?).to be_falsy
|
|
59
|
+
expect(first_investment.investors.name).to eq("DST Global")
|
|
60
|
+
expect(first_investment.investors.permalink).to eq("digital-sky-technologies-fo")
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it 'should return 2 investors of founding round' do
|
|
64
|
+
expect(funding_round.investors.size).to eq(2)
|
|
65
|
+
expect(funding_round.investors_total_items).to eq(2)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it 'should return funded organization of funding_round' do
|
|
69
|
+
expect(funding_round.funded_organization.nil?).to be_falsy
|
|
70
|
+
expect(funding_round.funded_organization.name).to eq('Facebook')
|
|
71
|
+
expect(funding_round.funded_organization.permalink).to eq('facebook')
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it 'should return 0 images and 0 videos of funding_round' do
|
|
75
|
+
expect(funding_round.images.size).to eq(0)
|
|
76
|
+
expect(funding_round.images_total_items).to eq(0)
|
|
77
|
+
expect(funding_round.videos.size).to eq(0)
|
|
78
|
+
expect(funding_round.videos_total_items).to eq(0)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
it 'should return 2 news of funding_round' do
|
|
82
|
+
expect(funding_round.news.size).to eq(2)
|
|
83
|
+
expect(funding_round.news_total_items).to eq(2)
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
44
87
|
end
|
|
45
|
-
end
|
|
88
|
+
end
|