google_knowledge_graph 0.1.0 → 0.1.1

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: e1d72961ddce5869648605bc27111604c38fc610a14bdf3e951813e5461a542c
4
- data.tar.gz: b7a68aeb13bb398c736c0e70f34b777aed0d7fffe4a41955c44450f174273c7c
3
+ metadata.gz: 187c459e16ebf011ce0ef0bd3239f57bc8ea1458e8128323d19ae8eb9dfa2f16
4
+ data.tar.gz: cd7239959bff0458565d557589d27d8a3cae2abe3d91dfbb372e54987a984216
5
5
  SHA512:
6
- metadata.gz: 2d8b790aa84d29eb1d4e934536d0d0ae178e6b14982d21f6b29f4091cd3409faf876ed552120e77da9ac7c6683e1970d5fa59bba5eb0411ae2774b0b33124036
7
- data.tar.gz: 59519faabfd2572d89bc842aecc1ed1cb4f635f3411cd2dbc4ad9af0e9d157ecfa8445ba780b10223b1db60388c1a9442d358e99992073d11fa99494b22e3e2b
6
+ metadata.gz: a1dd436cb5b5812cdb8459fb9b222917c324748c80d1e2234db7c9520fecbbb5c04157be25f31c8448a16c8b4f222d3cae3ad7c970d552e34d738cd6698ca9dd
7
+ data.tar.gz: 935777b5942a356685d9683abf6971dc021ad3b4ea35c117ab133aef2a73f19239611ade671ddb4ae9128d13bd731c782788033692bf9f7d4397fc25f978325a
@@ -0,0 +1 @@
1
+ /coverage/
@@ -9,9 +9,14 @@ GEM
9
9
  specs:
10
10
  addressable (2.7.0)
11
11
  public_suffix (>= 2.0.2, < 5.0)
12
+ codecov (0.1.16)
13
+ json
14
+ simplecov
15
+ url
12
16
  crack (0.4.3)
13
17
  safe_yaml (~> 1.0.0)
14
18
  diff-lcs (1.3)
19
+ docile (1.3.2)
15
20
  domain_name (0.5.20190701)
16
21
  unf (>= 0.0.5, < 1.0.0)
17
22
  ffi (1.12.2)
@@ -29,6 +34,7 @@ GEM
29
34
  http-form_data (2.3.0)
30
35
  http-parser (1.2.1)
31
36
  ffi-compiler (>= 1.0, < 2.0)
37
+ json (2.3.0)
32
38
  public_suffix (4.0.5)
33
39
  rake (13.0.1)
34
40
  rspec (3.9.0)
@@ -45,9 +51,14 @@ GEM
45
51
  rspec-support (~> 3.9.0)
46
52
  rspec-support (3.9.3)
47
53
  safe_yaml (1.0.5)
54
+ simplecov (0.18.5)
55
+ docile (~> 1.1)
56
+ simplecov-html (~> 0.11)
57
+ simplecov-html (0.12.2)
48
58
  unf (0.1.4)
49
59
  unf_ext
50
60
  unf_ext (0.0.7.7)
61
+ url (0.3.2)
51
62
  webmock (3.8.3)
52
63
  addressable (>= 2.3.6)
53
64
  crack (>= 0.3.2)
@@ -57,8 +68,10 @@ PLATFORMS
57
68
  ruby
58
69
 
59
70
  DEPENDENCIES
71
+ codecov
60
72
  google_knowledge_graph!
61
73
  rspec (~> 3.0)
74
+ simplecov (~> 0.18)
62
75
  webmock (~> 3.0)
63
76
 
64
77
  BUNDLED WITH
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # google knowledge graph client
2
2
 
3
+ ![Gem](https://img.shields.io/gem/v/google_knowledge_graph)
4
+ ![Codecov](https://img.shields.io/codecov/c/github/ref-wiki/google_knowledge_graph)
5
+
3
6
  A ruby client for Google's knowledge graph to:
4
7
  - getting a knowledge entity by id
5
8
  - searching entities, while set limits by types, languages, and score
@@ -16,6 +16,8 @@ Gem::Specification.new do |s|
16
16
 
17
17
  s.add_development_dependency 'rspec', '~> 3.0'
18
18
  s.add_development_dependency 'webmock', '~> 3.0'
19
+ s.add_development_dependency 'simplecov', '~> 0.18'
20
+ s.add_development_dependency 'codecov'
19
21
 
20
22
  s.add_runtime_dependency 'http', '~> 4.0'
21
23
  end
@@ -21,8 +21,9 @@ module GoogleKnowledgeGraph
21
21
  )
22
22
 
23
23
  return nil unless response.status.success?
24
+ return nil unless data = JSON.parse(response.body).dig('itemListElement', 0, 'result')
24
25
 
25
- Entity.new(response.body)
26
+ Entity.new(data)
26
27
  end
27
28
 
28
29
  def search query, types: []
@@ -1,3 +1,3 @@
1
1
  module GoogleKnowledgeGraph
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -42,7 +42,9 @@ describe GoogleKnowledgeGraph do
42
42
  stub_request(:get, 'https://kgsearch.googleapis.com/v1/entities:search?ids=/m/05pbsry&key=foo&limit=1')
43
43
  .to_return(status: 200, body: File.read('spec/fixtures/getting_entity.json'))
44
44
 
45
- expect(GoogleKnowledgeGraph.get '/m/05pbsry').to be_a GoogleKnowledgeGraph::Entity
45
+ entity = GoogleKnowledgeGraph.get '/m/05pbsry'
46
+ expect(entity).to be_a GoogleKnowledgeGraph::Entity
47
+ expect(entity.name).to eq 'Community'
46
48
  end
47
49
 
48
50
  it 'returns nil for bad request' do
@@ -1,3 +1,9 @@
1
+ require 'simplecov'
2
+ SimpleCov.start
3
+
4
+ require 'codecov'
5
+ SimpleCov.formatter = SimpleCov::Formatter::Codecov
6
+
1
7
  require 'bundler/setup'
2
8
  Bundler.setup
3
9
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_knowledge_graph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nami WANG
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: simplecov
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.18'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.18'
55
+ - !ruby/object:Gem::Dependency
56
+ name: codecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: http
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -58,6 +86,7 @@ executables: []
58
86
  extensions: []
59
87
  extra_rdoc_files: []
60
88
  files:
89
+ - ".gitignore"
61
90
  - ".rspec"
62
91
  - Gemfile
63
92
  - Gemfile.lock