google_knowledge_graph 0.1.1 → 0.1.2

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: 187c459e16ebf011ce0ef0bd3239f57bc8ea1458e8128323d19ae8eb9dfa2f16
4
- data.tar.gz: cd7239959bff0458565d557589d27d8a3cae2abe3d91dfbb372e54987a984216
3
+ metadata.gz: 395cceea434b8eaee945e0dcb74a4ce8b65765e48ebe4de83e09477a372dc008
4
+ data.tar.gz: 6b82808a3c5e77a23007f1300afdc5522833dab67b1d020a152eb9846542dc72
5
5
  SHA512:
6
- metadata.gz: a1dd436cb5b5812cdb8459fb9b222917c324748c80d1e2234db7c9520fecbbb5c04157be25f31c8448a16c8b4f222d3cae3ad7c970d552e34d738cd6698ca9dd
7
- data.tar.gz: 935777b5942a356685d9683abf6971dc021ad3b4ea35c117ab133aef2a73f19239611ade671ddb4ae9128d13bd731c782788033692bf9f7d4397fc25f978325a
6
+ metadata.gz: dcb1d821039f60aa855fdd200c616e0bbb0dd38941b1a68c36346ac31069d54c5d2262d612e6cf76d70f97ecfd81bf8cd73d8324db5a9b39059a5de1d272dd96
7
+ data.tar.gz: 047fdeb88587a14ab498f7de9a7ee6044f630e55137edf246c2558da676b7ccb6af8f7bbc385303ed9c821afadc7be887d2e0399fbfa77e0653dfc28e2e8906e
data/.gitignore CHANGED
@@ -1 +1,3 @@
1
1
  /coverage/
2
+
3
+ /Gemfile.lock
data/README.md CHANGED
@@ -33,11 +33,11 @@ GoogleKnowledgeGraph.api_key = 'foo'
33
33
 
34
34
  ### getting knowledge entity by id
35
35
 
36
- > google knowledge graph responses entity result with @id like `kg:/m/0dl567`,
37
- yet it expects id being `/m/0dl567` when querying the service
36
+ > Google knowledge graph responses entity result with @id like `kg:/m/0dl567`,
37
+ yet it expects id being `/m/0dl567` when querying the service. You may pass both into `get` and the prefix `kg:` will be automatically removed.
38
38
 
39
39
  ```
40
- entity = GoogleKnowledgeGraph.get '/m/05pbsry'
40
+ entity = GoogleKnowledgeGraph.get 'kg:/m/05pbsry'
41
41
 
42
42
  # the `data` field contains the original payload
43
43
  entity.data
@@ -12,7 +12,7 @@ module GoogleKnowledgeGraph
12
12
 
13
13
  def get id
14
14
  ensure_api_key!
15
- raise StandardError.new('InvalidIdStartingWithKG') if id.start_with? 'kg:'
15
+ id.delete_prefix! 'kg:'
16
16
 
17
17
  response = request(
18
18
  key: api_key,
@@ -1,3 +1,3 @@
1
1
  module GoogleKnowledgeGraph
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
@@ -32,17 +32,11 @@ describe GoogleKnowledgeGraph do
32
32
  }.to raise_error 'EmptyAPIKey'
33
33
  end
34
34
 
35
- it 'raise error for id starting with `kg:`' do
36
- expect {
37
- GoogleKnowledgeGraph.get 'kg:/m/05pbsry'
38
- }.to raise_error 'InvalidIdStartingWithKG'
39
- end
40
-
41
35
  it 'returns an entity' do
42
36
  stub_request(:get, 'https://kgsearch.googleapis.com/v1/entities:search?ids=/m/05pbsry&key=foo&limit=1')
43
37
  .to_return(status: 200, body: File.read('spec/fixtures/getting_entity.json'))
44
38
 
45
- entity = GoogleKnowledgeGraph.get '/m/05pbsry'
39
+ entity = GoogleKnowledgeGraph.get 'kg:/m/05pbsry'
46
40
  expect(entity).to be_a GoogleKnowledgeGraph::Entity
47
41
  expect(entity.name).to eq 'Community'
48
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_knowledge_graph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nami WANG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-01 00:00:00.000000000 Z
11
+ date: 2020-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -89,7 +89,6 @@ files:
89
89
  - ".gitignore"
90
90
  - ".rspec"
91
91
  - Gemfile
92
- - Gemfile.lock
93
92
  - README.md
94
93
  - google_knowledge_graph.gemspec
95
94
  - lib/google_knowledge_graph.rb
@@ -1,78 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- google_knowledge_graph (0.1.0)
5
- http (~> 4.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- addressable (2.7.0)
11
- public_suffix (>= 2.0.2, < 5.0)
12
- codecov (0.1.16)
13
- json
14
- simplecov
15
- url
16
- crack (0.4.3)
17
- safe_yaml (~> 1.0.0)
18
- diff-lcs (1.3)
19
- docile (1.3.2)
20
- domain_name (0.5.20190701)
21
- unf (>= 0.0.5, < 1.0.0)
22
- ffi (1.12.2)
23
- ffi-compiler (1.0.1)
24
- ffi (>= 1.0.0)
25
- rake
26
- hashdiff (1.0.1)
27
- http (4.4.1)
28
- addressable (~> 2.3)
29
- http-cookie (~> 1.0)
30
- http-form_data (~> 2.2)
31
- http-parser (~> 1.2.0)
32
- http-cookie (1.0.3)
33
- domain_name (~> 0.5)
34
- http-form_data (2.3.0)
35
- http-parser (1.2.1)
36
- ffi-compiler (>= 1.0, < 2.0)
37
- json (2.3.0)
38
- public_suffix (4.0.5)
39
- rake (13.0.1)
40
- rspec (3.9.0)
41
- rspec-core (~> 3.9.0)
42
- rspec-expectations (~> 3.9.0)
43
- rspec-mocks (~> 3.9.0)
44
- rspec-core (3.9.2)
45
- rspec-support (~> 3.9.3)
46
- rspec-expectations (3.9.2)
47
- diff-lcs (>= 1.2.0, < 2.0)
48
- rspec-support (~> 3.9.0)
49
- rspec-mocks (3.9.1)
50
- diff-lcs (>= 1.2.0, < 2.0)
51
- rspec-support (~> 3.9.0)
52
- rspec-support (3.9.3)
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)
58
- unf (0.1.4)
59
- unf_ext
60
- unf_ext (0.0.7.7)
61
- url (0.3.2)
62
- webmock (3.8.3)
63
- addressable (>= 2.3.6)
64
- crack (>= 0.3.2)
65
- hashdiff (>= 0.4.0, < 2.0.0)
66
-
67
- PLATFORMS
68
- ruby
69
-
70
- DEPENDENCIES
71
- codecov
72
- google_knowledge_graph!
73
- rspec (~> 3.0)
74
- simplecov (~> 0.18)
75
- webmock (~> 3.0)
76
-
77
- BUNDLED WITH
78
- 2.1.4