Module: MediaWiktory::Wikipedia::Modules::Allmessages

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

Overview

Return messages from this site.

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

#args(*values) ⇒ self

Arguments to be substituted into message.

Parameters:

  • values (Array<String>)

Returns:

  • (self)


72
73
74
# File 'lib/mediawiktory/wikipedia/modules/allmessages.rb', line 72

def args(*values)
  values.inject(self) { |res, val| res._args(val) }
end

#customised(value) ⇒ self

Return only messages in this customisation state.

Parameters:

  • value (String)

    One of "all", "modified", "unmodified".

Returns:

  • (self)


93
94
95
# File 'lib/mediawiktory/wikipedia/modules/allmessages.rb', line 93

def customised(value)
  _customised(value) or fail ArgumentError, "Unknown value for customised: #{value}"
end

#enableparserself

Set to enable parser, will preprocess the wikitext of message (substitute magic words, handle templates, etc.).

Returns:

  • (self)


50
51
52
# File 'lib/mediawiktory/wikipedia/modules/allmessages.rb', line 50

def enableparser()
  merge(amenableparser: 'true')
end

#filter(value) ⇒ self

Return only messages with names that contain this string.

Parameters:

  • value (String)

Returns:

  • (self)


85
86
87
# File 'lib/mediawiktory/wikipedia/modules/allmessages.rb', line 85

def filter(value)
  merge(amfilter: value.to_s)
end

#from(value) ⇒ self

Return messages starting at this message.

Parameters:

  • value (String)

Returns:

  • (self)


114
115
116
# File 'lib/mediawiktory/wikipedia/modules/allmessages.rb', line 114

def from(value)
  merge(amfrom: value.to_s)
end

#includelocalself

Also include local messages, i.e. messages that don't exist in the software but do exist as in the MediaWiki namespace. This lists all MediaWiki-namespace pages, so it will also list those that aren't really messages such as Common.js.

Returns:

  • (self)


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

def includelocal()
  merge(amincludelocal: 'true')
end

#lang(value) ⇒ self

Return messages in this language.

Parameters:

  • value (String)

Returns:

  • (self)


106
107
108
# File 'lib/mediawiktory/wikipedia/modules/allmessages.rb', line 106

def lang(value)
  merge(amlang: value.to_s)
end

#messages(*values) ⇒ self

Which messages to output. * (default) means all messages.

Parameters:

  • values (Array<String>)

Returns:

  • (self)


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

def messages(*values)
  values.inject(self) { |res, val| res._messages(val) }
end

#nocontentself

If set, do not include the content of the messages in the output.

Returns:

  • (self)


57
58
59
# File 'lib/mediawiktory/wikipedia/modules/allmessages.rb', line 57

def nocontent()
  merge(amnocontent: 'true')
end

#prefix(value) ⇒ self

Return messages with this prefix.

Parameters:

  • value (String)

Returns:

  • (self)


138
139
140
# File 'lib/mediawiktory/wikipedia/modules/allmessages.rb', line 138

def prefix(value)
  merge(amprefix: value.to_s)
end

#prop(*values) ⇒ self

Which properties to get.

Parameters:

  • values (Array<String>)

    Allowed values: "default".

Returns:

  • (self)


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

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

#title(value) ⇒ self

Page name to use as context when parsing message (for amenableparser option).

Parameters:

  • value (String)

Returns:

  • (self)


130
131
132
# File 'lib/mediawiktory/wikipedia/modules/allmessages.rb', line 130

def title(value)
  merge(amtitle: value.to_s)
end

#to(value) ⇒ self

Return messages ending at this message.

Parameters:

  • value (String)

Returns:

  • (self)


122
123
124
# File 'lib/mediawiktory/wikipedia/modules/allmessages.rb', line 122

def to(value)
  merge(amto: value.to_s)
end