wikidata-client 0.0.10 → 0.1.0.pre.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +4 -0
- data/README.md +2 -6
- data/lib/wikidata/client.rb +2 -2
- data/lib/wikidata/config.rb +5 -5
- data/lib/wikidata/entity.rb +32 -24
- data/lib/wikidata/property/base.rb +4 -3
- data/lib/wikidata/property/hash.rb +7 -0
- data/lib/wikidata/property/quantity.rb +18 -0
- data/lib/wikidata/property/time.rb +32 -25
- data/lib/wikidata/property.rb +5 -2
- data/lib/wikidata/version.rb +1 -1
- data/lib/wikidata.rb +6 -5
- data/spec/fixtures/vcr/Wikidata_Entity/properties/properties/Quantity_data_type/should_return_hard_coded_number_of_children.yml +311 -0
- data/spec/fixtures/vcr/Wikidata_Entity/properties/properties/keys_of_all_properties/can_get_a_list_of_all_property_keys.yml +114 -0
- data/spec/fixtures/vcr/Wikidata_Entity/properties/properties/name_of_a_property/can_get_the_name_of_a_property.yml +495 -0
- data/spec/spec_helper.rb +0 -3
- data/spec/wikidata/entity_spec.rb +18 -0
- data/spec/wikidata_spec.rb +4 -7
- metadata +40 -40
- data/.gitignore +0 -3
- data/.irbrc +0 -1
- data/.rspec +0 -2
- data/.travis.yml +0 -11
- data/Gemfile +0 -7
- data/Rakefile +0 -5
- data/wikidata-client.gemspec +0 -28
data/spec/spec_helper.rb
CHANGED
@@ -5,6 +5,7 @@ describe Wikidata::Entity, :vcr do
|
|
5
5
|
let(:homer) { Wikidata::Item.find_by_title 'Homer Simpson' }
|
6
6
|
let(:batofar) { Wikidata::Item.find_by_title 'Le Batofar' }
|
7
7
|
let(:github) { Wikidata::Item.find_by_title 'GitHub' }
|
8
|
+
let(:james) {Wikidata::Item.find_by_title 'James Joyce'}
|
8
9
|
|
9
10
|
describe 'properties' do
|
10
11
|
|
@@ -148,6 +149,23 @@ describe Wikidata::Entity, :vcr do
|
|
148
149
|
end
|
149
150
|
end
|
150
151
|
end
|
152
|
+
|
153
|
+
context 'keys of all properties' do
|
154
|
+
it 'can get a list of all property keys' do
|
155
|
+
github.property_keys.size.should be > 0
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
context 'name of a property' do
|
160
|
+
it 'can get the name of a property' do
|
161
|
+
github.property_name("P31").should eq 'instance of'
|
162
|
+
end
|
163
|
+
end
|
164
|
+
context 'Quantity data type' do
|
165
|
+
it 'should return hard coded number of children' do
|
166
|
+
james.property('P1971').amount.should eq 2
|
167
|
+
end
|
168
|
+
end
|
151
169
|
end
|
152
170
|
end
|
153
171
|
end
|
data/spec/wikidata_spec.rb
CHANGED
@@ -1,18 +1,15 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Wikidata do
|
4
|
-
let(:options)
|
4
|
+
let(:options) do
|
5
5
|
{ request: { timeout: 10 } }
|
6
|
-
|
7
|
-
let(:builder) {
|
8
|
-
-> (builder) { builder.use :excon }
|
9
|
-
}
|
6
|
+
end
|
10
7
|
it 'should be configurable' do
|
11
8
|
Wikidata.configure do |c|
|
12
9
|
c.options = options
|
13
|
-
c.
|
10
|
+
c.adapter = :excon
|
14
11
|
end
|
15
12
|
Wikidata.options.should be options
|
16
|
-
Wikidata.
|
13
|
+
Wikidata.adapter.should be :excon
|
17
14
|
end
|
18
15
|
end
|
metadata
CHANGED
@@ -1,156 +1,150 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wikidata-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.1.0.pre.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kévin Lacointe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: excon
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.92'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.92'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: faraday
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: faraday-excon
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '2.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: hashie
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0
|
61
|
+
version: '5.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0
|
68
|
+
version: '5.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: pry
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0.10'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0.10'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '13.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '13.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '3.1'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '3.1'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: vcr
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '6.1'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '6.1'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: webmock
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '3.14'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
138
|
+
version: '3.14'
|
139
139
|
description:
|
140
140
|
email: kevinlacointe@gmail.com
|
141
141
|
executables: []
|
142
142
|
extensions: []
|
143
143
|
extra_rdoc_files: []
|
144
144
|
files:
|
145
|
-
- ".gitignore"
|
146
|
-
- ".irbrc"
|
147
|
-
- ".rspec"
|
148
|
-
- ".travis.yml"
|
149
145
|
- CHANGELOG.md
|
150
|
-
- Gemfile
|
151
146
|
- LICENCE
|
152
147
|
- README.md
|
153
|
-
- Rakefile
|
154
148
|
- config/mapping.yml
|
155
149
|
- config/settings.yml
|
156
150
|
- lib/wikidata.rb
|
@@ -162,7 +156,9 @@ files:
|
|
162
156
|
- lib/wikidata/property/base.rb
|
163
157
|
- lib/wikidata/property/commons_media.rb
|
164
158
|
- lib/wikidata/property/globe_coordinate.rb
|
159
|
+
- lib/wikidata/property/hash.rb
|
165
160
|
- lib/wikidata/property/monolingual_text.rb
|
161
|
+
- lib/wikidata/property/quantity.rb
|
166
162
|
- lib/wikidata/property/string.rb
|
167
163
|
- lib/wikidata/property/time.rb
|
168
164
|
- lib/wikidata/property/url.rb
|
@@ -173,6 +169,9 @@ files:
|
|
173
169
|
- spec/fixtures/vcr/Wikidata_Entity/properties/entities/should_allow_to_return_only_entities_ids_from_an_id.yml
|
174
170
|
- spec/fixtures/vcr/Wikidata_Entity/properties/entities/should_return_entities_property_from_a_key_children_here_.yml
|
175
171
|
- spec/fixtures/vcr/Wikidata_Entity/properties/entities/should_return_entities_property_from_an_id_P40_for_children_here_.yml
|
172
|
+
- spec/fixtures/vcr/Wikidata_Entity/properties/properties/Quantity_data_type/should_return_hard_coded_number_of_children.yml
|
173
|
+
- spec/fixtures/vcr/Wikidata_Entity/properties/properties/keys_of_all_properties/can_get_a_list_of_all_property_keys.yml
|
174
|
+
- spec/fixtures/vcr/Wikidata_Entity/properties/properties/name_of_a_property/can_get_the_name_of_a_property.yml
|
176
175
|
- spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_commons_media/should_return_CommonsMedia_from_a_key_logo_image_here_.yml
|
177
176
|
- spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_commons_media/should_return_CommonsMedia_from_a_property_id_P154_for_logo_image_here_.yml
|
178
177
|
- spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_date/should_return_Time_from_a_a_key_date_of_birth_here_.yml
|
@@ -209,7 +208,6 @@ files:
|
|
209
208
|
- spec/wikidata/property/common_media_spec.rb
|
210
209
|
- spec/wikidata/property/time_spec.rb
|
211
210
|
- spec/wikidata_spec.rb
|
212
|
-
- wikidata-client.gemspec
|
213
211
|
homepage: https://github.com/klacointe/wikidata-client
|
214
212
|
licenses:
|
215
213
|
- MIT
|
@@ -225,12 +223,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
223
|
version: '0'
|
226
224
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
225
|
requirements:
|
228
|
-
- - "
|
226
|
+
- - ">"
|
229
227
|
- !ruby/object:Gem::Version
|
230
|
-
version:
|
228
|
+
version: 1.3.1
|
231
229
|
requirements: []
|
232
|
-
|
233
|
-
rubygems_version: 2.5.1
|
230
|
+
rubygems_version: 3.1.6
|
234
231
|
signing_key:
|
235
232
|
specification_version: 4
|
236
233
|
summary: Wikidata API client
|
@@ -239,6 +236,9 @@ test_files:
|
|
239
236
|
- spec/fixtures/vcr/Wikidata_Entity/properties/entities/should_allow_to_return_only_entities_ids_from_an_id.yml
|
240
237
|
- spec/fixtures/vcr/Wikidata_Entity/properties/entities/should_return_entities_property_from_a_key_children_here_.yml
|
241
238
|
- spec/fixtures/vcr/Wikidata_Entity/properties/entities/should_return_entities_property_from_an_id_P40_for_children_here_.yml
|
239
|
+
- spec/fixtures/vcr/Wikidata_Entity/properties/properties/Quantity_data_type/should_return_hard_coded_number_of_children.yml
|
240
|
+
- spec/fixtures/vcr/Wikidata_Entity/properties/properties/keys_of_all_properties/can_get_a_list_of_all_property_keys.yml
|
241
|
+
- spec/fixtures/vcr/Wikidata_Entity/properties/properties/name_of_a_property/can_get_the_name_of_a_property.yml
|
242
242
|
- spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_commons_media/should_return_CommonsMedia_from_a_key_logo_image_here_.yml
|
243
243
|
- spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_commons_media/should_return_CommonsMedia_from_a_property_id_P154_for_logo_image_here_.yml
|
244
244
|
- spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_date/should_return_Time_from_a_a_key_date_of_birth_here_.yml
|
data/.gitignore
DELETED
data/.irbrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
IRB.conf[:SAVE_HISTORY] = 100
|
data/.rspec
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
data/wikidata-client.gemspec
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
$:.push File.expand_path("../lib", __FILE__)
|
2
|
-
require "wikidata/version"
|
3
|
-
|
4
|
-
Gem::Specification.new do |s|
|
5
|
-
s.name = "wikidata-client"
|
6
|
-
s.version = Wikidata::VERSION.dup
|
7
|
-
s.platform = Gem::Platform::RUBY
|
8
|
-
s.licenses = ["MIT"]
|
9
|
-
s.summary = "Wikidata API client"
|
10
|
-
s.email = "kevinlacointe@gmail.com"
|
11
|
-
s.homepage = "https://github.com/klacointe/wikidata-client"
|
12
|
-
s.authors = ['Kévin Lacointe']
|
13
|
-
|
14
|
-
s.files = `git ls-files`.split("\n")
|
15
|
-
s.test_files = `git ls-files -- spec/*`.split("\n")
|
16
|
-
s.require_paths = ["lib"]
|
17
|
-
|
18
|
-
s.add_dependency("faraday", "~> 0.9")
|
19
|
-
s.add_dependency("faraday_middleware", "~> 0.9")
|
20
|
-
s.add_dependency("hashie", "~> 3.3")
|
21
|
-
s.add_dependency("excon", "~> 0.40")
|
22
|
-
|
23
|
-
s.add_development_dependency("rspec", "~> 3.1")
|
24
|
-
s.add_development_dependency("webmock", "~> 1.18")
|
25
|
-
s.add_development_dependency("vcr", "~> 2.9")
|
26
|
-
s.add_development_dependency("pry", "~> 0.10")
|
27
|
-
s.add_development_dependency("rake", "~> 10.3")
|
28
|
-
end
|