crunchbase4 0.1.2 → 0.1.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 +4 -4
- data/CHANGELOG.md +45 -6
- data/Gemfile.lock +1 -1
- data/README.md +297 -78
- data/crunchbase4.gemspec +2 -2
- data/lib/crunchbase.rb +1 -1
- data/lib/crunchbase/autocompletes/client.rb +2 -2
- data/lib/crunchbase/deleted_entities/client.rb +69 -0
- data/lib/crunchbase/entities/client.rb +24 -12
- data/lib/crunchbase/models.rb +8 -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/deleted_entity.rb +26 -0
- data/lib/crunchbase/models/event_appearance.rb +39 -0
- data/lib/crunchbase/models/fund.rb +43 -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 +33 -1
- data/lib/crunchbase/utilities/entity_endpoints.rb +52 -28
- data/lib/crunchbase/utilities/request.rb +10 -2
- data/lib/crunchbase/utilities/response.rb +20 -1
- data/lib/crunchbase/utilities/veriables.rb +1 -1
- data/lib/crunchbase/version.rb +1 -1
- metadata +16 -7
- data/lib/crunchbase/models/entity.rb +0 -32
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crunchbase
|
4
|
+
# Get the Entities data from API
|
5
|
+
module Models
|
6
|
+
# Get the Principal data from API
|
7
|
+
class Job < Entity
|
8
|
+
RESOURCE_LIST = 'jobs'
|
9
|
+
|
10
|
+
def field_ids
|
11
|
+
%w[
|
12
|
+
created_at
|
13
|
+
employee_featured_order
|
14
|
+
entity_def_id
|
15
|
+
identifier
|
16
|
+
short_description
|
17
|
+
updated_at
|
18
|
+
] + basis_fields
|
19
|
+
end
|
20
|
+
|
21
|
+
def basis_fields
|
22
|
+
%w[
|
23
|
+
uuid
|
24
|
+
name
|
25
|
+
title
|
26
|
+
started_on
|
27
|
+
ended_on
|
28
|
+
permalink
|
29
|
+
job_type
|
30
|
+
is_current
|
31
|
+
organization_identifier
|
32
|
+
person_identifier
|
33
|
+
]
|
34
|
+
end
|
35
|
+
|
36
|
+
def full_cards
|
37
|
+
%w[
|
38
|
+
]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -134,6 +134,16 @@ module Crunchbase
|
|
134
134
|
headquarters_address
|
135
135
|
]
|
136
136
|
end
|
137
|
+
|
138
|
+
def employees_range
|
139
|
+
Crunchbase::Utils::NUM_EMPLOYEES_ENUM[num_employees_enum]
|
140
|
+
end
|
141
|
+
|
142
|
+
private
|
143
|
+
|
144
|
+
def custom_fields
|
145
|
+
%w[employees_range]
|
146
|
+
end
|
137
147
|
end
|
138
148
|
end
|
139
149
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crunchbase
|
4
|
+
# Get the Entities data from API
|
5
|
+
module Models
|
6
|
+
# Get the Ownership data from API
|
7
|
+
class Ownership < Entity
|
8
|
+
RESOURCE_LIST = 'ownerships'
|
9
|
+
|
10
|
+
def field_ids
|
11
|
+
%w[
|
12
|
+
created_at
|
13
|
+
entity_def_id
|
14
|
+
identifier
|
15
|
+
updated_at
|
16
|
+
] + basis_fields
|
17
|
+
end
|
18
|
+
|
19
|
+
def basis_fields
|
20
|
+
%w[
|
21
|
+
uuid
|
22
|
+
permalink
|
23
|
+
name
|
24
|
+
ownee_identifier
|
25
|
+
owner_identifier
|
26
|
+
ownership_type
|
27
|
+
]
|
28
|
+
end
|
29
|
+
|
30
|
+
def full_cards
|
31
|
+
%w[
|
32
|
+
child_organization
|
33
|
+
parent_organization
|
34
|
+
press_references
|
35
|
+
]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crunchbase
|
4
|
+
# Get the Entities data from API
|
5
|
+
module Models
|
6
|
+
# Get the Principal data from API
|
7
|
+
class Principal < Entity
|
8
|
+
RESOURCE_LIST = 'principals'
|
9
|
+
|
10
|
+
def field_ids
|
11
|
+
%w[
|
12
|
+
category_groups
|
13
|
+
created_at
|
14
|
+
delisted_on
|
15
|
+
description
|
16
|
+
died_on
|
17
|
+
entity_def_id
|
18
|
+
equity_funding_total
|
19
|
+
exited_on
|
20
|
+
facet_ids
|
21
|
+
first_name
|
22
|
+
founded_on
|
23
|
+
founder_identifiers
|
24
|
+
funding_stage
|
25
|
+
funding_total
|
26
|
+
gender
|
27
|
+
hub_tags
|
28
|
+
identifier
|
29
|
+
image_id
|
30
|
+
image_url
|
31
|
+
investor_identifiers
|
32
|
+
ipo_status
|
33
|
+
last_equity_funding_total
|
34
|
+
last_equity_funding_type
|
35
|
+
last_funding_at
|
36
|
+
last_funding_total
|
37
|
+
last_funding_type
|
38
|
+
last_name
|
39
|
+
layout_id
|
40
|
+
location_group_identifiers
|
41
|
+
location_identifiers
|
42
|
+
num_alumni
|
43
|
+
num_articles
|
44
|
+
num_employees_enum
|
45
|
+
num_enrollments
|
46
|
+
num_event_appearances
|
47
|
+
num_exits
|
48
|
+
num_exits_ipo
|
49
|
+
num_founded_organizations
|
50
|
+
num_founders
|
51
|
+
num_funding_rounds
|
52
|
+
num_funds
|
53
|
+
num_investments
|
54
|
+
num_investments_funding_rounds
|
55
|
+
num_investors
|
56
|
+
num_jobs
|
57
|
+
num_lead_investments
|
58
|
+
num_lead_investors
|
59
|
+
num_partner_investments
|
60
|
+
num_portfolio_organizations
|
61
|
+
program_application_deadline
|
62
|
+
program_duration
|
63
|
+
program_type
|
64
|
+
rank_delta_d30
|
65
|
+
rank_delta_d7
|
66
|
+
rank_delta_d90
|
67
|
+
rank_principal
|
68
|
+
revenue_range
|
69
|
+
school_method
|
70
|
+
school_program
|
71
|
+
school_type
|
72
|
+
status
|
73
|
+
stock_exchange_symbol
|
74
|
+
stock_symbol
|
75
|
+
updated_at
|
76
|
+
went_public_on
|
77
|
+
] + basis_fields
|
78
|
+
end
|
79
|
+
|
80
|
+
def basis_fields
|
81
|
+
%w[
|
82
|
+
name
|
83
|
+
uuid
|
84
|
+
website
|
85
|
+
short_description
|
86
|
+
operating_status
|
87
|
+
permalink
|
88
|
+
permalink_aliases
|
89
|
+
phone_number
|
90
|
+
primary_job_title
|
91
|
+
primary_organization
|
92
|
+
contact_email
|
93
|
+
aliases
|
94
|
+
born_on
|
95
|
+
closed_on
|
96
|
+
categories
|
97
|
+
company_type
|
98
|
+
linkedin
|
99
|
+
twitter
|
100
|
+
facebook
|
101
|
+
investor_stage
|
102
|
+
investor_type
|
103
|
+
]
|
104
|
+
end
|
105
|
+
|
106
|
+
def full_cards
|
107
|
+
%w[
|
108
|
+
]
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
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_query_data(keyword, 'people'))
|
42
|
-
end
|
43
|
-
|
44
|
-
def autocomplete_funding_rounds(keyword)
|
45
|
-
autocompletes(wrapper_query_data(keyword, 'funding_rounds'))
|
46
|
-
end
|
47
|
-
|
48
|
-
def autocomplete_press_references(keyword)
|
49
|
-
autocompletes(wrapper_query_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
|
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
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative '../deleted_entities/client'
|
4
|
+
|
3
5
|
module Crunchbase
|
4
6
|
# Utilities
|
5
7
|
module Utilities
|
@@ -9,7 +11,37 @@ module Crunchbase
|
|
9
11
|
#
|
10
12
|
# Retrieve deleted entities
|
11
13
|
# Retrieve deleted entities for a collection id
|
12
|
-
|
14
|
+
#
|
15
|
+
# API doc:
|
16
|
+
# https://app.swaggerhub.com/apis-docs/Crunchbase/crunchbase-enterprise_api/1.0.1#/Deleted%20Entities/get_deleted_entities
|
17
|
+
#
|
18
|
+
# Parameters:
|
19
|
+
# collection_ids: string
|
20
|
+
# Filter by collection id(s). Comma separated list of collection ids.
|
21
|
+
# E.g.
|
22
|
+
# organizations, people, funding_rounds, acquisitions, investments,
|
23
|
+
# events, press_references, funds, event_appearances, ipos, ownerships,
|
24
|
+
# categories, category_groups, locations, jobs
|
25
|
+
# before_id: string
|
26
|
+
# Used to paginate search results to the previous page. before_id should be the uuid of the first item in the current page.
|
27
|
+
# May not be provided simultaneously with after_id.
|
28
|
+
# after_id: string
|
29
|
+
# Used to paginate search results to the next page. after_id should be the uuid of the last item in the current page.
|
30
|
+
# May not be provided simultaneously with before_id.
|
31
|
+
# limit: integer
|
32
|
+
# Number of rows to return. Default is 100, min is 1, max is 1000.
|
33
|
+
# deleted_at_order: string
|
34
|
+
# Direction of sorting by deleted_at property
|
35
|
+
# Available values : asc, desc
|
36
|
+
def deleted_entities(**args)
|
37
|
+
crunchbase_deleted_entities(args)
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def crunchbase_deleted_entities(args)
|
43
|
+
Crunchbase::DeletedEntities::Client.new(args).deleted_entities
|
44
|
+
end
|
13
45
|
end
|
14
46
|
end
|
15
47
|
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,63 +27,83 @@ 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
|
33
|
-
def person_cards(entity_id)
|
34
|
-
entities('person', entity_id).fetch_cards
|
35
|
+
def person_cards(entity_id, cards: [])
|
36
|
+
entities('person', entity_id).fetch_cards(cards)
|
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
|
43
|
-
def funding_round_cards(entity_id)
|
44
|
-
entities('funding_round', entity_id).fetch_cards
|
45
|
+
def funding_round_cards(entity_id, cards: [])
|
46
|
+
entities('funding_round', entity_id).fetch_cards(cards)
|
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
|
53
|
-
def acquisition_cards(entity_id)
|
54
|
-
entities('acquisition', entity_id).fetch_cards
|
55
|
+
def acquisition_cards(entity_id, cards: [])
|
56
|
+
entities('acquisition', entity_id).fetch_cards(cards)
|
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
|
63
|
-
def investment_cards(entity_id)
|
64
|
-
entities('investment', entity_id).fetch_cards
|
65
|
+
def investment_cards(entity_id, cards: [])
|
66
|
+
entities('investment', entity_id).fetch_cards(cards)
|
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
|
73
|
-
def press_reference_cards(entity_id)
|
74
|
-
entities('press_reference', entity_id).fetch_cards
|
75
|
+
def press_reference_cards(entity_id, cards: [])
|
76
|
+
entities('press_reference', entity_id).fetch_cards(cards)
|
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
|
83
|
-
def ipo_cards(entity_id)
|
84
|
-
entities('ipo', entity_id).fetch_cards
|
85
|
+
def ipo_cards(entity_id, cards: [])
|
86
|
+
entities('ipo', entity_id).fetch_cards(cards)
|
87
|
+
end
|
88
|
+
|
89
|
+
# Lookup an fund or Single card
|
90
|
+
def fund(entity_id, **card_args)
|
91
|
+
lookup_for('fund', entity_id, card_args)
|
92
|
+
end
|
93
|
+
|
94
|
+
# Lookup fund's all card
|
95
|
+
def fund_cards(entity_id, cards: [])
|
96
|
+
entities('fund', entity_id).fetch_cards(cards)
|
97
|
+
end
|
98
|
+
|
99
|
+
# Lookup an fund or Single card
|
100
|
+
def ownership(entity_id, **card_args)
|
101
|
+
lookup_for('ownership', entity_id, card_args)
|
102
|
+
end
|
103
|
+
|
104
|
+
# Lookup fund's all card
|
105
|
+
def ownership_cards(entity_id, cards: [])
|
106
|
+
entities('ownership', entity_id).fetch_cards(cards)
|
85
107
|
end
|
86
108
|
|
87
109
|
private
|
@@ -90,11 +112,13 @@ module Crunchbase
|
|
90
112
|
Crunchbase::Entities::Client.new(entity_id, entity_type)
|
91
113
|
end
|
92
114
|
|
93
|
-
def lookup_for(entity_type, entity_id,
|
115
|
+
def lookup_for(entity_type, entity_id, **card_args)
|
94
116
|
kobject = entities(entity_type, entity_id)
|
117
|
+
|
118
|
+
card_id = card_args&.delete(:card_id)
|
95
119
|
return kobject.fetch if card_id.nil?
|
96
120
|
|
97
|
-
kobject.cards(card_id)
|
121
|
+
kobject.cards(card_id, card_args)
|
98
122
|
end
|
99
123
|
end
|
100
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
|
|
@@ -18,6 +22,10 @@ module Crunchbase
|
|
18
22
|
fetch_request(uri, *args)
|
19
23
|
end
|
20
24
|
|
25
|
+
def deleted(uri, *args)
|
26
|
+
fetch_request(uri, *args)
|
27
|
+
end
|
28
|
+
|
21
29
|
# Entity endpoints
|
22
30
|
#
|
23
31
|
# https://app.swaggerhub.com/apis-docs/Crunchbase/crunchbase-enterprise_api/1.0.1#/Entity/get_entities_organizations__entity_id_
|
@@ -52,7 +60,7 @@ module Crunchbase
|
|
52
60
|
|
53
61
|
return response.body if response.status == 200
|
54
62
|
|
55
|
-
raise Error, response.body['error']
|
63
|
+
raise Error, response.status == 400 ? response.body[0]['message'] : response.body['error']
|
56
64
|
end
|
57
65
|
|
58
66
|
def debug_mode?
|