module MediaWiktory::Wikipedia::Modules::Info
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 {MediaWiktory::Wikipedia::Actions::Query} and its submodules):
“`ruby 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.
Public Instance Methods
@private
# File lib/mediawiktory/wikipedia/modules/info.rb, line 30 def _prop(value) defined?(super) && super || ["protection", "talkid", "watched", "watchers", "visitingwatchers", "notificationtimestamp", "subjectid", "url", "readable", "preload", "displaytitle"].include?(value.to_s) && merge(inprop: value.to_s, replace: false) end
@private
# File lib/mediawiktory/wikipedia/modules/info.rb, line 43 def _testactions(value) merge(intestactions: value.to_s, replace: false) end
@private
# File lib/mediawiktory/wikipedia/modules/info.rb, line 56 def _token(value) defined?(super) && super || ["edit", "delete", "protect", "move", "block", "unblock", "email", "import", "watch"].include?(value.to_s) && merge(intoken: value.to_s, replace: false) end
When more results are available, use this to continue.
@param value [String] @return [self]
# File lib/mediawiktory/wikipedia/modules/info.rb, line 64 def continue(value) merge(incontinue: value.to_s) end
Which additional properties to get:
@param 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). @return [self]
# 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
Test whether the current user can perform certain actions on the page.
@param values [Array<String>] @return [self]
# File lib/mediawiktory/wikipedia/modules/info.rb, line 38 def testactions(*values) values.inject(self) { |res, val| res._testactions(val) } end
Use action=query&meta=tokens instead.
@param values [Array<String>] Allowed values: “edit”, “delete”, “protect”, “move”, “block”, “unblock”, “email”, “import”, “watch”. @return [self]
# 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