crunchbase4 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21f1d6c0bae981ebb5f54925d0db9a577c39e0e620bad32de9ba471cf4249545
4
- data.tar.gz: fff8a1bf44fd50e44eda6b099c9eaf1cf091ab1e259dcaee2bbd4c1c86779d0d
3
+ metadata.gz: 847ef68e0f7d78cb3ebeb25145c2e52381ee855a68709a6e9aa5a1f0d05b6a5d
4
+ data.tar.gz: 6be09a238a9412692e782d7c4540181da32c429cb5ad27cf5b7ebc4756a24b71
5
5
  SHA512:
6
- metadata.gz: b77c39ab92e4610365f65cded56e13100ee58deaf76247531c5983e1fdb5c22d744c6f3d71bb6745a3effd83baac722079e87da6ce367f5a9dd5d6c712dcd3bb
7
- data.tar.gz: 8d355c0fc87a2b70db8af8a02b0473f909a45573a2b3495a58c21a799465f92369892432db9c5e03dd2bb47a77b4f38b9955e144b1a50ee01659ee9ebee667eb
6
+ metadata.gz: 6f9f84bf20a0f27108fc6ec17533d82de74a538c87545cdee661d22138ca5e7002f85de42ffc448943fada30cac5ea2cd632afb237af835b44724647a6c985e8
7
+ data.tar.gz: 76d2e72a670c8c35978e225604ee7b759e9910004f8d92bbf61c0ef86d563dc095a225ba5dafd4f2793c823108c96cfbeb3a0b61350c9f2380315836ae107bec
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## [0.1.8] - 2021-02-23
4
10
 
5
11
  ### Add new fields on funding_rounds
data/Gemfile.lock CHANGED
@@ -1,29 +1,54 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- crunchbase4 (0.1.7)
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.7.0)
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.1)
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.0.0)
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.5)
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.4)
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.1.4
111
+ 2.2.5
data/README.md CHANGED
@@ -711,6 +711,17 @@ pry(main)> response = client.deleted_entities(collection_ids: 'people')
711
711
  pry(main)> response = client.deleted_entities(collection_ids: 'funding_rounds')
712
712
  ```
713
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
+
714
725
  ## Development
715
726
 
716
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
@@ -34,6 +34,7 @@ Gem::Specification.new do |spec|
34
34
  spec.add_dependency 'faraday'
35
35
  spec.add_dependency 'faraday_curl'
36
36
  spec.add_dependency 'faraday_middleware'
37
+ spec.add_dependency 'httparty'
37
38
 
38
39
  # VCR for testing APIs
39
40
  spec.add_development_dependency 'vcr'
@@ -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
@@ -7,7 +7,7 @@ module Crunchbase
7
7
  # Config
8
8
  class Config
9
9
  include Singleton
10
- attr_accessor :user_key, :debug
10
+ attr_accessor :user_key, :bulk_url, :debug
11
11
  end
12
12
 
13
13
  def self.config
@@ -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
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crunchbase
4
+ # Downloads
5
+ module Downloads
6
+ autoload :Client, 'crunchbase/downloads/client'
7
+ end
8
+ 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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Crunchbase
4
- VERSION = '0.1.8'
4
+ VERSION = '0.1.9'
5
5
  end
data/lib/crunchbase.rb CHANGED
@@ -7,12 +7,14 @@ 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
- BASE_URI = "https://api.crunchbase.com/api/#{API_VERSION}/"
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
  #
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.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Encore Shao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-23 00:00:00.000000000 Z
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,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
212
  - !ruby/object:Gem::Version
196
213
  version: '0'
197
214
  requirements: []
198
- rubygems_version: 3.1.2
215
+ rubygems_version: 3.1.6
199
216
  signing_key:
200
217
  specification_version: 4
201
218
  summary: Crunchbase is a ruby wrapper base on Crunchbase V4 API