jpatokal / mediawiki-gateway

Ruby framework for MediaWiki API manipulation
Other
133 stars 50 forks source link

MediaWiki::Gateway

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.

Features

Links

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

Installation

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

Usage

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')

Changing the default User-Agent

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/; MyCoolTool@example.com)'

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/; MyCoolTool@example.com)')

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.

Development environment

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

Testing against a live MediaWiki instance

You need to have Docker and mediawiki-testwiki installed.

Versioning

This project adheres to the Semantic Versioning Specification.

Status

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.

Credits

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: