crunchbase4 0.1.5 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +25 -7
- data/Gemfile.lock +33 -7
- data/README.md +103 -7
- data/crunchbase4.gemspec +1 -0
- data/lib/crunchbase/client.rb +2 -0
- data/lib/crunchbase/config.rb +1 -1
- data/lib/crunchbase/downloads/client.rb +48 -0
- data/lib/crunchbase/downloads.rb +8 -0
- data/lib/crunchbase/models/concerns/entity.rb +8 -2
- data/lib/crunchbase/models/funding_round.rb +1 -0
- data/lib/crunchbase/models/organization.rb +10 -0
- data/lib/crunchbase/utilities/downloads.rb +15 -0
- data/lib/crunchbase/utilities/response.rb +23 -1
- data/lib/crunchbase/utilities/veriables.rb +1 -1
- data/lib/crunchbase/version.rb +1 -1
- data/lib/crunchbase.rb +4 -2
- metadata +22 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 847ef68e0f7d78cb3ebeb25145c2e52381ee855a68709a6e9aa5a1f0d05b6a5d
|
4
|
+
data.tar.gz: 6be09a238a9412692e782d7c4540181da32c429cb5ad27cf5b7ebc4756a24b71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f9f84bf20a0f27108fc6ec17533d82de74a538c87545cdee661d22138ca5e7002f85de42ffc448943fada30cac5ea2cd632afb237af835b44724647a6c985e8
|
7
|
+
data.tar.gz: 76d2e72a670c8c35978e225604ee7b759e9910004f8d92bbf61c0ef86d563dc095a225ba5dafd4f2793c823108c96cfbeb3a0b61350c9f2380315836ae107bec
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [0.1.9] - 2021-10-04
|
4
|
+
|
5
|
+
### Allow to export Daily CSV bulk
|
6
|
+
- Implement new API to export daily CSV bulk. related document https://data.crunchbase.com/docs/daily-csv-export
|
7
|
+
- download_bulk: (`client.download_bulk(dir, extract: true)`)
|
8
|
+
|
9
|
+
## [0.1.8] - 2021-02-23
|
10
|
+
|
11
|
+
### Add new fields on funding_rounds
|
12
|
+
- Adding diversity_spotlights and pre_money_valuation on raised_funding_rounds endpoint
|
13
|
+
|
14
|
+
## [0.1.7] - 2020-12-02
|
15
|
+
|
16
|
+
### Improve press_reference API response for activity_entities
|
17
|
+
- Returns relationship data for activity_entities
|
18
|
+
* Before returns all names for activity_entities
|
19
|
+
* After returns related organzation or person object
|
20
|
+
|
3
21
|
## [0.1.5] - 2020-06-26
|
4
22
|
|
5
23
|
### Refactoring
|
@@ -9,12 +27,12 @@
|
|
9
27
|
* After
|
10
28
|
- Get organzation's fund: (`client.organization(entity_id, card_id: 'fund')`)
|
11
29
|
- Method for uniformly obtaining deleted entities data and support more query condition
|
12
|
-
* Get deleted
|
13
|
-
- Before: (`client.
|
30
|
+
* Get deleted organizations
|
31
|
+
- Before: (`client.deleted_organizations`)
|
14
32
|
- After : (`client.deleted_entities(collection_ids: 'organizations', limit: 20)`)
|
15
33
|
- Method for uniformly obtaining autocompletes entities data and support more query condition
|
16
|
-
* Get autocompletes
|
17
|
-
- Before: (`client.
|
34
|
+
* Get autocompletes organizations
|
35
|
+
- Before: (`client.autocomplete_organizations`)
|
18
36
|
- After : (`client.autocomplete('ekohe', collection_ids: 'organizations', limit: 3)`)
|
19
37
|
|
20
38
|
## [0.1.4] - 2020-06-12
|
@@ -38,11 +56,11 @@
|
|
38
56
|
|
39
57
|
### Added
|
40
58
|
- Implemented searches APIs to get the recent updates entities on Search
|
41
|
-
-
|
59
|
+
- organizations
|
42
60
|
- people
|
43
61
|
- funding rounds
|
44
62
|
- Implemented `autocompletes` API to allow user filter entities by keyword
|
45
|
-
-
|
63
|
+
- organizations
|
46
64
|
- people
|
47
65
|
- funding rounds
|
48
66
|
|
@@ -50,7 +68,7 @@
|
|
50
68
|
|
51
69
|
### Added
|
52
70
|
- Implemented APIs to get acquisition and investment of Entity
|
53
|
-
- Implemented APIs to search
|
71
|
+
- Implemented APIs to search organizations and funding rounds of Search
|
54
72
|
|
55
73
|
### Changed
|
56
74
|
- Refactor the API client to support search API
|
data/Gemfile.lock
CHANGED
@@ -1,29 +1,54 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
crunchbase4 (0.1.
|
4
|
+
crunchbase4 (0.1.8)
|
5
5
|
faraday
|
6
6
|
faraday_curl
|
7
7
|
faraday_middleware
|
8
|
+
httparty
|
8
9
|
|
9
10
|
GEM
|
10
11
|
remote: https://rubygems.org/
|
11
12
|
specs:
|
12
|
-
addressable (2.
|
13
|
+
addressable (2.8.0)
|
13
14
|
public_suffix (>= 2.0.2, < 5.0)
|
14
15
|
ast (2.4.0)
|
15
16
|
coderay (1.1.3)
|
16
17
|
crack (0.4.3)
|
17
18
|
safe_yaml (~> 1.0.0)
|
18
19
|
diff-lcs (1.3)
|
19
|
-
faraday (1.0
|
20
|
+
faraday (1.8.0)
|
21
|
+
faraday-em_http (~> 1.0)
|
22
|
+
faraday-em_synchrony (~> 1.0)
|
23
|
+
faraday-excon (~> 1.1)
|
24
|
+
faraday-httpclient (~> 1.0.1)
|
25
|
+
faraday-net_http (~> 1.0)
|
26
|
+
faraday-net_http_persistent (~> 1.1)
|
27
|
+
faraday-patron (~> 1.0)
|
28
|
+
faraday-rack (~> 1.0)
|
20
29
|
multipart-post (>= 1.2, < 3)
|
30
|
+
ruby2_keywords (>= 0.0.4)
|
31
|
+
faraday-em_http (1.0.0)
|
32
|
+
faraday-em_synchrony (1.0.0)
|
33
|
+
faraday-excon (1.1.0)
|
34
|
+
faraday-httpclient (1.0.1)
|
35
|
+
faraday-net_http (1.0.1)
|
36
|
+
faraday-net_http_persistent (1.2.0)
|
37
|
+
faraday-patron (1.0.0)
|
38
|
+
faraday-rack (1.0.0)
|
21
39
|
faraday_curl (0.0.2)
|
22
40
|
faraday (>= 0.9.0)
|
23
|
-
faraday_middleware (1.
|
41
|
+
faraday_middleware (1.1.0)
|
24
42
|
faraday (~> 1.0)
|
25
43
|
hashdiff (1.0.1)
|
44
|
+
httparty (0.20.0)
|
45
|
+
mime-types (~> 3.0)
|
46
|
+
multi_xml (>= 0.5.2)
|
26
47
|
method_source (1.0.0)
|
48
|
+
mime-types (3.3.1)
|
49
|
+
mime-types-data (~> 3.2015)
|
50
|
+
mime-types-data (3.2021.0901)
|
51
|
+
multi_xml (0.6.0)
|
27
52
|
multipart-post (2.1.1)
|
28
53
|
parallel (1.19.1)
|
29
54
|
parser (2.7.1.3)
|
@@ -31,11 +56,11 @@ GEM
|
|
31
56
|
pry (0.13.1)
|
32
57
|
coderay (~> 1.1)
|
33
58
|
method_source (~> 1.0)
|
34
|
-
public_suffix (4.0.
|
59
|
+
public_suffix (4.0.6)
|
35
60
|
rainbow (3.0.0)
|
36
61
|
rake (12.3.3)
|
37
62
|
regexp_parser (1.7.0)
|
38
|
-
rexml (3.2.
|
63
|
+
rexml (3.2.5)
|
39
64
|
rspec (3.9.0)
|
40
65
|
rspec-core (~> 3.9.0)
|
41
66
|
rspec-expectations (~> 3.9.0)
|
@@ -61,6 +86,7 @@ GEM
|
|
61
86
|
rubocop-ast (0.0.3)
|
62
87
|
parser (>= 2.7.0.1)
|
63
88
|
ruby-progressbar (1.10.1)
|
89
|
+
ruby2_keywords (0.0.5)
|
64
90
|
safe_yaml (1.0.5)
|
65
91
|
unicode-display_width (1.7.0)
|
66
92
|
vcr (6.0.0)
|
@@ -82,4 +108,4 @@ DEPENDENCIES
|
|
82
108
|
webmock
|
83
109
|
|
84
110
|
BUNDLED WITH
|
85
|
-
2.
|
111
|
+
2.2.5
|
data/README.md
CHANGED
@@ -56,7 +56,7 @@ pry(main)> client = Crunchbase::Client.new
|
|
56
56
|
- [Deleted Entities](https://github.com/ekohe/crunchbase4#deleted-entities)
|
57
57
|
|
58
58
|
```ruby
|
59
|
-
<!--
|
59
|
+
<!-- Examples of organization and single card -->
|
60
60
|
response = client.organization('ekohe')
|
61
61
|
ipos = client.organization('ekohe', card_id: 'ipos')
|
62
62
|
fund = client.organization('ekohe', card_id: 'fund')
|
@@ -67,15 +67,25 @@ jobs = client.organization('ekohe', card_id: 'jobs')
|
|
67
67
|
headquarters_address = client.organization('ekohe', card_id: 'headquarters_address')
|
68
68
|
top_2_press_references = client.organization('ekohe', card_id: 'press_references', limit: 2)
|
69
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
|
+
|
70
80
|
response = client.person('mark-zuckerberg')
|
71
81
|
response = client.person('mark-zuckerberg', card_id: 'participated_investments')
|
72
|
-
response = client.funding_round('
|
73
|
-
response = client.funding_round('
|
82
|
+
response = client.funding_round('3cdfcecd-5377-439b-acab-cefcf6fe21a5')
|
83
|
+
response = client.funding_round('3cdfcecd-5377-439b-acab-cefcf6fe21a5', card_id: 'investors')
|
74
84
|
response = client.acquisition('7638eae9-07b7-4fc6-ad20-5d99de3ff928')
|
75
85
|
response = client.fund('aeaac12b-df56-7039-40f9-f1992f88e20e')
|
76
86
|
response = client.ownership('4506d9ce-85d3-4a8f-89cd-07a225359d55')
|
77
87
|
|
78
|
-
<!-- Get the JSON response of
|
88
|
+
<!-- Get the JSON response of entity -->
|
79
89
|
|
80
90
|
response.as_json
|
81
91
|
|
@@ -242,12 +252,87 @@ pry(main)> response.acquiree_funding_total
|
|
242
252
|
|
243
253
|
```ruby
|
244
254
|
pry(main)> response = client.press_reference('0171b30e-9cf8-4ad5-8288-2993e4308e0f')
|
245
|
-
=> #<Crunchbase::Models::PressReference:
|
246
|
-
@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>],
|
247
332
|
@author=nil,
|
248
333
|
@created_at="2020-06-05T17:41:10Z",
|
249
334
|
@entity_def_id="press_reference",
|
250
|
-
@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"],
|
251
336
|
@posted_on="2020-06-05",
|
252
337
|
@publisher="Tech in Asia",
|
253
338
|
@thumbnail_url="https://cdn.techinasia.com/wp-content/uploads/2016/07/Flickr_-_World_Economic_Forum_-_Ambani.jpg",
|
@@ -626,6 +711,17 @@ pry(main)> response = client.deleted_entities(collection_ids: 'people')
|
|
626
711
|
pry(main)> response = client.deleted_entities(collection_ids: 'funding_rounds')
|
627
712
|
```
|
628
713
|
|
714
|
+
### Daily CSV Export
|
715
|
+
|
716
|
+
* https://api.crunchbase.com/bulk/v4/bulk_export.tar.gz?user_key=user_key
|
717
|
+
|
718
|
+
|
719
|
+
```ruby
|
720
|
+
pry(main)> response = client.download_bulk(dir, extract: true)
|
721
|
+
```
|
722
|
+
|
723
|
+
After running the download operation, you will see `bulk_export.tar.gz` in your provided folder.
|
724
|
+
|
629
725
|
## Development
|
630
726
|
|
631
727
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/crunchbase4.gemspec
CHANGED
data/lib/crunchbase/client.rb
CHANGED
@@ -4,6 +4,7 @@ require_relative 'utilities/entity_endpoints'
|
|
4
4
|
require_relative 'utilities/search_endpoints'
|
5
5
|
require_relative 'utilities/autocomplete'
|
6
6
|
require_relative 'utilities/deleted_entities'
|
7
|
+
require_relative 'utilities/downloads'
|
7
8
|
|
8
9
|
module Crunchbase
|
9
10
|
# API Request
|
@@ -12,5 +13,6 @@ module Crunchbase
|
|
12
13
|
include Utilities::SearchEndpoints
|
13
14
|
include Utilities::Autocomplete
|
14
15
|
include Utilities::DeletedEntities
|
16
|
+
include Utilities::Downloads
|
15
17
|
end
|
16
18
|
end
|
data/lib/crunchbase/config.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'httparty'
|
4
|
+
|
5
|
+
module Crunchbase
|
6
|
+
# Zip file downloads endpoints
|
7
|
+
module Downloads
|
8
|
+
# using Crunchbase's downloads API endpoints
|
9
|
+
class Client
|
10
|
+
include HTTParty
|
11
|
+
# Will spit out all request details to the console
|
12
|
+
debug_output $stdout
|
13
|
+
|
14
|
+
def download_bulk(dir, extract: false)
|
15
|
+
FileUtils.mkdir_p(dir) unless Dir.exist?(dir)
|
16
|
+
dist_path = Pathname.new(dir).join File.basename(bulk_url)
|
17
|
+
|
18
|
+
download(bulk_url, dist_path) unless File.exist?(dist_path)
|
19
|
+
system "tar xfz #{dist_path} -C #{dir}" if extract
|
20
|
+
|
21
|
+
dist_path
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def bulk_url
|
27
|
+
Crunchbase.config.bulk_url || [API_DOMAIN, "/bulk/#{API_VERSION}/bulk_export.tar.gz"].join
|
28
|
+
end
|
29
|
+
|
30
|
+
def download(url, dist_path)
|
31
|
+
File.open(dist_path, 'w') do |file|
|
32
|
+
file.binmode
|
33
|
+
request(url, stream_body: true) do |buffer|
|
34
|
+
file.write(buffer)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def request(url, options = {}, &block)
|
40
|
+
default_options = { query: { user_key: Crunchbase.config.user_key } }
|
41
|
+
options.merge!(default_options)
|
42
|
+
|
43
|
+
response = self.class.get(url, options, &block)
|
44
|
+
response.content_type.match?(/json/) ? JSON.parse(response.body) : response
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -12,7 +12,7 @@ module Crunchbase
|
|
12
12
|
include Mappings
|
13
13
|
|
14
14
|
def fields
|
15
|
-
field_ids.map(&:to_sym)
|
15
|
+
field_ids.concat(custom_fields).map(&:to_sym)
|
16
16
|
end
|
17
17
|
|
18
18
|
def parse_response(response, request_field_ids = [], cards = [])
|
@@ -30,7 +30,7 @@ module Crunchbase
|
|
30
30
|
card_objects = if card_data.is_a?(Array)
|
31
31
|
card_data.each_with_object([]) do |data, objects|
|
32
32
|
new_card_instance = card_model.new
|
33
|
-
objects << dynamic_attributes(new_card_instance, new_card_instance.
|
33
|
+
objects << dynamic_attributes(new_card_instance, new_card_instance.field_ids, data)
|
34
34
|
end
|
35
35
|
else
|
36
36
|
card_data.nil? ? nil : dynamic_attributes(card_model.new, extract_fields, data)
|
@@ -43,6 +43,12 @@ module Crunchbase
|
|
43
43
|
def as_json
|
44
44
|
fields.each_with_object({}) { |item, hash| hash[item] = send(item) }
|
45
45
|
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def custom_fields
|
50
|
+
[]
|
51
|
+
end
|
46
52
|
end
|
47
53
|
end
|
48
54
|
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,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../downloads/client'
|
4
|
+
|
5
|
+
module Crunchbase
|
6
|
+
# Utilities
|
7
|
+
module Utilities
|
8
|
+
# Daily csv export
|
9
|
+
module Downloads
|
10
|
+
def download_bulk(dir, extract: false)
|
11
|
+
Crunchbase::Downloads::Client.new.download_bulk(dir, extract: extract)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -52,15 +52,37 @@ module Crunchbase
|
|
52
52
|
%w[identifier]
|
53
53
|
end
|
54
54
|
|
55
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
55
56
|
def field_value(name, data)
|
56
57
|
value = data.dig(name)
|
57
58
|
|
58
59
|
return value if value.nil? || value.is_a?(String)
|
59
|
-
return value
|
60
|
+
return parse_items(value, name) if value.is_a?(Array) && value[0].is_a?(Hash) && value[0].keys.include?('value')
|
61
|
+
return value.dig('value_usd') if value.is_a?(Hash) && value.keys.include?('value_usd')
|
60
62
|
return value.dig('value') if value.is_a?(Hash) && value.keys.include?('value')
|
61
63
|
|
62
64
|
value
|
63
65
|
end
|
66
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
67
|
+
|
68
|
+
def parse_items(items, field_name)
|
69
|
+
return items.collect { |e| e.dig('value') } unless field_name == 'activity_entities'
|
70
|
+
|
71
|
+
# Sepcial case for activity_entities
|
72
|
+
items.each_with_object([]) do |item, objects|
|
73
|
+
card_model = case item['entity_def_id']
|
74
|
+
when 'person' then ::Crunchbase::Models::Person
|
75
|
+
when 'organization' then ::Crunchbase::Models::Organization
|
76
|
+
end
|
77
|
+
# Alias: value is name
|
78
|
+
item['name'] ||= item['value']
|
79
|
+
|
80
|
+
next if card_model.nil?
|
81
|
+
|
82
|
+
new_card_instance = card_model.new
|
83
|
+
objects << dynamic_attributes(new_card_instance, new_card_instance.basis_fields, item)
|
84
|
+
end
|
85
|
+
end
|
64
86
|
end
|
65
87
|
end
|
66
88
|
end
|
@@ -142,7 +142,7 @@ module Crunchbase
|
|
142
142
|
'online_and_on_campus' => 'Online and On Campus'
|
143
143
|
}.freeze
|
144
144
|
|
145
|
-
|
145
|
+
SCHOOL_PROGRAMS = {
|
146
146
|
'bootcamp' => 'Bootcamp',
|
147
147
|
'community_college' => 'Community College',
|
148
148
|
'four_year_university' => 'Four Year University',
|
data/lib/crunchbase/version.rb
CHANGED
data/lib/crunchbase.rb
CHANGED
@@ -7,17 +7,19 @@ require 'crunchbase/client'
|
|
7
7
|
require 'crunchbase/models'
|
8
8
|
require 'crunchbase/entities'
|
9
9
|
require 'crunchbase/searches'
|
10
|
+
require 'crunchbase/downloads'
|
10
11
|
require 'crunchbase/utilities/veriables'
|
11
12
|
|
12
13
|
# CB v4
|
13
14
|
module Crunchbase
|
14
15
|
API_VERSION = 'v4'
|
15
|
-
|
16
|
+
API_DOMAIN = 'https://api.crunchbase.com'
|
17
|
+
BASE_URI = "#{API_DOMAIN}/api/#{API_VERSION}/"
|
16
18
|
|
17
19
|
# Defined Veriables for the data Category or Types
|
18
20
|
#
|
19
21
|
# Crunchbase::Utils.constants => [
|
20
|
-
#
|
22
|
+
# :OPERATING_STATUS,
|
21
23
|
# :PROGRAM_TYPES,
|
22
24
|
# :REVENUE_RANGES,
|
23
25
|
# :COMPANY_TYPES,
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Encore Shao
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: httparty
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: vcr
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +150,8 @@ files:
|
|
136
150
|
- lib/crunchbase/client.rb
|
137
151
|
- lib/crunchbase/config.rb
|
138
152
|
- lib/crunchbase/deleted_entities/client.rb
|
153
|
+
- lib/crunchbase/downloads.rb
|
154
|
+
- lib/crunchbase/downloads/client.rb
|
139
155
|
- lib/crunchbase/entities.rb
|
140
156
|
- lib/crunchbase/entities/client.rb
|
141
157
|
- lib/crunchbase/errors.rb
|
@@ -165,6 +181,7 @@ files:
|
|
165
181
|
- lib/crunchbase/utilities/autocomplete.rb
|
166
182
|
- lib/crunchbase/utilities/cb_model.rb
|
167
183
|
- lib/crunchbase/utilities/deleted_entities.rb
|
184
|
+
- lib/crunchbase/utilities/downloads.rb
|
168
185
|
- lib/crunchbase/utilities/entity_endpoints.rb
|
169
186
|
- lib/crunchbase/utilities/request.rb
|
170
187
|
- lib/crunchbase/utilities/response.rb
|
@@ -195,8 +212,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
212
|
- !ruby/object:Gem::Version
|
196
213
|
version: '0'
|
197
214
|
requirements: []
|
198
|
-
rubygems_version: 3.
|
199
|
-
signing_key:
|
215
|
+
rubygems_version: 3.1.6
|
216
|
+
signing_key:
|
200
217
|
specification_version: 4
|
201
218
|
summary: Crunchbase is a ruby wrapper base on Crunchbase V4 API
|
202
219
|
test_files: []
|