A Ruby framework for MediaWiki API manipulation.
Note: This library is not actively maintained and uses deprecated API methods. If you are starting a new project, please use the official Wikimedia Ruby client at https://github.com/wikimedia/mediawiki-ruby-api instead.
- Simple, elegant syntax for common operations
- Handles login, edit, move etc. tokens for you
- List, search operations work around API limits to fetch all results
- Support for maxlag detection and automated retries on 503
- Integrated logging
- Tested up to MediaWiki 1.24
- For 1.25+, you must skip deprecation warnings with
:ignorewarnings => true
inMediaWiki::Gateway.new
. See issue #69.
- For 1.25+, you must skip deprecation warnings with
- Should work with Ruby 1.9.3 and higher
RubyGem : http://rubygems.org/gems/mediawiki-gateway
Documentation : http://rubydoc.info/gems/mediawiki-gateway
Source : https://github.com/jpatokal/mediawiki-gateway
CI : https://travis-ci.org/jpatokal/mediawiki-gateway
To install MediaWiki::Gateway, execute the command:
$ gem install mediawiki-gateway
Or add it to your application's Gemfile
:
gem 'mediawiki-gateway'
and then execute the command:
$ bundle
Simple page creation script:
require 'media_wiki'
mw = MediaWiki::Gateway.new('http://my-wiki.example/w/api.php')
mw.login('RubyBot', 'pa$$w0rd')
mw.create('PageTitle', 'Hello world!', summary: 'My first page')
In order to comply with Wikimedia's User-Agent policy, you are strongly advised to provide your own User-Agent header when accessing Wikimedia websites. The User-Agent information should include the name and version of your bot as well as a URL (homepage, repository) and contact e-mail.
You can set the default User-Agent globally:
MediaWiki::Gateway.default_user_agent = 'MyCoolTool/1.1 (http://example.com/MyCoolTool/; [email protected])'
You can also set it on an instance by instance basis, overriding the global default:
mw = MediaWiki::Gateway.new('http://my-wiki.example/w/api.php', user_agent: 'MyCoolTool/1.1 (http://example.com/MyCoolTool/; [email protected])')
You only need to provide the part that identifies your own bot, an additional part denoting that your bot is based on MediaWiki::Gateway is appended automatically.
To compile and test MediaWiki::Gateway locally, install its development dependencies:
$ gem install --development mediawiki-gateway
Then this will list the available options:
$ rake -T
To build and install the gem use:
$ rake gem:install
You need to have Docker and mediawiki-testwiki installed.
This project adheres to the Semantic Versioning Specification.
This gem is no longer in active development. Pull requests that fix bugs or add new features are more than welcome, but asking for new features is unlikely to make them materialize out of thin air.
Loosely maintained by Jani Patokallio and Jens Wille. If you'd be seriously interested in joining as an active maintainer, drop us a line!
Thanks to:
- John Carney, Mike Williams, Daniel Heath and the rest of the Lonely Planet Atlas team.
- GitHub users for code contributions, see https://github.com/jpatokal/mediawiki-gateway/pulls