crunchbase-ruby-library 0.3.6 → 0.3.7
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 +5 -5
- data/.rubocop.yml +0 -65
- data/.rubocop_todo.yml +54 -16
- data/Gemfile +1 -0
- data/Rakefile +1 -0
- data/bin/console +1 -1
- data/crunchbase-ruby-library.gemspec +2 -2
- data/lib/crunchbase.rb +1 -0
- data/lib/crunchbase/api.rb +1 -0
- data/lib/crunchbase/client.rb +1 -0
- data/lib/crunchbase/model/acquired_by.rb +0 -1
- data/lib/crunchbase/model/acquiree.rb +0 -1
- data/lib/crunchbase/model/acquirer.rb +0 -1
- data/lib/crunchbase/model/acquisition.rb +0 -1
- data/lib/crunchbase/model/address.rb +0 -1
- data/lib/crunchbase/model/advisory_role.rb +0 -1
- data/lib/crunchbase/model/batch_search.rb +0 -1
- data/lib/crunchbase/model/board_members_and_advisor.rb +0 -1
- data/lib/crunchbase/model/category.rb +0 -1
- data/lib/crunchbase/model/competitor.rb +0 -1
- data/lib/crunchbase/model/current_team.rb +0 -1
- data/lib/crunchbase/model/customer.rb +0 -1
- data/lib/crunchbase/model/degree.rb +3 -4
- data/lib/crunchbase/model/entity.rb +8 -5
- data/lib/crunchbase/model/error.rb +0 -1
- data/lib/crunchbase/model/founded_company.rb +0 -1
- data/lib/crunchbase/model/founder.rb +0 -1
- data/lib/crunchbase/model/fund.rb +1 -0
- data/lib/crunchbase/model/fund_raise.rb +1 -0
- data/lib/crunchbase/model/funding_round.rb +1 -1
- data/lib/crunchbase/model/headquarter.rb +0 -1
- data/lib/crunchbase/model/image.rb +0 -1
- data/lib/crunchbase/model/investment.rb +0 -1
- data/lib/crunchbase/model/investor.rb +0 -1
- data/lib/crunchbase/model/ipo.rb +0 -1
- data/lib/crunchbase/model/job.rb +8 -7
- data/lib/crunchbase/model/location.rb +0 -1
- data/lib/crunchbase/model/member.rb +0 -1
- data/lib/crunchbase/model/membership.rb +0 -1
- data/lib/crunchbase/model/new.rb +0 -1
- data/lib/crunchbase/model/office.rb +0 -1
- data/lib/crunchbase/model/organization.rb +14 -16
- data/lib/crunchbase/model/organization_summary.rb +0 -1
- data/lib/crunchbase/model/owned_by.rb +0 -1
- data/lib/crunchbase/model/parent_location.rb +0 -1
- data/lib/crunchbase/model/past_team.rb +0 -1
- data/lib/crunchbase/model/person.rb +9 -8
- data/lib/crunchbase/model/person_summary.rb +0 -1
- data/lib/crunchbase/model/primary_affiliation.rb +3 -4
- data/lib/crunchbase/model/primary_image.rb +0 -1
- data/lib/crunchbase/model/primary_location.rb +0 -1
- data/lib/crunchbase/model/product.rb +0 -1
- data/lib/crunchbase/model/product_summary.rb +1 -0
- data/lib/crunchbase/model/school.rb +0 -1
- data/lib/crunchbase/model/search.rb +0 -1
- data/lib/crunchbase/model/search_result.rb +1 -3
- data/lib/crunchbase/model/simple_organization.rb +0 -1
- data/lib/crunchbase/model/sub_organization.rb +0 -1
- data/lib/crunchbase/model/video.rb +0 -1
- data/lib/crunchbase/model/website.rb +0 -1
- data/lib/crunchbase/version.rb +1 -1
- data/spec/crunchbase/data/organizations/crunchbase.json +2853 -1344
- data/spec/crunchbase/model/funding_round_spec.rb +2 -2
- data/spec/crunchbase/model/organization_spec.rb +170 -146
- data/spec/crunchbase/support/api_helper.rb +8 -5
- data/spec/spec_helper.rb +1 -0
- metadata +5 -6
@@ -56,8 +56,8 @@ module Crunchbase
|
|
56
56
|
first_investment = funding_round.investments[0]
|
57
57
|
|
58
58
|
expect(first_investment.investors.nil?).to be_falsy
|
59
|
-
expect(first_investment.investors.name).to eq(
|
60
|
-
expect(first_investment.investors.permalink).to eq(
|
59
|
+
expect(first_investment.investors.name).to eq('DST Global')
|
60
|
+
expect(first_investment.investors.permalink).to eq('digital-sky-technologies-fo')
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'should return 2 investors of founding round' do
|
@@ -1,196 +1,220 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# disabled ModuleLength
|
4
3
|
module Crunchbase
|
5
4
|
module Model
|
6
5
|
RSpec.describe Organization do
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
context 'facebook' do
|
7
|
+
let(:without_relationship_json_data) { parse_json('organizations', 'facebook-without-relationships') }
|
8
|
+
let(:with_relationship_json_data) { parse_json('organizations', 'facebook') }
|
9
|
+
let(:ekohe_data) { parse_json('organizations', 'ekohe') }
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
context 'without relationships data' do
|
12
|
+
let(:without_organization) { Organization.get('facebook') }
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
before :each do
|
15
|
+
result = Organization.new(without_relationship_json_data)
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
allow(Organization).to receive(:get).and_return(result)
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
it 'should return facebook and Facebook from API' do
|
21
|
+
expect(without_organization.permalink).to eq('facebook')
|
22
|
+
expect(without_organization.name).to eq('Facebook')
|
23
|
+
expect(without_organization.rank).to eq(nil)
|
24
|
+
end
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
26
|
+
it 'should return nil when without relationships' do
|
27
|
+
expect(without_organization.products.nil?).to be_truthy
|
28
|
+
expect(without_organization.offices.nil?).to be_truthy
|
29
|
+
expect(without_organization.headquarters.nil?).to be_truthy
|
30
|
+
expect(without_organization.funding_rounds.nil?).to be_truthy
|
31
|
+
expect(without_organization.competitors.nil?).to be_truthy
|
32
|
+
expect(without_organization.investments.nil?).to be_truthy
|
33
|
+
expect(without_organization.acquisitions.nil?).to be_truthy
|
34
|
+
expect(without_organization.ipo.nil?).to be_truthy
|
35
|
+
expect(without_organization.categories.nil?).to be_truthy
|
36
|
+
expect(without_organization.news.nil?).to be_truthy
|
37
|
+
expect(without_organization.current_team.nil?).to be_truthy
|
38
|
+
expect(without_organization.websites.nil?).to be_truthy
|
39
|
+
expect(without_organization.founders.nil?).to be_truthy
|
40
|
+
expect(without_organization.past_team.nil?).to be_truthy
|
41
|
+
expect(without_organization.board_members_and_advisors.nil?).to be_truthy
|
42
|
+
expect(without_organization.featured_team.nil?).to be_truthy
|
43
|
+
end
|
42
44
|
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context 'facebook with relationships data' do
|
46
|
-
let(:organization) { Organization.get('facebook') }
|
47
|
-
|
48
|
-
before :each do
|
49
|
-
result = Organization.new(with_relationship_json_data)
|
50
45
|
|
51
|
-
|
52
|
-
|
46
|
+
context 'facebook with relationships data' do
|
47
|
+
let(:organization) { Organization.get('facebook') }
|
53
48
|
|
54
|
-
|
55
|
-
|
56
|
-
expect(organization.name).to eq('Facebook')
|
57
|
-
end
|
49
|
+
before :each do
|
50
|
+
result = Organization.new(with_relationship_json_data)
|
58
51
|
|
59
|
-
|
60
|
-
|
61
|
-
expect(organization.primary_image_total_items).to eq(1)
|
62
|
-
end
|
52
|
+
allow(Organization).to receive(:get).and_return(result)
|
53
|
+
end
|
63
54
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
55
|
+
it 'should return facebook and Facebook from API' do
|
56
|
+
expect(organization.permalink).to eq('facebook')
|
57
|
+
expect(organization.name).to eq('Facebook')
|
58
|
+
end
|
68
59
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
60
|
+
it 'should return one primary_image' do
|
61
|
+
expect(organization.primary_image.nil?).to be_falsy
|
62
|
+
expect(organization.primary_image_total_items).to eq(1)
|
63
|
+
end
|
73
64
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
65
|
+
it 'should return 0 of products and competitors' do
|
66
|
+
expect(organization.products.size).to eq(0)
|
67
|
+
expect(organization.competitors.size).to eq(0)
|
68
|
+
end
|
78
69
|
|
79
|
-
|
80
|
-
|
81
|
-
|
70
|
+
it 'should return 1 of offices - OneToOne' do
|
71
|
+
expect(organization.offices.class).to eq(Office)
|
72
|
+
expect(organization.offices.nil?).to be_falsy
|
73
|
+
end
|
82
74
|
|
83
|
-
|
84
|
-
|
85
|
-
|
75
|
+
it 'should return 1 of headquarters - OneToOne' do
|
76
|
+
expect(organization.headquarters.class).to eq(Headquarter)
|
77
|
+
expect(organization.headquarters.nil?).to be_falsy
|
78
|
+
end
|
86
79
|
|
87
|
-
|
88
|
-
|
89
|
-
|
80
|
+
it 'should return 10 of funding_rounds' do
|
81
|
+
expect(organization.funding_rounds.size).to eq(10)
|
82
|
+
end
|
90
83
|
|
91
|
-
|
92
|
-
|
93
|
-
|
84
|
+
it 'should return 10 of investments' do
|
85
|
+
expect(organization.investments.size).to eq(10)
|
86
|
+
end
|
94
87
|
|
95
|
-
|
96
|
-
|
97
|
-
|
88
|
+
it 'should return 10 of acquisitions' do
|
89
|
+
expect(organization.acquisitions.size).to eq(10)
|
90
|
+
end
|
98
91
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
end
|
92
|
+
it 'should return ipo relationship' do
|
93
|
+
expect(organization.ipo.nil?).to be_falsy
|
94
|
+
end
|
103
95
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
end
|
96
|
+
it 'should return 3 of categories' do
|
97
|
+
expect(organization.categories.size).to eq(3)
|
98
|
+
end
|
108
99
|
|
109
|
-
|
110
|
-
|
111
|
-
|
100
|
+
it 'should return 0 of videos' do
|
101
|
+
expect(organization.videos.size).to eq(0)
|
102
|
+
expect(organization.videos_total_items).to eq(0)
|
103
|
+
end
|
112
104
|
|
113
|
-
|
114
|
-
|
115
|
-
|
105
|
+
it 'should return 10 of news' do
|
106
|
+
expect(organization.news.size).to eq(10)
|
107
|
+
expect(organization.news_total_items).to eq(263177)
|
108
|
+
end
|
116
109
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
end
|
110
|
+
it 'should return 10 of current_team' do
|
111
|
+
expect(organization.current_team.size).to eq(10)
|
112
|
+
end
|
121
113
|
|
122
|
-
|
123
|
-
|
124
|
-
|
114
|
+
it 'should return 4 of websites' do
|
115
|
+
expect(organization.websites.size).to eq(4)
|
116
|
+
end
|
125
117
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
118
|
+
it 'should return 10 of investors item and total pages count 20' do
|
119
|
+
expect(organization.investors.size).to eq(10)
|
120
|
+
expect(organization.investors_total_items).to eq(20)
|
121
|
+
end
|
130
122
|
|
131
|
-
|
132
|
-
|
123
|
+
it 'should return 5 of founders' do
|
124
|
+
expect(organization.founders.size).to eq(5)
|
125
|
+
end
|
133
126
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
expect(first_member.person.permalink).to eq('perry-tam')
|
139
|
-
end
|
127
|
+
it 'should return 10 of past_team and total 420 of past team' do
|
128
|
+
expect(organization.past_team_total_items).to eq(420)
|
129
|
+
expect(organization.past_team.size).to eq(10)
|
130
|
+
end
|
140
131
|
|
141
|
-
|
142
|
-
|
143
|
-
expect(organization.board_members_and_advisors.size).to eq(10)
|
144
|
-
end
|
132
|
+
it 'should return the first past_team information' do
|
133
|
+
first_member = organization.past_team[0]
|
145
134
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
135
|
+
expect(first_member.title).to eq('Software Engineer')
|
136
|
+
expect(first_member.uuid).to eq('009b372b0ee6bf03f60346b3a1730f41')
|
137
|
+
expect(first_member.person.first_name).to eq('Perry')
|
138
|
+
expect(first_member.person.last_name).to eq('Tam')
|
139
|
+
expect(first_member.person.permalink).to eq('perry-tam')
|
140
|
+
end
|
150
141
|
|
151
|
-
|
152
|
-
|
153
|
-
|
142
|
+
it 'should return 10 of board_members_and_advisors' do
|
143
|
+
expect(organization.board_members_and_advisors_total_items).to eq(10)
|
144
|
+
expect(organization.board_members_and_advisors.size).to eq(10)
|
145
|
+
end
|
154
146
|
|
155
|
-
|
156
|
-
expect(
|
157
|
-
expect(
|
158
|
-
|
159
|
-
expect(first_funding_round.money_raised).to eq(1500000000)
|
160
|
-
expect(first_funding_round.money_raised_usd).to eq(1500000000)
|
161
|
-
expect(first_funding_round.investments.size).to eq(2)
|
147
|
+
it 'should return 6 of featured_team' do
|
148
|
+
expect(organization.featured_team_total_items).to eq(6)
|
149
|
+
expect(organization.featured_team.size).to eq(6)
|
150
|
+
end
|
162
151
|
|
163
|
-
|
164
|
-
|
152
|
+
context 'funding_rounds' do
|
153
|
+
it 'should return correctly data of the first funding round' do
|
154
|
+
first_funding_round = organization.funding_rounds[0]
|
155
|
+
|
156
|
+
expect(first_funding_round.uuid).to eq('37bd05f961af726ba3c1b279da842805')
|
157
|
+
expect(first_funding_round.funding_type).to eq('private_equity')
|
158
|
+
expect(first_funding_round.announced_on).to eq(Date.parse('2011-01-21'))
|
159
|
+
expect(first_funding_round.money_raised_currency_code).to eq('USD')
|
160
|
+
expect(first_funding_round.money_raised).to eq(1500000000)
|
161
|
+
expect(first_funding_round.money_raised_usd).to eq(1500000000)
|
162
|
+
expect(first_funding_round.investments.size).to eq(2)
|
163
|
+
|
164
|
+
expect(first_funding_round.investments[0].investors.name).to eq('DST Global')
|
165
|
+
expect(first_funding_round.investments[0].partners.size).to eq(1)
|
166
|
+
end
|
165
167
|
end
|
166
168
|
end
|
167
|
-
end
|
168
169
|
|
169
|
-
|
170
|
-
|
170
|
+
context 'ekohe data' do
|
171
|
+
let(:ekohe) { Organization.get('ekohe') }
|
171
172
|
|
172
|
-
|
173
|
-
|
173
|
+
before :each do
|
174
|
+
result = Organization.new(ekohe_data)
|
174
175
|
|
175
|
-
|
176
|
-
|
176
|
+
allow(Organization).to receive(:get).and_return(result)
|
177
|
+
end
|
177
178
|
|
178
|
-
|
179
|
-
|
180
|
-
|
179
|
+
it 'should return ekohe information' do
|
180
|
+
expect(ekohe.name).to eq('Ekohe')
|
181
|
+
expect(ekohe.permalink).to eq('ekohe')
|
182
|
+
end
|
183
|
+
|
184
|
+
it 'should return ekohe relationships data' do
|
185
|
+
expect(ekohe.acquired_by.nil?).to be_truthy
|
186
|
+
expect(ekohe.products.empty?).to be_truthy
|
187
|
+
end
|
181
188
|
end
|
182
189
|
|
183
|
-
|
184
|
-
|
185
|
-
|
190
|
+
context 'mx-media-llc data' do
|
191
|
+
it 'should return Crunchbase::Exception with 404 as results' do
|
192
|
+
expect do
|
193
|
+
parse_json('organizations', 'mx-media-llc')
|
194
|
+
end.to raise_error(Crunchbase::Exception)
|
195
|
+
end
|
186
196
|
end
|
187
197
|
end
|
188
198
|
|
189
|
-
context '
|
190
|
-
|
191
|
-
|
192
|
-
parse_json('organizations', '
|
193
|
-
|
199
|
+
context 'crunchbase' do
|
200
|
+
context 'response' do
|
201
|
+
it 'returns new fields' do
|
202
|
+
crunchbase_data = parse_json('organizations', 'crunchbase')
|
203
|
+
result = Organization.new(crunchbase_data)
|
204
|
+
|
205
|
+
allow(Organization).to receive(:get).and_return(result)
|
206
|
+
|
207
|
+
organization = Organization.get('crunchbase')
|
208
|
+
|
209
|
+
expect(organization.permalink).to eq('crunchbase')
|
210
|
+
expect(organization.name).to eq('Crunchbase')
|
211
|
+
expect(organization.rank).to eq(22)
|
212
|
+
expect(organization.investor_type).to eq(nil)
|
213
|
+
expect(organization.contact_email).to eq('info@crunchbase.com')
|
214
|
+
expect(organization.phone_number).to eq(' ')
|
215
|
+
expect(organization.api_path).to eq('organizations/crunchbase')
|
216
|
+
expect(organization.permalink_aliases).to eq(nil)
|
217
|
+
end
|
194
218
|
end
|
195
219
|
end
|
196
220
|
end
|
@@ -2,15 +2,18 @@
|
|
2
2
|
|
3
3
|
module ApiHelper
|
4
4
|
def parse_json(endpoint, filename)
|
5
|
-
|
6
|
-
|
7
|
-
raise Crunchbase::Exception, message: response_data['message'], status: response_data['status'] unless response_data['message'].nil?
|
5
|
+
response = JSON.parse(load_file(endpoint, filename))
|
6
|
+
response = response[0] if response.is_a?(Array)
|
8
7
|
|
9
|
-
|
8
|
+
raise Crunchbase::Exception, message: response['message'], status: response['status'] unless response['message'].nil?
|
9
|
+
|
10
|
+
response['data']
|
10
11
|
end
|
11
12
|
|
12
13
|
def load_file(endpoint, filename)
|
13
|
-
File.
|
14
|
+
json_file = File.join(File.dirname(__FILE__), "../data/#{endpoint}", "#{filename}.json")
|
15
|
+
|
16
|
+
File.read(json_file)
|
14
17
|
end
|
15
18
|
|
16
19
|
def search_results(data, kclass)
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crunchbase-ruby-library
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Encore Shao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -236,8 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
236
236
|
- !ruby/object:Gem::Version
|
237
237
|
version: '0'
|
238
238
|
requirements: []
|
239
|
-
|
240
|
-
rubygems_version: 2.6.13
|
239
|
+
rubygems_version: 3.0.3
|
241
240
|
signing_key:
|
242
241
|
specification_version: 4
|
243
242
|
summary: A Ruby wrapper for Crunchbase API v3.1
|