Module: MediaWiktory::Wikipedia::Modules::Info

Defined in:
lib/mediawiktory/wikipedia/modules/info.rb

Overview

Get basic page information.

The "submodule" (MediaWiki API term) is included in action after setting some param, providing additional tweaking for this param. Example (for Actions::Query and its submodules):

api.query             # returns Actions::Query
   .prop(:revisions)  # adds prop=revisions to action URL, and includes Modules::Revisions into action
   .limit(10)         # method of Modules::Revisions, adds rvlimit=10 to URL

All submodule's parameters are documented as its public methods, see below.

Instance Method Summary collapse

Instance Method Details

#continue(value) ⇒ self

When more results are available, use this to continue.

Parameters:

  • value (String)

Returns:

  • (self)


64
65
66
# File 'lib/mediawiktory/wikipedia/modules/info.rb', line 64

def continue(value)
  merge(incontinue: value.to_s)
end

#prop(*values) ⇒ self

Which additional properties to get:

Parameters:

  • values (Array<String>)

    Allowed values: "protection" (List the protection level of each page), "talkid" (The page ID of the talk page for each non-talk page), "watched" (List the watched status of each page), "watchers" (The number of watchers, if allowed), "visitingwatchers" (The number of watchers of each page who have visited recent edits to that page, if allowed), "notificationtimestamp" (The watchlist notification timestamp of each page), "subjectid" (The page ID of the parent page for each talk page), "url" (Gives a full URL, an edit URL, and the canonical URL for each page), "readable" (Whether the user can read this page), "preload" (Gives the text returned by EditFormPreloadText), "displaytitle" (Gives the manner in which the page title is actually displayed).

Returns:

  • (self)


25
26
27
# File 'lib/mediawiktory/wikipedia/modules/info.rb', line 25

def prop(*values)
  values.inject(self) { |res, val| res._prop(val) or fail ArgumentError, "Unknown value for prop: #{val}" }
end

#testactions(*values) ⇒ self

Test whether the current user can perform certain actions on the page.

Parameters:

  • values (Array<String>)

Returns:

  • (self)


38
39
40
# File 'lib/mediawiktory/wikipedia/modules/info.rb', line 38

def testactions(*values)
  values.inject(self) { |res, val| res._testactions(val) }
end

#token(*values) ⇒ self

Use action=query&meta=tokens instead.

Parameters:

  • values (Array<String>)

    Allowed values: "edit", "delete", "protect", "move", "block", "unblock", "email", "import", "watch".

Returns:

  • (self)


51
52
53
# File 'lib/mediawiktory/wikipedia/modules/info.rb', line 51

def token(*values)
  values.inject(self) { |res, val| res._token(val) or fail ArgumentError, "Unknown value for token: #{val}" }
end