Module: MediaWiktory::Wikipedia::Modules::Wikisets

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

Overview

Enumerate all wiki sets.

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

#from(value) ⇒ self

The name of the wiki set to start from.

Parameters:

  • value (String)

Returns:

  • (self)


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

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

#limit(value) ⇒ self

How many wiki sets to return.

Parameters:

  • value (Integer, "max")

Returns:

  • (self)


46
47
48
# File 'lib/mediawiktory/wikipedia/modules/wikisets.rb', line 46

def limit(value)
  merge(wslimit: value.to_s)
end

#orderbynameself

Order results by name.

Returns:

  • (self)


53
54
55
# File 'lib/mediawiktory/wikipedia/modules/wikisets.rb', line 53

def orderbyname()
  merge(wsorderbyname: 'true')
end

#prop(*values) ⇒ self

What pieces of information to include.

Parameters:

  • values (Array<String>)

    Allowed values: "type" (Opt-in based (includes only specified wikis) or opt-out based (includes all wikis except specified)), "wikisincluded" (The wikis that are included in this wiki set), "wikisnotincluded" (The wikis that are not included in this wiki set).

Returns:

  • (self)


33
34
35
# File 'lib/mediawiktory/wikipedia/modules/wikisets.rb', line 33

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