Skip to content

Loading…

Readme #9

Merged
merged 2 commits into from

2 participants

@afnecors

updated README with two new methods

@kenpratt kenpratt merged commit 6df5281 into kenpratt:master
@kenpratt
Owner

Thanks! I've merged your changes, cleaned up the image code a bit too (added page.image_descriptionurls), and published a new version of the gem (1.2.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 27, 2013
  1. @afnecors

    add templates method

    afnecors committed
  2. @afnecors

    update README

    afnecors committed
Showing with 13 additions and 1 deletion.
  1. +8 −0 README.textile
  2. +1 −1 lib/wikipedia/client.rb
  3. +4 −0 lib/wikipedia/page.rb
View
8 README.textile
@@ -42,6 +42,14 @@ page.image_urls
=> ["http://upload.wikimedia.org/wikipedia/en/e/e1/Getting_Things_Done.jpg", ...]]</code></pre>
+page.coordinates
+
+=> [48.853, 2.3498, "", "earth"]
+
+page.templates
+
+=> [..., "Template:About", ...]
+
h2. Configuration
This is by default configured like this:
View
2 lib/wikipedia/client.rb
@@ -27,7 +27,7 @@ def find_image( title, options = {} )
def request_page( title, options = {} )
request( {
:action => "query",
- :prop => %w{ revisions links images categories coordinates },
+ :prop => %w{ revisions links images categories coordinates templates },
:rvprop => "content",
:titles => title
}.merge( options ) )
View
4 lib/wikipedia/page.rb
@@ -69,6 +69,10 @@ def raw_data
@data
end
+ def templates
+ page['templates'].map {|c| c['title'] } if page['templates']
+ end
+
def json
@json
end
Something went wrong with that request. Please try again.