crunchbase4 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +9 -4
- data/lib/crunchbase/utilities/request.rb +8 -4
- data/lib/crunchbase/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d55577caf7591f6f9da599815b133401620f51137d303e9f1d56ca1a37554a30
|
4
|
+
data.tar.gz: e0b0a754d0060dd9d3f566ce3cea3f6120c3bec2c3fd9dd490d6d6c1dfdaa04c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 740e35d9fabbf05e930aa6a3a663143b0dee43d77ccb29b2845d79836ee2891a5b9eb4a360ba03dd2087afaea6525cafefe8beb0ed299d17d375be0eddab285f
|
7
|
+
data.tar.gz: ca15245080f46ca75779e1b694842a206a1ece5107b31b9a937a5e3ae049ff0247cf74b5e390c13290b9360ab1a4678832a7f36cb3dbe07ed1cb31d67098c7c2
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
crunchbase4 (0.
|
4
|
+
crunchbase4 (0.2.0)
|
5
5
|
faraday
|
6
6
|
faraday_curl
|
7
7
|
faraday_middleware
|
@@ -38,7 +38,7 @@ GEM
|
|
38
38
|
faraday-rack (1.0.0)
|
39
39
|
faraday_curl (0.0.2)
|
40
40
|
faraday (>= 0.9.0)
|
41
|
-
faraday_middleware (1.
|
41
|
+
faraday_middleware (1.2.0)
|
42
42
|
faraday (~> 1.0)
|
43
43
|
hashdiff (1.0.1)
|
44
44
|
httparty (0.20.0)
|
data/README.md
CHANGED
@@ -26,13 +26,18 @@ Or install it yourself as:
|
|
26
26
|
#### Configure your certificate for API
|
27
27
|
|
28
28
|
```ruby
|
29
|
-
require '
|
29
|
+
require 'crunchbase'
|
30
30
|
|
31
|
-
|
32
|
-
Crunchbase.config.user_key =
|
33
|
-
Crunchbase.config.
|
31
|
+
config = YAML.load(File.read('spec/crunchbase.yml'))
|
32
|
+
Crunchbase.config.user_key = config['user_key']
|
33
|
+
Crunchbase.config.debug = config['debug'] || false # If you want to know the request information, can set the debug = true
|
34
34
|
```
|
35
35
|
|
36
|
+
#### If you want to use it in Rails Application, simple way to create a file `crunchbase.rb` in `config/initializers`
|
37
|
+
|
38
|
+
- and put the above info(https://github.com/ekohe/crunchbase4#configure-your-certificate-for-api) into the new file
|
39
|
+
|
40
|
+
|
36
41
|
## Usage
|
37
42
|
|
38
43
|
#### Class: `Client` for API
|
@@ -44,9 +44,11 @@ module Crunchbase
|
|
44
44
|
faraday.response :logger, ::Logger.new(STDOUT), bodies: true if debug_mode?
|
45
45
|
end.post(uri, args)
|
46
46
|
|
47
|
-
|
47
|
+
resp_body = response.body
|
48
|
+
resp_status = response.status
|
49
|
+
return resp_body if resp_status == 200
|
48
50
|
|
49
|
-
raise Error,
|
51
|
+
raise Error, resp_body.is_a?(Array) ? resp_body[0]['message'] : resp_body['error']
|
50
52
|
end
|
51
53
|
|
52
54
|
private
|
@@ -58,9 +60,11 @@ module Crunchbase
|
|
58
60
|
faraday.response :logger, ::Logger.new(STDOUT), bodies: true if debug_mode?
|
59
61
|
end.get(uri, *args)
|
60
62
|
|
61
|
-
|
63
|
+
resp_body = response.body
|
64
|
+
resp_status = response.status
|
65
|
+
return resp_body if resp_status == 200
|
62
66
|
|
63
|
-
raise Error,
|
67
|
+
raise Error, resp_body.is_a?(Array) ? resp_body[0]['message'] : resp_body['error']
|
64
68
|
end
|
65
69
|
|
66
70
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Encore Shao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -212,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
212
|
- !ruby/object:Gem::Version
|
213
213
|
version: '0'
|
214
214
|
requirements: []
|
215
|
-
rubygems_version: 3.
|
215
|
+
rubygems_version: 3.0.3
|
216
216
|
signing_key:
|
217
217
|
specification_version: 4
|
218
218
|
summary: Crunchbase is a ruby wrapper base on Crunchbase V4 API
|