crunchbase4 0.1.0 → 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/.rubocop_todo.yml +11 -1
- data/CHANGELOG.md +66 -0
- data/Gemfile.lock +4 -1
- data/README.md +572 -62
- data/crunchbase4.gemspec +7 -6
- data/lib/crunchbase.rb +30 -3
- data/lib/crunchbase/autocompletes/client.rb +75 -0
- data/lib/crunchbase/client.rb +9 -40
- data/lib/crunchbase/config.rb +1 -1
- data/lib/crunchbase/deleted_entities/client.rb +69 -0
- data/lib/crunchbase/entities/client.rb +35 -21
- data/lib/crunchbase/models.rb +11 -1
- data/lib/crunchbase/models/acquisition.rb +61 -0
- data/lib/crunchbase/models/address.rb +36 -0
- data/lib/crunchbase/models/autocomplete_entity.rb +25 -0
- data/lib/crunchbase/models/concerns/entity.rb +48 -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/funding_round.rb +1 -1
- data/lib/crunchbase/models/ipo.rb +48 -0
- data/lib/crunchbase/models/job.rb +42 -0
- data/lib/crunchbase/models/ownership.rb +39 -0
- data/lib/crunchbase/models/principal.rb +112 -0
- data/lib/crunchbase/searches/client.rb +57 -6
- data/lib/crunchbase/utilities/autocomplete.rb +51 -0
- data/lib/crunchbase/utilities/cb_model.rb +32 -0
- data/lib/crunchbase/utilities/deleted_entities.rb +47 -0
- data/lib/crunchbase/utilities/entity_endpoints.rb +125 -0
- data/lib/crunchbase/utilities/request.rb +47 -8
- data/lib/crunchbase/utilities/response.rb +33 -12
- data/lib/crunchbase/utilities/search_endpoints.rb +46 -0
- data/lib/crunchbase/utilities/search_query_parameters.rb +64 -0
- data/lib/crunchbase/utilities/veriables.rb +335 -0
- data/lib/crunchbase/version.rb +1 -1
- metadata +45 -12
- data/lib/crunchbase/models/entity.rb +0 -28
- data/lib/crunchbase/searches/organization.rb +0 -52
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crunchbase
|
4
|
+
# Get the Entities data from API
|
5
|
+
module Models
|
6
|
+
# Get the person data from API
|
7
|
+
class Address < Entity
|
8
|
+
RESOURCE_LIST = 'addresses'
|
9
|
+
|
10
|
+
def field_ids
|
11
|
+
%w[
|
12
|
+
created_at
|
13
|
+
entity_def_id
|
14
|
+
updated_at
|
15
|
+
] + basis_fields
|
16
|
+
end
|
17
|
+
|
18
|
+
def basis_fields
|
19
|
+
%w[
|
20
|
+
uuid
|
21
|
+
name
|
22
|
+
postal_code
|
23
|
+
street_1
|
24
|
+
street_2
|
25
|
+
identifier
|
26
|
+
location_identifiers
|
27
|
+
]
|
28
|
+
end
|
29
|
+
|
30
|
+
def full_cards
|
31
|
+
%w[
|
32
|
+
]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crunchbase
|
4
|
+
# Get the Entities data from API
|
5
|
+
module Models
|
6
|
+
# For AutocompleteEntity
|
7
|
+
class AutocompleteEntity < Entity
|
8
|
+
def field_ids
|
9
|
+
basis_fields
|
10
|
+
end
|
11
|
+
|
12
|
+
def basis_fields
|
13
|
+
%w[
|
14
|
+
identifier
|
15
|
+
facet_ids
|
16
|
+
short_description
|
17
|
+
]
|
18
|
+
end
|
19
|
+
|
20
|
+
def parse_response(response)
|
21
|
+
dynamic_attributes(self, field_ids, response)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../utilities/response'
|
4
|
+
require_relative './mappings'
|
5
|
+
|
6
|
+
module Crunchbase
|
7
|
+
# Get the Organization data from API
|
8
|
+
module Models
|
9
|
+
# Root
|
10
|
+
class Entity
|
11
|
+
include ::Crunchbase::Utilities::Response
|
12
|
+
include Mappings
|
13
|
+
|
14
|
+
def fields
|
15
|
+
field_ids.map(&:to_sym)
|
16
|
+
end
|
17
|
+
|
18
|
+
def parse_response(response, request_field_ids = [], cards = [])
|
19
|
+
extract_fields = (request_field_ids.empty? ? field_ids : request_field_ids)
|
20
|
+
|
21
|
+
dynamic_attributes(self, extract_fields, response.dig('properties'))
|
22
|
+
setup_relationships(self, cards, response.dig('cards'))
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
def setup_relationships(object, request_card_ids, response_cards)
|
27
|
+
request_card_ids.each do |card_id|
|
28
|
+
card_data = response_cards.dig(card_id)
|
29
|
+
card_model = model_mappings[card_id]
|
30
|
+
card_objects = if card_data.is_a?(Array)
|
31
|
+
card_data.each_with_object([]) do |data, objects|
|
32
|
+
new_card_instance = card_model.new
|
33
|
+
objects << dynamic_attributes(new_card_instance, new_card_instance.basis_fields, data)
|
34
|
+
end
|
35
|
+
else
|
36
|
+
card_data.nil? ? nil : dynamic_attributes(card_model.new, extract_fields, data)
|
37
|
+
end
|
38
|
+
|
39
|
+
dynamic_define_method(object, card_id, card_objects)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def as_json
|
44
|
+
fields.each_with_object({}) { |item, hash| hash[item] = send(item) }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crunchbase
|
4
|
+
# Get the Organization data from API
|
5
|
+
module Models
|
6
|
+
# Build card mappings
|
7
|
+
module Mappings
|
8
|
+
def model_mappings
|
9
|
+
{
|
10
|
+
'investments' => Investment,
|
11
|
+
'raised_investments' => Investment,
|
12
|
+
'participated_investments' => Investment,
|
13
|
+
'participated_funds' => Fund,
|
14
|
+
'raised_funds' => Fund,
|
15
|
+
'child_organizations' => Organization,
|
16
|
+
'parent_organization' => Organization,
|
17
|
+
'investors' => Principal,
|
18
|
+
'raised_funding_rounds' => FundingRound,
|
19
|
+
'participated_funding_rounds' => FundingRound,
|
20
|
+
'ipos' => Ipo,
|
21
|
+
'event_appearances' => EventAppearance,
|
22
|
+
'acquiree_acquisitions' => Acquisition,
|
23
|
+
'parent_ownership' => Ownership,
|
24
|
+
'child_ownerships' => Ownership,
|
25
|
+
'jobs' => Job,
|
26
|
+
'founders' => Person,
|
27
|
+
'press_references' => PressReference,
|
28
|
+
'headquarters_address' => Address
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def card_num_field(card_id)
|
33
|
+
field_ids & ["num_#{card_id}"]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crunchbase
|
4
|
+
# Get the Entities data from API
|
5
|
+
module Models
|
6
|
+
# For AutocompleteEntity
|
7
|
+
class DeletedEntity < Entity
|
8
|
+
def field_ids
|
9
|
+
basis_fields
|
10
|
+
end
|
11
|
+
|
12
|
+
def basis_fields
|
13
|
+
%w[
|
14
|
+
uuid
|
15
|
+
entity_def_id
|
16
|
+
deleted_at
|
17
|
+
identifier
|
18
|
+
]
|
19
|
+
end
|
20
|
+
|
21
|
+
def parse_response(response)
|
22
|
+
dynamic_attributes(self, field_ids, response)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
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 EventAppearances data from API
|
7
|
+
class EventAppearance < Entity
|
8
|
+
RESOURCE_LIST = 'event_appearances'
|
9
|
+
|
10
|
+
def field_ids
|
11
|
+
%w[
|
12
|
+
created_at
|
13
|
+
updated_at
|
14
|
+
entity_def_id
|
15
|
+
event_identifier
|
16
|
+
event_location_identifiers
|
17
|
+
participant_identifier
|
18
|
+
] + basis_fields
|
19
|
+
end
|
20
|
+
|
21
|
+
def basis_fields
|
22
|
+
%w[
|
23
|
+
appearance_type
|
24
|
+
identifier
|
25
|
+
name
|
26
|
+
permalink
|
27
|
+
short_description
|
28
|
+
event_starts_on
|
29
|
+
uuid
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
33
|
+
def full_cards
|
34
|
+
%w[
|
35
|
+
]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crunchbase
|
4
|
+
# Get the Entities data from API
|
5
|
+
module Models
|
6
|
+
# Get the Fund data from API
|
7
|
+
class Fund < Entity
|
8
|
+
RESOURCE_LIST = 'funds'
|
9
|
+
|
10
|
+
def field_ids
|
11
|
+
%w[
|
12
|
+
created_at
|
13
|
+
entity_def_id
|
14
|
+
image_id
|
15
|
+
investor_identifiers
|
16
|
+
num_investors
|
17
|
+
owner_identifier
|
18
|
+
short_description
|
19
|
+
started_on
|
20
|
+
updated_at
|
21
|
+
] + basis_fields
|
22
|
+
end
|
23
|
+
|
24
|
+
def basis_fields
|
25
|
+
%w[
|
26
|
+
uuid
|
27
|
+
name
|
28
|
+
announced_on
|
29
|
+
money_raised
|
30
|
+
permalink
|
31
|
+
]
|
32
|
+
end
|
33
|
+
|
34
|
+
def full_cards
|
35
|
+
%w[
|
36
|
+
investors
|
37
|
+
owner
|
38
|
+
press_references
|
39
|
+
]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -25,7 +25,6 @@ module Crunchbase
|
|
25
25
|
lead_investor_identifiers
|
26
26
|
num_partners
|
27
27
|
num_relationships
|
28
|
-
permalink
|
29
28
|
pre_money_valuation
|
30
29
|
rank
|
31
30
|
rank_funding_round
|
@@ -37,6 +36,7 @@ module Crunchbase
|
|
37
36
|
%w[
|
38
37
|
uuid
|
39
38
|
name
|
39
|
+
permalink
|
40
40
|
announced_on
|
41
41
|
closed_on
|
42
42
|
investment_stage
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Crunchbase
|
4
|
+
# Get the Entities data from API
|
5
|
+
module Models
|
6
|
+
# Get the person data from API
|
7
|
+
class Ipo < Entity
|
8
|
+
RESOURCE_LIST = 'ipos'
|
9
|
+
|
10
|
+
def field_ids
|
11
|
+
%w[
|
12
|
+
created_at
|
13
|
+
entity_def_id
|
14
|
+
image_id
|
15
|
+
rank
|
16
|
+
rank_ipo
|
17
|
+
shares_outstanding
|
18
|
+
shares_sold
|
19
|
+
stock_exchange_symbol
|
20
|
+
stock_full_symbol
|
21
|
+
updated_at
|
22
|
+
] + basis_fields
|
23
|
+
end
|
24
|
+
|
25
|
+
def basis_fields
|
26
|
+
%w[
|
27
|
+
uuid
|
28
|
+
permalink
|
29
|
+
identifier
|
30
|
+
amount_raised
|
31
|
+
share_price
|
32
|
+
stock_symbol
|
33
|
+
valuation
|
34
|
+
delisted_on
|
35
|
+
went_public_on
|
36
|
+
short_description
|
37
|
+
]
|
38
|
+
end
|
39
|
+
|
40
|
+
def full_cards
|
41
|
+
%w[
|
42
|
+
organization
|
43
|
+
press_references
|
44
|
+
]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -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
|
@@ -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
|