Class: MediaWiktory::Wikipedia::Actions::Templatedata

Inherits:
Get
  • Object
show all
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

Methods inherited from Get

#perform

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

#converttitlesself

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.

Returns:

  • (self)


128
129
130
# File 'lib/mediawiktory/wikipedia/actions/templatedata.rb', line 128

def converttitles()
  merge(converttitles: 'true')
end

#doNotIgnoreMissingTitlesself

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.

Returns:

  • (self)


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.

Parameters:

Returns:

  • (self)


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.

Parameters:

  • value (String)

Returns:

  • (self)


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.

Parameters:

  • values (Array<Integer>)

Returns:

  • (self)


39
40
41
# File 'lib/mediawiktory/wikipedia/actions/templatedata.rb', line 39

def pageids(*values)
  values.inject(self) { |res, val| res._pageids(val) }
end

#redirectsself

Automatically resolve redirects in titles, pageids, and revids, and in pages returned by generator.

Returns:

  • (self)


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.

Parameters:

  • values (Array<Integer>)

Returns:

  • (self)


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.

Parameters:

  • values (Array<String>)

Returns:

  • (self)


26
27
28
# File 'lib/mediawiktory/wikipedia/actions/templatedata.rb', line 26

def titles(*values)
  values.inject(self) { |res, val| res._titles(val) }
end