crunchbase4 0.1.3 → 0.1.8
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/.gitignore +1 -0
- data/CHANGELOG.md +42 -4
- data/Gemfile.lock +1 -1
- data/README.md +177 -26
- data/crunchbase4.gemspec +1 -1
- data/lib/crunchbase.rb +1 -1
- data/lib/crunchbase/entities/client.rb +18 -10
- data/lib/crunchbase/models.rb +7 -1
- data/lib/crunchbase/models/address.rb +36 -0
- data/lib/crunchbase/models/concerns/entity.rb +54 -0
- data/lib/crunchbase/models/concerns/mappings.rb +37 -0
- data/lib/crunchbase/models/event_appearance.rb +39 -0
- data/lib/crunchbase/models/fund.rb +43 -0
- data/lib/crunchbase/models/funding_round.rb +1 -0
- data/lib/crunchbase/models/job.rb +42 -0
- data/lib/crunchbase/models/organization.rb +10 -0
- data/lib/crunchbase/models/ownership.rb +39 -0
- data/lib/crunchbase/models/principal.rb +112 -0
- data/lib/crunchbase/utilities/autocomplete.rb +5 -20
- data/lib/crunchbase/utilities/deleted_entities.rb +4 -20
- data/lib/crunchbase/utilities/entity_endpoints.rb +40 -16
- data/lib/crunchbase/utilities/request.rb +6 -2
- data/lib/crunchbase/utilities/response.rb +23 -1
- data/lib/crunchbase/utilities/veriables.rb +1 -1
- data/lib/crunchbase/version.rb +1 -1
- metadata +14 -7
- data/lib/crunchbase/models/entity.rb +0 -72
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21f1d6c0bae981ebb5f54925d0db9a577c39e0e620bad32de9ba471cf4249545
|
4
|
+
data.tar.gz: fff8a1bf44fd50e44eda6b099c9eaf1cf091ab1e259dcaee2bbd4c1c86779d0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b77c39ab92e4610365f65cded56e13100ee58deaf76247531c5983e1fdb5c22d744c6f3d71bb6745a3effd83baac722079e87da6ce367f5a9dd5d6c712dcd3bb
|
7
|
+
data.tar.gz: 8d355c0fc87a2b70db8af8a02b0473f909a45573a2b3495a58c21a799465f92369892432db9c5e03dd2bb47a77b4f38b9955e144b1a50ee01659ee9ebee667eb
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,44 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
|
3
|
+
## [0.1.8] - 2021-02-23
|
4
|
+
|
5
|
+
### Add new fields on funding_rounds
|
6
|
+
- Adding diversity_spotlights and pre_money_valuation on raised_funding_rounds endpoint
|
7
|
+
|
8
|
+
## [0.1.7] - 2020-12-02
|
9
|
+
|
10
|
+
### Improve press_reference API response for activity_entities
|
11
|
+
- Returns relationship data for activity_entities
|
12
|
+
* Before returns all names for activity_entities
|
13
|
+
* After returns related organzation or person object
|
14
|
+
|
15
|
+
## [0.1.5] - 2020-06-26
|
16
|
+
|
17
|
+
### Refactoring
|
18
|
+
- Add more query condition support for card query (limit, order, before_id, after_id)
|
19
|
+
* Before
|
20
|
+
- Get organzation's fund: (`client.organization(entity_id, 'fund')`)
|
21
|
+
* After
|
22
|
+
- Get organzation's fund: (`client.organization(entity_id, card_id: 'fund')`)
|
23
|
+
- Method for uniformly obtaining deleted entities data and support more query condition
|
24
|
+
* Get deleted organizations
|
25
|
+
- Before: (`client.deleted_organizations`)
|
26
|
+
- After : (`client.deleted_entities(collection_ids: 'organizations', limit: 20)`)
|
27
|
+
- Method for uniformly obtaining autocompletes entities data and support more query condition
|
28
|
+
* Get autocompletes organizations
|
29
|
+
- Before: (`client.autocomplete_organizations`)
|
30
|
+
- After : (`client.autocomplete('ekohe', collection_ids: 'organizations', limit: 3)`)
|
31
|
+
|
32
|
+
## [0.1.4] - 2020-06-12
|
33
|
+
|
34
|
+
### Added
|
35
|
+
- Implemented APIs to get the cards data of Entity
|
36
|
+
- fund: (`client.organization(entity_id, 'fund')`)
|
37
|
+
- ownership: (`client.organization(entity_id, 'ownership')`)
|
38
|
+
- founders: (`client.organization(entity_id, 'founders')`)
|
39
|
+
- investors: (`client.organization(entity_id, 'investors')`)
|
40
|
+
- jobs: (`client.organization(entity_id, 'jobs')`)
|
41
|
+
- headquarters_address: (`client.organization(entity_id, 'headquarters_address')`)
|
4
42
|
|
5
43
|
## [0.1.3] - 2020-06-09
|
6
44
|
|
@@ -12,11 +50,11 @@ All notable changes to this project will be documented in this file.
|
|
12
50
|
|
13
51
|
### Added
|
14
52
|
- Implemented searches APIs to get the recent updates entities on Search
|
15
|
-
-
|
53
|
+
- organizations
|
16
54
|
- people
|
17
55
|
- funding rounds
|
18
56
|
- Implemented `autocompletes` API to allow user filter entities by keyword
|
19
|
-
-
|
57
|
+
- organizations
|
20
58
|
- people
|
21
59
|
- funding rounds
|
22
60
|
|
@@ -24,7 +62,7 @@ All notable changes to this project will be documented in this file.
|
|
24
62
|
|
25
63
|
### Added
|
26
64
|
- Implemented APIs to get acquisition and investment of Entity
|
27
|
-
- Implemented APIs to search
|
65
|
+
- Implemented APIs to search organizations and funding rounds of Search
|
28
66
|
|
29
67
|
### Changed
|
30
68
|
- Refactor the API client to support search API
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Crunchbase is a ruby wrapper based 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)
|
4
4
|
|
5
5
|
[](https://badge.fury.io/rb/crunchbase4)
|
6
|
-
[](https://travis-ci.org/ekohe/crunchbase4)
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
@@ -30,6 +30,7 @@ require 'crunchbase4'
|
|
30
30
|
|
31
31
|
CB_CONFIG = YAML.load(File.read('crunchbase.yml'))
|
32
32
|
Crunchbase.config.user_key = CB_CONFIG['user_key']
|
33
|
+
Crunchbase.config.user_key = false # If you want to know the request information, can set the debug = true
|
33
34
|
```
|
34
35
|
|
35
36
|
## Usage
|
@@ -43,22 +44,50 @@ pry(main)> client = Crunchbase::Client.new
|
|
43
44
|
#### API request for endpoint we completed
|
44
45
|
|
45
46
|
- [Entity](https://github.com/ekohe/crunchbase4#entity)
|
46
|
-
-
|
47
|
-
|
48
|
-
|
47
|
+
- Organization
|
48
|
+
- fields
|
49
|
+
- cards: [raised_investments, participated_funds, child_organizations, participated_investments, investors, parent_organization, raised_funding_rounds, ipos, event_appearances, raised_funds, acquiree_acquisitions, acquirer_acquisitions, parent_ownership, jobs, founders, child_ownerships, participated_funding_rounds, press_references, headquarters_address]
|
50
|
+
- Person
|
51
|
+
- fields
|
52
|
+
- FundingRound
|
53
|
+
- fields
|
49
54
|
- [Searches](https://github.com/ekohe/crunchbase4#search)
|
50
55
|
- [Autocompletes](https://github.com/ekohe/crunchbase4#autocompletes)
|
51
56
|
- [Deleted Entities](https://github.com/ekohe/crunchbase4#deleted-entities)
|
52
57
|
|
53
58
|
```ruby
|
54
|
-
<!--
|
55
|
-
response
|
56
|
-
|
59
|
+
<!-- Examples of organization and single card -->
|
60
|
+
response = client.organization('ekohe')
|
61
|
+
ipos = client.organization('ekohe', card_id: 'ipos')
|
62
|
+
fund = client.organization('ekohe', card_id: 'fund')
|
63
|
+
ownership = client.organization('ekohe', card_id: 'ownership')
|
64
|
+
founders = client.organization('ekohe', card_id: 'founders')
|
65
|
+
investors = client.organization('ekohe', card_id: 'investors')
|
66
|
+
jobs = client.organization('ekohe', card_id: 'jobs')
|
67
|
+
headquarters_address = client.organization('ekohe', card_id: 'headquarters_address')
|
68
|
+
top_2_press_references = client.organization('ekohe', card_id: 'press_references', limit: 2)
|
69
|
+
|
70
|
+
<!-- Examples to get the funding rounds of the organization through paging -->
|
71
|
+
response = client.organization(
|
72
|
+
'facebook', card_id: 'participated_funding_rounds',
|
73
|
+
limit: 5,
|
74
|
+
order: 'announced_on:desc',
|
75
|
+
after_id: '3cdfcecd-5377-439b-acab-cefcf6fe21a5'
|
76
|
+
)
|
77
|
+
|
78
|
+
<!-- Examples of person and single card -->
|
79
|
+
|
57
80
|
response = client.person('mark-zuckerberg')
|
58
|
-
response = client.person('mark-zuckerberg', 'participated_investments')
|
59
|
-
response = client.funding_round('
|
60
|
-
response = client.funding_round('
|
81
|
+
response = client.person('mark-zuckerberg', card_id: 'participated_investments')
|
82
|
+
response = client.funding_round('3cdfcecd-5377-439b-acab-cefcf6fe21a5')
|
83
|
+
response = client.funding_round('3cdfcecd-5377-439b-acab-cefcf6fe21a5', card_id: 'investors')
|
61
84
|
response = client.acquisition('7638eae9-07b7-4fc6-ad20-5d99de3ff928')
|
85
|
+
response = client.fund('aeaac12b-df56-7039-40f9-f1992f88e20e')
|
86
|
+
response = client.ownership('4506d9ce-85d3-4a8f-89cd-07a225359d55')
|
87
|
+
|
88
|
+
<!-- Get the JSON response of entity -->
|
89
|
+
|
90
|
+
response.as_json
|
62
91
|
|
63
92
|
<!-- Search -->
|
64
93
|
client.search_organizations(query_data)
|
@@ -72,14 +101,17 @@ client.recent_updates({
|
|
72
101
|
})
|
73
102
|
|
74
103
|
<!-- Autocompletes -->
|
75
|
-
response = client.
|
76
|
-
response = client.
|
77
|
-
response = client.
|
104
|
+
response = client.autocomplete('ekohe')
|
105
|
+
response = client.autocomplete('ekohe', collection_ids: 'organizations')
|
106
|
+
response = client.autocomplete('ekohe', collection_ids: 'organizations', limit: 3)
|
107
|
+
response = client.autocomplete('encore', collection_ids: 'people')
|
108
|
+
response = client.autocomplete('facebook', collection_ids: 'funding_rounds')
|
109
|
+
response = client.autocomplete('facebook', collection_ids: 'press_references')
|
78
110
|
|
79
111
|
<!-- Deleted Entities -->
|
80
|
-
response = client.
|
81
|
-
response = client.
|
82
|
-
response = client.
|
112
|
+
response = client.deledeted_entities(collection_ids: 'organizations')
|
113
|
+
response = client.deledeted_entities(collection_ids: 'people')
|
114
|
+
response = client.deledeted_entities(collection_ids: 'funding_rounds')
|
83
115
|
```
|
84
116
|
|
85
117
|
#### Module: Utils
|
@@ -155,7 +187,6 @@ pry(main)> response.permalink
|
|
155
187
|
##### Get the funding round data
|
156
188
|
|
157
189
|
```ruby
|
158
|
-
=> #<Crunchbase::Client:0x00007f8806824c28>
|
159
190
|
pry(main)> response = client.funding_round('371c20af-8aa9-4bcb-a8da-0694d138f247')
|
160
191
|
=> #<Crunchbase::Models::FundingRound:0x00007f8806b55ca8
|
161
192
|
@announced_on="2013-06-30",
|
@@ -175,6 +206,30 @@ pry(main)> response.name
|
|
175
206
|
pry(main)> response.uuid
|
176
207
|
=> "371c20af-8aa9-4bcb-a8da-0694d138f247"
|
177
208
|
```
|
209
|
+
##### Get the fund data
|
210
|
+
|
211
|
+
```ruby
|
212
|
+
pry(main)> response = client.fund('aeaac12b-df56-7039-40f9-f1992f88e20e')
|
213
|
+
=> #<Crunchbase::Models::Fund:0x00007ffa6a5a4080
|
214
|
+
@announced_on="2017-04-03",
|
215
|
+
@created_at="2017-04-04T04:40:49Z",
|
216
|
+
@entity_def_id="fund",
|
217
|
+
@image_id="v1491280776/azwvvy68ap2o29ffcnn7.png",
|
218
|
+
@investor_identifiers=["Betaworks", "Craig Newmark Philanthropies", "Democracy Fund", "Facebook", "Ford Foundation", "Knight Foundation", "Mozilla", "Tow Foundation"],
|
219
|
+
@money_raised=14000000,
|
220
|
+
@name="The News Integrity Initiative Fund I",
|
221
|
+
@num_investors=8,
|
222
|
+
@owner_identifier="The News Integrity Initiative",
|
223
|
+
@permalink="the-news-integrity-initiative-raised-the-news-integrity-initiative-fund-i--aeaac12b",
|
224
|
+
@short_description="The News Integrity Initiative raises new The News Integrity Initiative Fund I on 2017-04-03",
|
225
|
+
@started_on=nil,
|
226
|
+
@updated_at="2018-02-12T22:18:54Z",
|
227
|
+
@uuid="aeaac12b-df56-7039-40f9-f1992f88e20e">
|
228
|
+
pry(main)> response.name
|
229
|
+
=> "The News Integrity Initiative Fund I"
|
230
|
+
pry(main)> response.uuid
|
231
|
+
=> "aeaac12b-df56-7039-40f9-f1992f88e20e"
|
232
|
+
```
|
178
233
|
|
179
234
|
##### Get the acquisition data
|
180
235
|
|
@@ -197,12 +252,87 @@ pry(main)> response.acquiree_funding_total
|
|
197
252
|
|
198
253
|
```ruby
|
199
254
|
pry(main)> response = client.press_reference('0171b30e-9cf8-4ad5-8288-2993e4308e0f')
|
200
|
-
=> #<Crunchbase::Models::PressReference:
|
201
|
-
@activity_entities=
|
255
|
+
=> #<Crunchbase::Models::PressReference:0x00007fd6faf97800
|
256
|
+
@activity_entities=
|
257
|
+
[#<Crunchbase::Models::Organization:0x00007fd6fb41d9d8
|
258
|
+
@aliases=nil,
|
259
|
+
@description=nil,
|
260
|
+
@identifier=[],
|
261
|
+
@legal_name=nil,
|
262
|
+
@linkedin=nil,
|
263
|
+
@name="Facebook",
|
264
|
+
@permalink="facebook",
|
265
|
+
@permalink_aliases=nil,
|
266
|
+
@rank_org=nil,
|
267
|
+
@rank_org_company=nil,
|
268
|
+
@short_description=nil,
|
269
|
+
@twitter=nil,
|
270
|
+
@uuid="df662812-7f97-0b43-9d3e-12f64f504fbb",
|
271
|
+
@website=nil>,
|
272
|
+
#<Crunchbase::Models::Organization:0x00007fd6fb42f2c8
|
273
|
+
@aliases=nil,
|
274
|
+
@description=nil,
|
275
|
+
@identifier=[],
|
276
|
+
@legal_name=nil,
|
277
|
+
@linkedin=nil,
|
278
|
+
@name="General Atlantic",
|
279
|
+
@permalink="general-atlantic",
|
280
|
+
@permalink_aliases=nil,
|
281
|
+
@rank_org=nil,
|
282
|
+
@rank_org_company=nil,
|
283
|
+
@short_description=nil,
|
284
|
+
@twitter=nil,
|
285
|
+
@uuid="8b8d96f8-9dfe-b27a-8f57-7d266a051dc9",
|
286
|
+
@website=nil>,
|
287
|
+
#<Crunchbase::Models::Organization:0x00007fd6fb42da18
|
288
|
+
@aliases=nil,
|
289
|
+
@description=nil,
|
290
|
+
@identifier=[],
|
291
|
+
@legal_name=nil,
|
292
|
+
@linkedin=nil,
|
293
|
+
@name="Kohlberg Kravis Roberts",
|
294
|
+
@permalink="kkr",
|
295
|
+
@permalink_aliases=nil,
|
296
|
+
@rank_org=nil,
|
297
|
+
@rank_org_company=nil,
|
298
|
+
@short_description=nil,
|
299
|
+
@twitter=nil,
|
300
|
+
@uuid="6c93ebd7-3558-5603-daaf-074652d0e1bb",
|
301
|
+
@website=nil>,
|
302
|
+
#<Crunchbase::Models::Organization:0x00007fd6fb42c168
|
303
|
+
@aliases=nil,
|
304
|
+
@description=nil,
|
305
|
+
@identifier=[],
|
306
|
+
@legal_name=nil,
|
307
|
+
@linkedin=nil,
|
308
|
+
@name="Reliance Industries",
|
309
|
+
@permalink="reliance-industries-84fd",
|
310
|
+
@permalink_aliases=nil,
|
311
|
+
@rank_org=nil,
|
312
|
+
@rank_org_company=nil,
|
313
|
+
@short_description=nil,
|
314
|
+
@twitter=nil,
|
315
|
+
@uuid="7ba47aa0-0e01-4101-a74d-67a8205584fd",
|
316
|
+
@website=nil>,
|
317
|
+
#<Crunchbase::Models::Organization:0x00007fd6fb43e868
|
318
|
+
@aliases=nil,
|
319
|
+
@description=nil,
|
320
|
+
@identifier=[],
|
321
|
+
@legal_name=nil,
|
322
|
+
@linkedin=nil,
|
323
|
+
@name="Vista Equity Partners",
|
324
|
+
@permalink="vista-equity-partners",
|
325
|
+
@permalink_aliases=nil,
|
326
|
+
@rank_org=nil,
|
327
|
+
@rank_org_company=nil,
|
328
|
+
@short_description=nil,
|
329
|
+
@twitter=nil,
|
330
|
+
@uuid="4d096273-ae5d-d4c3-a411-20a42514d2ce",
|
331
|
+
@website=nil>],
|
202
332
|
@author=nil,
|
203
333
|
@created_at="2020-06-05T17:41:10Z",
|
204
334
|
@entity_def_id="press_reference",
|
205
|
-
@identifier="Jio Platforms to receive $1.2b from Abu Dhabi’s sovereign investment firm",
|
335
|
+
@identifier=["0171b30e-9cf8-4ad5-8288-2993e4308e0f", "Jio Platforms to receive $1.2b from Abu Dhabi’s sovereign investment firm"],
|
206
336
|
@posted_on="2020-06-05",
|
207
337
|
@publisher="Tech in Asia",
|
208
338
|
@thumbnail_url="https://cdn.techinasia.com/wp-content/uploads/2016/07/Flickr_-_World_Economic_Forum_-_Ambani.jpg",
|
@@ -236,6 +366,27 @@ pry(main)> response = client.investment('1368da0c-07b0-46ef-9a86-b518367e60d6')
|
|
236
366
|
@uuid="1368da0c-07b0-46ef-9a86-b518367e60d6">
|
237
367
|
```
|
238
368
|
|
369
|
+
##### Get the ownership data
|
370
|
+
|
371
|
+
```ruby
|
372
|
+
pry(main)> response = client.ownership('4506d9ce-85d3-4a8f-89cd-07a225359d55')
|
373
|
+
=> #<Crunchbase::Models::Ownership:0x00007fbf2fdb78b0
|
374
|
+
@created_at="2015-03-04T20:04:23Z",
|
375
|
+
@entity_def_id="ownership",
|
376
|
+
@identifier=["4506d9ce-85d3-4a8f-89cd-07a225359d55", "Facebook owns Instagram", "facebook-owns-instagram--4506d9ce"],
|
377
|
+
@name="Facebook owns Instagram",
|
378
|
+
@ownee_identifier="Instagram",
|
379
|
+
@owner_identifier="Facebook",
|
380
|
+
@ownership_type="subsidiary",
|
381
|
+
@permalink="facebook-owns-instagram--4506d9ce",
|
382
|
+
@updated_at="2018-02-13T01:18:10Z",
|
383
|
+
@uuid="4506d9ce-85d3-4a8f-89cd-07a225359d55">
|
384
|
+
pry(main)> response.name
|
385
|
+
=> "Facebook owns Instagram"
|
386
|
+
pry(main)> response.uuid
|
387
|
+
=> "4506d9ce-85d3-4a8f-89cd-07a225359d55"
|
388
|
+
```
|
389
|
+
|
239
390
|
### Search
|
240
391
|
|
241
392
|
* Search query parameters for each endpoint
|
@@ -434,7 +585,7 @@ Search by keyword has been supported in "Organization", "People" and "Fund Round
|
|
434
585
|
* Search in an organization by keyword
|
435
586
|
|
436
587
|
```ruby
|
437
|
-
pry(main)> response = client.
|
588
|
+
pry(main)> response = client.autocomplete('ekohe', collection_ids: 'organizations')
|
438
589
|
=> #<Crunchbase::Autocompletes::Client:0x00007fecb34ce1e8
|
439
590
|
@conditions={:query=>"ekohe", :collection_ids=>"organizations"},
|
440
591
|
@count=25,
|
@@ -466,7 +617,7 @@ pry(main)> response.total_count
|
|
466
617
|
* Search in an people by keyword
|
467
618
|
|
468
619
|
```ruby
|
469
|
-
pry(main)> response = client.
|
620
|
+
pry(main)> response = client.autocomplete('maxime', collection_ids: 'people')
|
470
621
|
=> #<Crunchbase::Autocompletes::Client:0x00007fecb474f9c0
|
471
622
|
@conditions={:query=>"maxime", :collection_ids=>"people"},
|
472
623
|
@count=25,
|
@@ -498,7 +649,7 @@ pry(main)> response.total_count
|
|
498
649
|
* Search in an funding rounds by keyword
|
499
650
|
|
500
651
|
```ruby
|
501
|
-
pry(main)> response = client.
|
652
|
+
pry(main)> response = client.autocomplete('facebook', collection_ids: 'funding_rounds')
|
502
653
|
=> #<Crunchbase::Autocompletes::Client:0x00007fecb4dd66b8
|
503
654
|
@conditions={:query=>"facebook", :collection_ids=>"funding_rounds"},
|
504
655
|
@count=25,
|
@@ -532,7 +683,7 @@ pry(main)> response.total_count
|
|
532
683
|
* Get deleted entities by collection_ids
|
533
684
|
|
534
685
|
```ruby
|
535
|
-
pry(main)> response = client.
|
686
|
+
pry(main)> response = client.deleted_entities
|
536
687
|
=> #<Crunchbase::DeletedEntities::Client:0x00007fa9196b6498
|
537
688
|
@conditions={:collection_ids=>"organizations"},
|
538
689
|
@count=1000,
|
@@ -556,8 +707,8 @@ pry(main)> response.count
|
|
556
707
|
pry(main)> response.total_count
|
557
708
|
|
558
709
|
# Get deleted people and funding rounds
|
559
|
-
pry(main)> response = client.
|
560
|
-
pry(main)> response = client.
|
710
|
+
pry(main)> response = client.deleted_entities(collection_ids: 'people')
|
711
|
+
pry(main)> response = client.deleted_entities(collection_ids: 'funding_rounds')
|
561
712
|
```
|
562
713
|
|
563
714
|
## Development
|
data/crunchbase4.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.metadata['homepage_uri'] = spec.homepage
|
21
21
|
spec.metadata['source_code_uri'] = 'https://github.com/ekohe/crunchbase4'
|
22
|
-
spec.metadata['changelog_uri'] = 'https://github.com/ekohe/crunchbase4/CHANGELOG.md'
|
22
|
+
spec.metadata['changelog_uri'] = 'https://github.com/ekohe/crunchbase4/blob/master/CHANGELOG.md'
|
23
23
|
|
24
24
|
# Specify which files should be added to the gem when it is released.
|
25
25
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
data/lib/crunchbase.rb
CHANGED
@@ -6,7 +6,7 @@ require_relative '../utilities/cb_model'
|
|
6
6
|
module Crunchbase
|
7
7
|
# Whole entities endpoints
|
8
8
|
module Entities
|
9
|
-
#
|
9
|
+
# using Crunchbase's Entity Lookup API endpoints
|
10
10
|
class Client
|
11
11
|
include ::Crunchbase::Utilities::Request
|
12
12
|
include ::Crunchbase::Utilities::CbModel
|
@@ -21,7 +21,7 @@ module Crunchbase
|
|
21
21
|
# Will include all attribute from API document
|
22
22
|
def fetch
|
23
23
|
cbobject.parse_response(entity(
|
24
|
-
|
24
|
+
entity_request_uri,
|
25
25
|
field_ids: cbobject.field_ids.join(',')
|
26
26
|
))
|
27
27
|
end
|
@@ -29,28 +29,36 @@ module Crunchbase
|
|
29
29
|
# Only include a part basis fields of endpoint
|
30
30
|
def fetch_cards(card_names = [])
|
31
31
|
cbobject.parse_response(entity(
|
32
|
-
|
32
|
+
entity_request_uri,
|
33
33
|
field_ids: cbobject.basis_fields.join(','),
|
34
34
|
cards: (cbobject.full_cards & card_names).join(',')
|
35
35
|
), cbobject.basis_fields, card_names)
|
36
36
|
end
|
37
37
|
|
38
|
-
|
38
|
+
# Auto combine the card num field to request field_ids
|
39
|
+
#
|
40
|
+
# Example: if card_id is investors, will auto add num_investors
|
41
|
+
def cards(card_id, **args)
|
39
42
|
raise Crunchbase::Error, 'Invalid card_id' unless cbobject.full_cards.include?(card_id)
|
40
43
|
|
44
|
+
field_ids = cbobject.basis_fields.concat(cbobject.card_num_field(card_id))
|
45
|
+
|
46
|
+
request_args = args.merge(
|
47
|
+
field_ids: field_ids.join(','),
|
48
|
+
card_field_ids: cbobject.model_mappings[card_id].new.field_ids.join(',')
|
49
|
+
)
|
41
50
|
cbobject.parse_response(entity(
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
), cbobject.basis_fields, [card_id])
|
51
|
+
entity_request_uri(name: __method__, card_id: card_id),
|
52
|
+
request_args
|
53
|
+
), field_ids, [card_id])
|
46
54
|
end
|
47
55
|
|
48
56
|
private
|
49
57
|
|
50
|
-
def
|
58
|
+
def entity_request_uri(**args)
|
51
59
|
[
|
52
60
|
ROOT_LIST, kclass_name::RESOURCE_LIST,
|
53
|
-
@entity_id, args[:name], args[:
|
61
|
+
@entity_id, args[:name], args[:card_id]
|
54
62
|
].compact.join('/')
|
55
63
|
end
|
56
64
|
end
|