Module: MediaWiktory::Wikipedia::Modules::Allcategories

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

Overview

Enumerate all categories.

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

#continue(value) ⇒ self

When more results are available, use this to continue.

Parameters:

  • value (String)

Returns:

  • (self)


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

def continue(value)
  merge(accontinue: value.to_s)
end

#dir(value) ⇒ self

Direction to sort in.

Parameters:

  • value (String)

    One of "ascending", "descending".

Returns:

  • (self)


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

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

#from(value) ⇒ self

The category to start enumerating from.

Parameters:

  • value (String)

Returns:

  • (self)


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

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

#limit(value) ⇒ self

How many categories to return.

Parameters:

  • value (Integer, "max")

Returns:

  • (self)


86
87
88
# File 'lib/mediawiktory/wikipedia/modules/allcategories.rb', line 86

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

#max(value) ⇒ self

Only return categories with at most this many members.

Parameters:

  • value (Integer)

Returns:

  • (self)


78
79
80
# File 'lib/mediawiktory/wikipedia/modules/allcategories.rb', line 78

def max(value)
  merge(acmax: value.to_s)
end

#min(value) ⇒ self

Only return categories with at least this many members.

Parameters:

  • value (Integer)

Returns:

  • (self)


70
71
72
# File 'lib/mediawiktory/wikipedia/modules/allcategories.rb', line 70

def min(value)
  merge(acmin: value.to_s)
end

#prefix(value) ⇒ self

Search for all category titles that begin with this value.

Parameters:

  • value (String)

Returns:

  • (self)


49
50
51
# File 'lib/mediawiktory/wikipedia/modules/allcategories.rb', line 49

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

#prop(*values) ⇒ self

Which properties to get:

Parameters:

  • values (Array<String>)

    Allowed values: "size" (Adds number of pages in the category), "hidden" (Tags categories that are hidden with HIDDENCAT).

Returns:

  • (self)


94
95
96
# File 'lib/mediawiktory/wikipedia/modules/allcategories.rb', line 94

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

#to(value) ⇒ self

The category to stop enumerating at.

Parameters:

  • value (String)

Returns:

  • (self)


41
42
43
# File 'lib/mediawiktory/wikipedia/modules/allcategories.rb', line 41

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