crunchbase4 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -7
- data/Gemfile.lock +1 -1
- data/README.md +28 -17
- data/lib/crunchbase/entities/client.rb +18 -10
- data/lib/crunchbase/models/concerns/mappings.rb +4 -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 +24 -20
- data/lib/crunchbase/utilities/request.rb +6 -2
- data/lib/crunchbase/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84f43d773473d40462a4eead8f4548aaa15eb10b2c5dff849b50d07f579fddf5
|
4
|
+
data.tar.gz: 7f34006abc99d5106cdf7a261adade5e72d8db7be3d68a1cbd3bccdfb8e1d10b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab8418cc8cb8739460bb1335092dee1f9110e9453f4ab61bca6430ad0250251db887e5cf95637fb0d1f319030a4b16ad0e188c3c925b9c63ea1aa2fd257da25b
|
7
|
+
data.tar.gz: 67c78499a471c58315b1ff8d6c4abd5fe262dda55cfd2d67edf74be77d701a4e777db43cb1b6d38cb7d4cd1e0f6642b93b52f5608ee5df741830103378d5ff3d
|
data/CHANGELOG.md
CHANGED
@@ -1,15 +1,32 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [0.1.5] - 2020-06-26
|
4
|
+
|
5
|
+
### Refactoring
|
6
|
+
- Add more query condition support for card query (limit, order, before_id, after_id)
|
7
|
+
* Before
|
8
|
+
- Get organzation's fund: (`client.organization(entity_id, 'fund')`)
|
9
|
+
* After
|
10
|
+
- Get organzation's fund: (`client.organization(entity_id, card_id: 'fund')`)
|
11
|
+
- Method for uniformly obtaining deleted entities data and support more query condition
|
12
|
+
* Get deleted organzations
|
13
|
+
- Before: (`client.deleted_organzations`)
|
14
|
+
- After : (`client.deleted_entities(collection_ids: 'organizations', limit: 20)`)
|
15
|
+
- Method for uniformly obtaining autocompletes entities data and support more query condition
|
16
|
+
* Get autocompletes organzations
|
17
|
+
- Before: (`client.autocomplete_organzations`)
|
18
|
+
- After : (`client.autocomplete('ekohe', collection_ids: 'organizations', limit: 3)`)
|
19
|
+
|
3
20
|
## [0.1.4] - 2020-06-12
|
4
21
|
|
5
22
|
### Added
|
6
|
-
- Implemented
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
10
|
-
-
|
11
|
-
-
|
12
|
-
-
|
23
|
+
- Implemented APIs to get the cards data of Entity
|
24
|
+
- fund: (`client.organization(entity_id, 'fund')`)
|
25
|
+
- ownership: (`client.organization(entity_id, 'ownership')`)
|
26
|
+
- founders: (`client.organization(entity_id, 'founders')`)
|
27
|
+
- investors: (`client.organization(entity_id, 'investors')`)
|
28
|
+
- jobs: (`client.organization(entity_id, 'jobs')`)
|
29
|
+
- headquarters_address: (`client.organization(entity_id, 'headquarters_address')`)
|
13
30
|
|
14
31
|
## [0.1.3] - 2020-06-09
|
15
32
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -56,13 +56,21 @@ pry(main)> client = Crunchbase::Client.new
|
|
56
56
|
- [Deleted Entities](https://github.com/ekohe/crunchbase4#deleted-entities)
|
57
57
|
|
58
58
|
```ruby
|
59
|
-
<!-- Entity -->
|
60
|
-
response
|
61
|
-
|
59
|
+
<!-- Entity 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
|
+
|
62
70
|
response = client.person('mark-zuckerberg')
|
63
|
-
response = client.person('mark-zuckerberg', 'participated_investments')
|
71
|
+
response = client.person('mark-zuckerberg', card_id: 'participated_investments')
|
64
72
|
response = client.funding_round('371c20af8aa94bcba8da0694d138f247')
|
65
|
-
response = client.funding_round('371c20af8aa94bcba8da0694d138f247', '
|
73
|
+
response = client.funding_round('371c20af8aa94bcba8da0694d138f247', card_id: 'investors')
|
66
74
|
response = client.acquisition('7638eae9-07b7-4fc6-ad20-5d99de3ff928')
|
67
75
|
response = client.fund('aeaac12b-df56-7039-40f9-f1992f88e20e')
|
68
76
|
response = client.ownership('4506d9ce-85d3-4a8f-89cd-07a225359d55')
|
@@ -83,14 +91,17 @@ client.recent_updates({
|
|
83
91
|
})
|
84
92
|
|
85
93
|
<!-- Autocompletes -->
|
86
|
-
response = client.
|
87
|
-
response = client.
|
88
|
-
response = client.
|
94
|
+
response = client.autocomplete('ekohe')
|
95
|
+
response = client.autocomplete('ekohe', collection_ids: 'organizations')
|
96
|
+
response = client.autocomplete('ekohe', collection_ids: 'organizations', limit: 3)
|
97
|
+
response = client.autocomplete('encore', collection_ids: 'people')
|
98
|
+
response = client.autocomplete('facebook', collection_ids: 'funding_rounds')
|
99
|
+
response = client.autocomplete('facebook', collection_ids: 'press_references')
|
89
100
|
|
90
101
|
<!-- Deleted Entities -->
|
91
|
-
response = client.
|
92
|
-
response = client.
|
93
|
-
response = client.
|
102
|
+
response = client.deledeted_entities(collection_ids: 'organizations')
|
103
|
+
response = client.deledeted_entities(collection_ids: 'people')
|
104
|
+
response = client.deledeted_entities(collection_ids: 'funding_rounds')
|
94
105
|
```
|
95
106
|
|
96
107
|
#### Module: Utils
|
@@ -489,7 +500,7 @@ Search by keyword has been supported in "Organization", "People" and "Fund Round
|
|
489
500
|
* Search in an organization by keyword
|
490
501
|
|
491
502
|
```ruby
|
492
|
-
pry(main)> response = client.
|
503
|
+
pry(main)> response = client.autocomplete('ekohe', collection_ids: 'organizations')
|
493
504
|
=> #<Crunchbase::Autocompletes::Client:0x00007fecb34ce1e8
|
494
505
|
@conditions={:query=>"ekohe", :collection_ids=>"organizations"},
|
495
506
|
@count=25,
|
@@ -521,7 +532,7 @@ pry(main)> response.total_count
|
|
521
532
|
* Search in an people by keyword
|
522
533
|
|
523
534
|
```ruby
|
524
|
-
pry(main)> response = client.
|
535
|
+
pry(main)> response = client.autocomplete('maxime', collection_ids: 'people')
|
525
536
|
=> #<Crunchbase::Autocompletes::Client:0x00007fecb474f9c0
|
526
537
|
@conditions={:query=>"maxime", :collection_ids=>"people"},
|
527
538
|
@count=25,
|
@@ -553,7 +564,7 @@ pry(main)> response.total_count
|
|
553
564
|
* Search in an funding rounds by keyword
|
554
565
|
|
555
566
|
```ruby
|
556
|
-
pry(main)> response = client.
|
567
|
+
pry(main)> response = client.autocomplete('facebook', collection_ids: 'funding_rounds')
|
557
568
|
=> #<Crunchbase::Autocompletes::Client:0x00007fecb4dd66b8
|
558
569
|
@conditions={:query=>"facebook", :collection_ids=>"funding_rounds"},
|
559
570
|
@count=25,
|
@@ -587,7 +598,7 @@ pry(main)> response.total_count
|
|
587
598
|
* Get deleted entities by collection_ids
|
588
599
|
|
589
600
|
```ruby
|
590
|
-
pry(main)> response = client.
|
601
|
+
pry(main)> response = client.deleted_entities
|
591
602
|
=> #<Crunchbase::DeletedEntities::Client:0x00007fa9196b6498
|
592
603
|
@conditions={:collection_ids=>"organizations"},
|
593
604
|
@count=1000,
|
@@ -611,8 +622,8 @@ pry(main)> response.count
|
|
611
622
|
pry(main)> response.total_count
|
612
623
|
|
613
624
|
# Get deleted people and funding rounds
|
614
|
-
pry(main)> response = client.
|
615
|
-
pry(main)> response = client.
|
625
|
+
pry(main)> response = client.deleted_entities(collection_ids: 'people')
|
626
|
+
pry(main)> response = client.deleted_entities(collection_ids: 'funding_rounds')
|
616
627
|
```
|
617
628
|
|
618
629
|
## Development
|
@@ -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
|
@@ -33,33 +33,18 @@ module Crunchbase
|
|
33
33
|
# query: keyword,
|
34
34
|
# collection_ids: 'organizations'
|
35
35
|
# }
|
36
|
-
def
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
def autocomplete_people(keyword)
|
41
|
-
autocompletes(wrapper_autocompletes_data(keyword, 'people'))
|
42
|
-
end
|
43
|
-
|
44
|
-
def autocomplete_funding_rounds(keyword)
|
45
|
-
autocompletes(wrapper_autocompletes_data(keyword, 'funding_rounds'))
|
46
|
-
end
|
47
|
-
|
48
|
-
def autocomplete_press_references(keyword)
|
49
|
-
autocompletes(wrapper_autocompletes_data(keyword, 'press_references'))
|
36
|
+
def autocomplete(keyword, **args)
|
37
|
+
crunchbase_autocompletes(wrapper_autocompletes_data(keyword, args))
|
50
38
|
end
|
51
39
|
|
52
40
|
private
|
53
41
|
|
54
|
-
def
|
42
|
+
def crunchbase_autocompletes(raw_data)
|
55
43
|
Crunchbase::Autocompletes::Client.new(raw_data).autocompletes
|
56
44
|
end
|
57
45
|
|
58
|
-
def wrapper_autocompletes_data(keyword,
|
59
|
-
{
|
60
|
-
query: keyword,
|
61
|
-
collection_ids: collection_ids
|
62
|
-
}
|
46
|
+
def wrapper_autocompletes_data(keyword, **args)
|
47
|
+
{ query: keyword }.merge(args)
|
63
48
|
end
|
64
49
|
end
|
65
50
|
end
|
@@ -33,30 +33,14 @@ module Crunchbase
|
|
33
33
|
# deleted_at_order: string
|
34
34
|
# Direction of sorting by deleted_at property
|
35
35
|
# Available values : asc, desc
|
36
|
-
def
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
def deleted_people(args = {})
|
41
|
-
deleted_entities(wrapper_deleted_entities_data(args, 'people'))
|
42
|
-
end
|
43
|
-
|
44
|
-
def deleted_funding_rounds(args = {})
|
45
|
-
deleted_entities(wrapper_deleted_entities_data(args, 'funding_rounds'))
|
46
|
-
end
|
47
|
-
|
48
|
-
def deleted_press_references(args = {})
|
49
|
-
deleted_entities(wrapper_deleted_entities_data(args, 'press_references'))
|
36
|
+
def deleted_entities(**args)
|
37
|
+
crunchbase_deleted_entities(args)
|
50
38
|
end
|
51
39
|
|
52
40
|
private
|
53
41
|
|
54
|
-
def
|
55
|
-
Crunchbase::DeletedEntities::Client.new(
|
56
|
-
end
|
57
|
-
|
58
|
-
def wrapper_deleted_entities_data(args, collection_ids = nil)
|
59
|
-
args.merge!(collection_ids: collection_ids)
|
42
|
+
def crunchbase_deleted_entities(args)
|
43
|
+
Crunchbase::DeletedEntities::Client.new(args).deleted_entities
|
60
44
|
end
|
61
45
|
end
|
62
46
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative '../errors'
|
4
|
+
|
3
5
|
module Crunchbase
|
4
6
|
# Utilities
|
5
7
|
module Utilities
|
@@ -15,8 +17,8 @@ module Crunchbase
|
|
15
17
|
# limit: Number of rows to return. Default is 100, min is 1, max is 100.
|
16
18
|
|
17
19
|
# Lookup an Organization or single card
|
18
|
-
def organization(entity_id,
|
19
|
-
lookup_for('organization', entity_id,
|
20
|
+
def organization(entity_id, **card_args)
|
21
|
+
lookup_for('organization', entity_id, card_args)
|
20
22
|
end
|
21
23
|
|
22
24
|
# Lookup Organization's all cards
|
@@ -25,8 +27,8 @@ module Crunchbase
|
|
25
27
|
end
|
26
28
|
|
27
29
|
# Lookup a Person or single card
|
28
|
-
def person(entity_id,
|
29
|
-
lookup_for('person', entity_id,
|
30
|
+
def person(entity_id, **card_args)
|
31
|
+
lookup_for('person', entity_id, card_args)
|
30
32
|
end
|
31
33
|
|
32
34
|
# Lookup Person's all cards
|
@@ -35,8 +37,8 @@ module Crunchbase
|
|
35
37
|
end
|
36
38
|
|
37
39
|
# Lookup a Funding Round or single card
|
38
|
-
def funding_round(entity_id,
|
39
|
-
lookup_for('funding_round', entity_id,
|
40
|
+
def funding_round(entity_id, **card_args)
|
41
|
+
lookup_for('funding_round', entity_id, card_args)
|
40
42
|
end
|
41
43
|
|
42
44
|
# Lookup Funding Round's all cards
|
@@ -45,8 +47,8 @@ module Crunchbase
|
|
45
47
|
end
|
46
48
|
|
47
49
|
# Lookup an Acquisition or Single card
|
48
|
-
def acquisition(entity_id,
|
49
|
-
lookup_for('acquisition', entity_id,
|
50
|
+
def acquisition(entity_id, **card_args)
|
51
|
+
lookup_for('acquisition', entity_id, card_args)
|
50
52
|
end
|
51
53
|
|
52
54
|
# Lookup Acquisition's all card
|
@@ -55,8 +57,8 @@ module Crunchbase
|
|
55
57
|
end
|
56
58
|
|
57
59
|
# Lookup an Investment or Single card
|
58
|
-
def investment(entity_id,
|
59
|
-
lookup_for('investment', entity_id,
|
60
|
+
def investment(entity_id, **card_args)
|
61
|
+
lookup_for('investment', entity_id, card_args)
|
60
62
|
end
|
61
63
|
|
62
64
|
# Lookup Investment's all card
|
@@ -65,8 +67,8 @@ module Crunchbase
|
|
65
67
|
end
|
66
68
|
|
67
69
|
# Lookup an PressReference or Single card
|
68
|
-
def press_reference(entity_id,
|
69
|
-
lookup_for('press_reference', entity_id,
|
70
|
+
def press_reference(entity_id, **card_args)
|
71
|
+
lookup_for('press_reference', entity_id, card_args)
|
70
72
|
end
|
71
73
|
|
72
74
|
# Lookup PressReference's all card
|
@@ -75,8 +77,8 @@ module Crunchbase
|
|
75
77
|
end
|
76
78
|
|
77
79
|
# Lookup an Ipo or Single card
|
78
|
-
def ipo(entity_id,
|
79
|
-
lookup_for('ipo', entity_id,
|
80
|
+
def ipo(entity_id, **card_args)
|
81
|
+
lookup_for('ipo', entity_id, card_args)
|
80
82
|
end
|
81
83
|
|
82
84
|
# Lookup Ipo's all card
|
@@ -85,8 +87,8 @@ module Crunchbase
|
|
85
87
|
end
|
86
88
|
|
87
89
|
# Lookup an fund or Single card
|
88
|
-
def fund(entity_id,
|
89
|
-
lookup_for('fund', entity_id,
|
90
|
+
def fund(entity_id, **card_args)
|
91
|
+
lookup_for('fund', entity_id, card_args)
|
90
92
|
end
|
91
93
|
|
92
94
|
# Lookup fund's all card
|
@@ -95,8 +97,8 @@ module Crunchbase
|
|
95
97
|
end
|
96
98
|
|
97
99
|
# Lookup an fund or Single card
|
98
|
-
def ownership(entity_id,
|
99
|
-
lookup_for('ownership', entity_id,
|
100
|
+
def ownership(entity_id, **card_args)
|
101
|
+
lookup_for('ownership', entity_id, card_args)
|
100
102
|
end
|
101
103
|
|
102
104
|
# Lookup fund's all card
|
@@ -110,11 +112,13 @@ module Crunchbase
|
|
110
112
|
Crunchbase::Entities::Client.new(entity_id, entity_type)
|
111
113
|
end
|
112
114
|
|
113
|
-
def lookup_for(entity_type, entity_id,
|
115
|
+
def lookup_for(entity_type, entity_id, **card_args)
|
114
116
|
kobject = entities(entity_type, entity_id)
|
117
|
+
|
118
|
+
card_id = card_args&.delete(:card_id)
|
115
119
|
return kobject.fetch if card_id.nil?
|
116
120
|
|
117
|
-
kobject.cards(card_id)
|
121
|
+
kobject.cards(card_id, card_args)
|
118
122
|
end
|
119
123
|
end
|
120
124
|
end
|
@@ -9,7 +9,11 @@ require_relative '../errors'
|
|
9
9
|
module Crunchbase
|
10
10
|
# Utilities
|
11
11
|
module Utilities
|
12
|
-
#
|
12
|
+
# Key Reminder
|
13
|
+
#
|
14
|
+
# entity_id must be provided in the request
|
15
|
+
# entity_id can be the uuid or the permalink of the entity
|
16
|
+
# you can pass your API key in the request's header if you do not want to pass the API key in the URL
|
13
17
|
module Request
|
14
18
|
module_function
|
15
19
|
|
@@ -56,7 +60,7 @@ module Crunchbase
|
|
56
60
|
|
57
61
|
return response.body if response.status == 200
|
58
62
|
|
59
|
-
raise Error, response.body['error']
|
63
|
+
raise Error, response.status == 400 ? response.body[0]['message'] : response.body['error']
|
60
64
|
end
|
61
65
|
|
62
66
|
def debug_mode?
|
data/lib/crunchbase/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crunchbase4
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Encore Shao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|