mediawiki_api-wikidata 0.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzgwZTA1YmI5NjBlYzk1ODBhYzA2MDE3YWY0ODc0ODE5YTYyNDAxYQ==
4
+ ZDMwMGRkMWM4MTNiOGZiYzQxNTJiZjNhY2M4MDI3MzE4ZTBmZjY5Nw==
5
5
  data.tar.gz: !binary |-
6
- MTVkZTM0ZjQ5ZTI5ZGU1NmIxOTA0MDM0ZDhkOWMwOTBhOGIzMjkwYw==
6
+ N2IwNGI2MjVkNDkzODIyYWNlZTE0ZTc1YTZjM2MxNTllNTU5ZjdiOQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- Y2I1MWQ3MGM2MjEwNzJkYjc2MzZhZDBkMDJmNGE5MjE1ZWNkOTQyNjRjODEw
10
- ODViZjEyZjE4NTU1ZDMwNWYwZThmZjc4OWIzMDEyZmUwN2RhZTE1MWZmOTIw
11
- NDU0OTZiZGUzZDQ3YmU5MzYyMTFkZjA3MTFlZGM4YWU0OTA5NDA=
9
+ MTg5ZDMzYWZhMTFmMTYwMzZkNzJiZjVjMjNiZGJiN2M5ZWZhMmU1ZDAxOWY0
10
+ YThlMTNmZGI1N2EyMzMyODJmZDFmNjg4MzkxNDE5YmMwZDM5YjM5ZTJmYzRh
11
+ YmYyZmYwYTU0M2JhM2E5NDFiNDU4ODdhNzQzZmZhYTllMDcxZmI=
12
12
  data.tar.gz: !binary |-
13
- ODY4NTQ2MjJkYTZlNjU4YzJmNjU4MDI3YWFkYjE0NWQ1MTY4NTE2OTRmYWU2
14
- MTE4OTYyODUxZjk2N2QzNGM5NjdhYzkzNjAxZDY1NThkZTJlYjdjZTg4NGM5
15
- ZGZjZjIwZGIyNDEwNzViNDRjMTAwNTY1M2Y4YWY5YzY0ZTliOWQ=
13
+ N2ZiZmZlODgxMWE2ZWIwMzc0NzYzMmUwM2FhNWZmZDA5MGM3Yzc5OGJkMTc0
14
+ NGM3MmU0ZTRmZDFjZDNhZTQ4MDc5MGVhYWNmMWQyMDQxOGU2MDU4NDIxM2Rl
15
+ OWFlZDk3YzI4MjkyYmMzNThiNDkzNTc5ODNiZmQ1OTc3Yzk3YWE=
data/.gitignore CHANGED
@@ -1,18 +1,18 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- .idea/
7
- Gemfile.lock
8
- InstalledFiles
9
- _yardoc
10
- coverage
11
- doc/
12
- lib/bundler/man
13
- pkg
14
- rdoc
15
- spec/reports
16
- test/tmp
17
- test/version_tmp
18
- tmp
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .idea/
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in mediawiki_api-wikidata.gemspec
4
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mediawiki_api-wikidata.gemspec
4
+ gemspec
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # WikidataAPI
1
+ # Wikidata API Gem
2
2
 
3
3
  [![Build Status](https://api.travis-ci.org/wmde/WikidataApiGem.png?branch=master)](http://travis-ci.org/wmde/WikidataApiGem)
4
4
 
@@ -37,21 +37,24 @@ wikidata_client.search_entities "test", "en", "item" #searches for items contain
37
37
 
38
38
  ## Release notes
39
39
 
40
- ### 0.1 (2014-10-09)
41
- - feature complete for [Wikidata BrowserTests](https://github.com/wmde/WikidataBrowserTests)
42
- - support creating claims
43
- - support searching entities
40
+ ### 0.2.0 (2015-10-09)
41
+ - Compatible with [mediawiki_api 5.0](https://rubygems.org/gems/mediawiki_api/versions/0.5.0)
42
+
43
+ ### 0.1.0 (2014-10-09)
44
+ - Feature complete for [Wikidata BrowserTests](https://github.com/wmde/WikidataBrowserTests)
45
+ - Support creating claims
46
+ - Support searching entities
44
47
 
45
48
  ### 0.0.2 (2014-10-09)
46
49
 
47
- - support adding sitelinks
48
- - support changing sitelinks
49
- - support removing sitelinks
50
- - support checking for existing sitelinks
51
- - provide separate methods for creating items and properties
52
- - removed custom edit summaries
50
+ - Support adding sitelinks
51
+ - Support changing sitelinks
52
+ - Support removing sitelinks
53
+ - Support checking for existing sitelinks
54
+ - Provide separate methods for creating items and properties
55
+ - Removed custom edit summaries
53
56
 
54
57
  ### 0.0.1 (2014-09-29)
55
58
 
56
59
  - Initial version
57
- - supports creation of entities via wbeditentity
60
+ - Supports creation of entities via wbeditentity
@@ -1 +1 @@
1
- require "mediawiki_api/wikidata/wikidata_client"
1
+ require "mediawiki_api/wikidata/wikidata_client"
@@ -1,5 +1,5 @@
1
1
  module MediawikiApi
2
2
  module Wikidata
3
- VERSION = "0.1"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -9,7 +9,7 @@ module MediawikiApi
9
9
  class WikidataClient < Client
10
10
 
11
11
  def create_entity(entity_data, type)
12
- action(:wbeditentity, token_type: "edit", new: type, data: entity_data)
12
+ action(:wbeditentity, token_type: "csrf", new: type, data: entity_data)
13
13
  end
14
14
 
15
15
  def create_item(item_data)
@@ -21,7 +21,7 @@ module MediawikiApi
21
21
  end
22
22
 
23
23
  def set_sitelink(entity_identifier, sitelink_site_id, sitelink_title = nil, badges = nil)
24
- params = { token_type: "edit", linksite: sitelink_site_id, linktitle: sitelink_title, badges: badges}
24
+ params = { token_type: "csrf", linksite: sitelink_site_id, linktitle: sitelink_title, badges: badges}
25
25
  action(:wbsetsitelink, params.merge(parse_entity_identifier(entity_identifier)))
26
26
  end
27
27
 
@@ -44,7 +44,7 @@ module MediawikiApi
44
44
  end
45
45
 
46
46
  def create_claim(entity_id, snaktype = "value", property_id, value_data)
47
- action(:wbcreateclaim, token_type: "edit", entity: entity_id, snaktype: snaktype, property: property_id, value: value_data)
47
+ action(:wbcreateclaim, token_type: "csrf", entity: entity_id, snaktype: snaktype, property: property_id, value: value_data)
48
48
  end
49
49
 
50
50
  private
@@ -1,28 +1,28 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'mediawiki_api/wikidata/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "mediawiki_api-wikidata"
8
- spec.version = MediawikiApi::Wikidata::VERSION
9
- spec.authors = ["Tobias Gritschacher"]
10
- spec.email = ["tobias.gritschacher@wikimedia.de"]
11
- spec.description = %q{A library for interacting with the Wikidata API from Ruby.}
12
- spec.summary = %q{Extends the MediaWiki API Gem.}
13
- spec.homepage = "https://github.com/wmde/WikidataApiGem"
14
- spec.license = "GPL-2"
15
-
16
- spec.files = `git ls-files`.split($/)
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ["lib"]
19
-
20
- spec.add_runtime_dependency "mediawiki_api", "~> 0.2.0"
21
-
22
- spec.add_development_dependency "bundler", "~> 1.3"
23
- spec.add_development_dependency "rake", "~> 0"
24
- spec.add_development_dependency "rspec", "~> 3.0", ">= 3.0.0"
25
- spec.add_development_dependency "webmock", "~> 1.17", ">= 1.17.2"
26
- spec.add_development_dependency "redcarpet"
27
- spec.add_development_dependency "yard"
28
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'mediawiki_api/wikidata/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "mediawiki_api-wikidata"
8
+ spec.version = MediawikiApi::Wikidata::VERSION
9
+ spec.authors = ["Tobias Gritschacher"]
10
+ spec.email = ["tobias.gritschacher@wikimedia.de"]
11
+ spec.description = %q{A library for interacting with the Wikidata API from Ruby.}
12
+ spec.summary = %q{Extends the MediaWiki API Gem.}
13
+ spec.homepage = "https://github.com/wmde/WikidataApiGem"
14
+ spec.license = "GPL-2"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_runtime_dependency "mediawiki_api", "~> 0.5.0"
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake", "~> 0"
24
+ spec.add_development_dependency "rspec", "~> 3.0", ">= 3.0.0"
25
+ spec.add_development_dependency "webmock", "~> 1.17", ">= 1.17.2"
26
+ spec.add_development_dependency "redcarpet"
27
+ spec.add_development_dependency "yard"
28
+ end
@@ -31,10 +31,10 @@ module MediawikiApi::Wikidata::RequestHelpers
31
31
  end
32
32
 
33
33
  def stub_token_request(type, warning = nil)
34
- response = { tokens: { "#{type}token" => mock_token } }
35
- response[:warnings] = { type => { "*" => [warning] } } unless warning.nil?
34
+ response = { query: { tokens: { "#{type}token" => mock_token } } }
35
+ response[:warnings] = { type => { '*' => [warning] } } unless warning.nil?
36
36
 
37
- stub_api_request(:get, action: "tokens", type: type).
37
+ stub_api_request(:get, action: 'query', meta: 'tokens', type: type).
38
38
  to_return(body: response.to_json)
39
39
  end
40
40
  end
@@ -18,7 +18,7 @@ describe MediawikiApi::Wikidata::WikidataClient do
18
18
  let(:response) { {} }
19
19
 
20
20
  before do
21
- stub_token_request(:edit)
21
+ stub_token_request(:csrf)
22
22
  @edit_request = stub_action_request(:wbeditentity, data: data, new: type).
23
23
  to_return(body: response.to_json)
24
24
  end
@@ -37,7 +37,7 @@ describe MediawikiApi::Wikidata::WikidataClient do
37
37
  let(:response) { {} }
38
38
 
39
39
  before do
40
- stub_token_request(:edit)
40
+ stub_token_request(:csrf)
41
41
  @edit_request = stub_action_request(:wbeditentity, data: data, new: "item").
42
42
  to_return(body: response.to_json)
43
43
  end
@@ -56,7 +56,7 @@ describe MediawikiApi::Wikidata::WikidataClient do
56
56
  let(:response) { {} }
57
57
 
58
58
  before do
59
- stub_token_request(:edit)
59
+ stub_token_request(:csrf)
60
60
  @edit_request = stub_action_request(:wbeditentity, data: data, new: "property").
61
61
  to_return(body: response.to_json)
62
62
  end
@@ -75,7 +75,7 @@ describe MediawikiApi::Wikidata::WikidataClient do
75
75
  let(:response) { {} }
76
76
 
77
77
  before do
78
- stub_token_request(:edit)
78
+ stub_token_request(:csrf)
79
79
  @edit_request = stub_action_request(:wbeditentity, data: data, new: "property").
80
80
  to_return(body: response.to_json)
81
81
  end
@@ -92,11 +92,11 @@ describe MediawikiApi::Wikidata::WikidataClient do
92
92
  let(:entity_identifier) { {site_id: "dewiki", title: "Berlin"} }
93
93
  let(:sitelink_site_id) { "itwiki" }
94
94
  let(:sitelink_title) { "Berlino" }
95
- let(:badges) { nil }
95
+ let(:badges) { true }
96
96
  let(:response) { {} }
97
97
 
98
98
  before do
99
- stub_token_request(:edit)
99
+ stub_token_request(:csrf)
100
100
  @edit_request = stub_action_request(:wbsetsitelink, site: "dewiki", title: "Berlin", linksite: sitelink_site_id,
101
101
  linktitle: sitelink_title, badges: badges).
102
102
  to_return(body: response.to_json)
@@ -114,11 +114,11 @@ describe MediawikiApi::Wikidata::WikidataClient do
114
114
  let(:entity_identifier) { "Q1234" }
115
115
  let(:sitelink_site_id) { "itwiki" }
116
116
  let(:sitelink_title) { "Berlino" }
117
- let(:badges) { nil }
117
+ let(:badges) { true }
118
118
  let(:response) { {} }
119
119
 
120
120
  before do
121
- stub_token_request(:edit)
121
+ stub_token_request(:csrf)
122
122
  @edit_request = stub_action_request(:wbsetsitelink, id: "Q1234", linksite: sitelink_site_id,
123
123
  linktitle: sitelink_title, badges: badges).
124
124
  to_return(body: response.to_json)
@@ -140,7 +140,7 @@ describe MediawikiApi::Wikidata::WikidataClient do
140
140
  let(:response) { {} }
141
141
 
142
142
  before do
143
- stub_token_request(:edit)
143
+ stub_token_request(:csrf)
144
144
  @edit_request = stub_action_request(:wbcreateclaim, entity: entity_id, snaktype: snaktype, property: property_id, value: value).
145
145
  to_return(body: response.to_json)
146
146
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mediawiki_api-wikidata
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Gritschacher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-09 00:00:00.000000000 Z
11
+ date: 2015-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mediawiki_api
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.0
19
+ version: 0.5.0
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.2.0
26
+ version: 0.5.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement