Wikidata API Gem
A library for interacting with the Wikidata API from Ruby.
Extends the MediaWiki API Gem.
Installation
Add this line to your application's Gemfile:
gem 'mediawiki_api-wikidata'
And then execute:
$ bundle
Or install it yourself as:
$ gem install mediawiki_api-wikidata
Usage
require "mediawiki_api/wikidata"
wikidata_client = MediawikiApi::Wikidata::WikidataClient.new "http://127.0.0.1/w/api.php"
wikidata_client.log_in "username", "password"
wikidata_client.create_item "data"
wikidata_client.create_property "data"
wikidata_client.add_sitelink "Q1234", "enwiki", "Berlin"
wikidata_client.remove_sitelink "Q1234", "enwiki"
wikidata_client.sitelink_exists? "enwiki", "Berlin"
wikidata_client.create_claim "Q1234", "value", "P1234", '"test"'
wikidata_client.search_entities "test", "en", "item"
Release notes
0.3.0 (2021-06-08)
- Compatible with mediawiki_api 7.0
- Compatible with Ruby 2.5
- Support for several API actions.
0.2.1 (2016-05-26)
0.2.0 (2015-10-09)
0.1.0 (2014-10-09)
0.0.2 (2014-10-09)
- Support adding sitelinks
- Support changing sitelinks
- Support removing sitelinks
- Support checking for existing sitelinks
- Provide separate methods for creating items and properties
- Removed custom edit summaries
0.0.1 (2014-09-29)
- Initial version
- Supports creation of entities via wbeditentity