Sha256: d112173a92b5646af2b68880d63003b4d1e015338cb4c99b83936f178e6cf07d

Contents?: true

Size: 1.78 KB

Versions: 3

Compression:

Stored size: 1.78 KB

Contents

h1. Wikipedia

Allows you to get wikipedia content through their API. This uses the
alpha API, not the deprecated query.php API type

Wikipedia API reference: "http://en.wikipedia.org/w/api.php":http://en.wikipedia.org/w/api.php

Adopted from: "http://code.google.com/p/wikipedia-client/":http://code.google.com/p/wikipedia-client/

h2. Installation

<pre><code>gem install wikipedia-client</code></pre>

h2. Examples

<pre><code>require 'wikipedia'
page = Wikipedia.find( 'Getting Things Done' )

=> #<Wikipedia:Page>

page.title

=> 'Getting Things Done'

page.content

=> # all the wiki markup appears here...

page.categories

=> [..., "Category:Self-help books", ...]

page.links

=> [..., "Business", "Cult following", ...]

page.images

=> ["File:Getting Things Done.jpg", ...]

page.image_urls

=> ["http://upload.wikimedia.org/wikipedia/en/e/e1/Getting_Things_Done.jpg", ...]]</code></pre>

h2. Configuration

This is by default configured like this:

<pre><code>Wikipedia.Configure {
  domain 'en.wikipedia.org'
  path   'w/api.php'
}</code></pre>

h2. Advanced

See the API spec at "http://en.wikipedia.org/w/api.php":http://en.wikipedia.org/w/api.php

If you need data that is not already present, you can override
parameters.

For example, to retrieve only the page info:

<pre><code>page = Wikipedia.find( 'Getting Things Done', :prop => "info" )

page.title

=> "Getting Things Done"

page.raw_data

=> {"query"=>{"pages"=>{"959928"=>{"pageid"=>959928, "ns"=>0,
"title"=>"Getting Things Done", "touched"=>"2010-03-10T00:04:09Z",
"lastrevid"=>348481810, "counter"=>0, "length"=>7891}}}}</code></pre>

h2. Running specs

if you have rspec >= 1.1.3 installed just type in

rake spec

h2. Thanks!

Copyright (c) 2008 [Cyril David], released under the MIT license

Adopted by Ken Pratt (ken@kenpratt.net) in 2010/03

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wikipedia-client-1.1.2 README.textile
wikipedia-client-1.1.1 README.textile
wikipedia-client-1.1.0 README.textile