Class: MediaWiktory::Wikipedia::Actions::Templatedata
- Defined in:
- lib/mediawiktory/wikipedia/actions/templatedata.rb
Overview
Fetch data stored by the TemplateData extension.
Usage:
api.templatedata.titles(value).perform # returns string with raw output
# or
api.templatedata.titles(value).response # returns output parsed and wrapped into Response object
See Base for generic explanation of working with MediaWiki actions and Response for working with action responses.
All action's parameters are documented as its public methods, see below.
Instance Method Summary collapse
-
#converttitles ⇒ self
Convert titles to other variants if necessary.
-
#doNotIgnoreMissingTitles ⇒ self
Return data about titles even if they are missing or lack TemplateData.
-
#generator(value) ⇒ self
Get the list of pages to work on by executing the specified query module.
-
#lang(value) ⇒ self
Return localized values in this language.
-
#pageids(*values) ⇒ self
A list of page IDs to work on.
-
#redirects ⇒ self
Automatically resolve redirects in titles, pageids, and revids, and in pages returned by generator.
-
#revids(*values) ⇒ self
A list of revision IDs to work on.
-
#titles(*values) ⇒ self
A list of titles to work on.
Methods inherited from Get
Methods inherited from Base
#inspect, #merge, #name, #perform, #response, #to_h, #to_param, #to_url
Methods included from GlobalParams
#assert, #assertuser, #centralauthtoken, #curtimestamp, #errorformat, #errorlang, #errorsuselocal, #format, #maxage, #maxlag, #origin, #requestid, #responselanginfo, #servedby, #smaxage, #uselang
Instance Method Details
#converttitles ⇒ self
Convert titles to other variants if necessary. Only works if the wiki's content language supports variant conversion. Languages that support variant conversion include gan, iu, kk, ku, shi, sr, tg, uz and zh.
128 129 130 |
# File 'lib/mediawiktory/wikipedia/actions/templatedata.rb', line 128 def converttitles() merge(converttitles: 'true') end |
#doNotIgnoreMissingTitles ⇒ self
Return data about titles even if they are missing or lack TemplateData. By default (for backwards compatibility) titles are only returned if they exist and have TemplateData.
135 136 137 |
# File 'lib/mediawiktory/wikipedia/actions/templatedata.rb', line 135 def doNotIgnoreMissingTitles() merge(doNotIgnoreMissingTitles: 'true') end |
#generator(value) ⇒ self
Get the list of pages to work on by executing the specified query module.
109 110 111 |
# File 'lib/mediawiktory/wikipedia/actions/templatedata.rb', line 109 def generator(value) _generator(value) or fail ArgumentError, "Unknown value for generator: #{value}" end |
#lang(value) ⇒ self
Return localized values in this language. By default all available translations are returned.
143 144 145 |
# File 'lib/mediawiktory/wikipedia/actions/templatedata.rb', line 143 def lang(value) merge(lang: value.to_s) end |
#pageids(*values) ⇒ self
A list of page IDs to work on.
39 40 41 |
# File 'lib/mediawiktory/wikipedia/actions/templatedata.rb', line 39 def pageids(*values) values.inject(self) { |res, val| res._pageids(val) } end |
#redirects ⇒ self
Automatically resolve redirects in titles, pageids, and revids, and in pages returned by generator.
121 122 123 |
# File 'lib/mediawiktory/wikipedia/actions/templatedata.rb', line 121 def redirects() merge(redirects: 'true') end |
#revids(*values) ⇒ self
A list of revision IDs to work on.
52 53 54 |
# File 'lib/mediawiktory/wikipedia/actions/templatedata.rb', line 52 def revids(*values) values.inject(self) { |res, val| res._revids(val) } end |
#titles(*values) ⇒ self
A list of titles to work on.
26 27 28 |
# File 'lib/mediawiktory/wikipedia/actions/templatedata.rb', line 26 def titles(*values) values.inject(self) { |res, val| res._titles(val) } end |