Module: MediaWiktory::Wikipedia::Modules::GCategorymembers

Defined in:
lib/mediawiktory/wikipedia/modules/g-categorymembers.rb

Overview

List all pages in a given category. Generator module: for fetching pages corresponding to request.

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)


67
68
69
# File 'lib/mediawiktory/wikipedia/modules/g-categorymembers.rb', line 67

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

#dir(value) ⇒ self

In which direction to sort.

Parameters:

  • value (String)

    One of "asc", "desc", "ascending", "descending", "newer", "older".

Returns:

  • (self)


96
97
98
# File 'lib/mediawiktory/wikipedia/modules/g-categorymembers.rb', line 96

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

#end(value) ⇒ self

Timestamp to end listing at. Can only be used with cmsort=timestamp.

Parameters:

  • value (Time)

Returns:

  • (self)


117
118
119
# File 'lib/mediawiktory/wikipedia/modules/g-categorymembers.rb', line 117

def end(value)
  merge(gcmend: value.iso8601)
end

#endhexsortkey(value) ⇒ self

Sortkey to end listing at, as returned by cmprop=sortkey. Can only be used with cmsort=sortkey.

Parameters:

  • value (String)

Returns:

  • (self)


133
134
135
# File 'lib/mediawiktory/wikipedia/modules/g-categorymembers.rb', line 133

def endhexsortkey(value)
  merge(gcmendhexsortkey: value.to_s)
end

#endsortkey(value) ⇒ self

Use cmendhexsortkey instead.

Parameters:

  • value (String)

Returns:

  • (self)


165
166
167
# File 'lib/mediawiktory/wikipedia/modules/g-categorymembers.rb', line 165

def endsortkey(value)
  merge(gcmendsortkey: value.to_s)
end

#endsortkeyprefix(value) ⇒ self

Sortkey prefix to end listing before (not at; if this value occurs it will not be included!). Can only be used with cmsort=sortkey. Overrides cmendhexsortkey.

Parameters:

  • value (String)

Returns:

  • (self)


149
150
151
# File 'lib/mediawiktory/wikipedia/modules/g-categorymembers.rb', line 149

def endsortkeyprefix(value)
  merge(gcmendsortkeyprefix: value.to_s)
end

#limit(value) ⇒ self

The maximum number of pages to return.

Parameters:

  • value (Integer, "max")

Returns:

  • (self)


75
76
77
# File 'lib/mediawiktory/wikipedia/modules/g-categorymembers.rb', line 75

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

#namespace(*values) ⇒ self

Only include pages in these namespaces. Note that cmtype=subcat or cmtype=file may be used instead of cmnamespace=14 or 6.

Parameters:

  • values (Array<String>)

    Allowed values: "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "100", "101", "108", "109", "118", "119", "446", "447", "710", "711", "828", "829", "2300", "2301", "2302", "2303".

Returns:

  • (self)


41
42
43
# File 'lib/mediawiktory/wikipedia/modules/g-categorymembers.rb', line 41

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

#pageid(value) ⇒ self

Page ID of the category to enumerate. Cannot be used together with cmtitle.

Parameters:

  • value (Integer)

Returns:

  • (self)


33
34
35
# File 'lib/mediawiktory/wikipedia/modules/g-categorymembers.rb', line 33

def pageid(value)
  merge(gcmpageid: value.to_s)
end

#sort(value) ⇒ self

Property to sort by.

Parameters:

  • value (String)

    One of "sortkey", "timestamp".

Returns:

  • (self)


83
84
85
# File 'lib/mediawiktory/wikipedia/modules/g-categorymembers.rb', line 83

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

#start(value) ⇒ self

Timestamp to start listing from. Can only be used with cmsort=timestamp.

Parameters:

  • value (Time)

Returns:

  • (self)


109
110
111
# File 'lib/mediawiktory/wikipedia/modules/g-categorymembers.rb', line 109

def start(value)
  merge(gcmstart: value.iso8601)
end

#starthexsortkey(value) ⇒ self

Sortkey to start listing from, as returned by cmprop=sortkey. Can only be used with cmsort=sortkey.

Parameters:

  • value (String)

Returns:

  • (self)


125
126
127
# File 'lib/mediawiktory/wikipedia/modules/g-categorymembers.rb', line 125

def starthexsortkey(value)
  merge(gcmstarthexsortkey: value.to_s)
end

#startsortkey(value) ⇒ self

Use cmstarthexsortkey instead.

Parameters:

  • value (String)

Returns:

  • (self)


157
158
159
# File 'lib/mediawiktory/wikipedia/modules/g-categorymembers.rb', line 157

def startsortkey(value)
  merge(gcmstartsortkey: value.to_s)
end

#startsortkeyprefix(value) ⇒ self

Sortkey prefix to start listing from. Can only be used with cmsort=sortkey. Overrides cmstarthexsortkey.

Parameters:

  • value (String)

Returns:

  • (self)


141
142
143
# File 'lib/mediawiktory/wikipedia/modules/g-categorymembers.rb', line 141

def startsortkeyprefix(value)
  merge(gcmstartsortkeyprefix: value.to_s)
end

#title(value) ⇒ self

Which category to enumerate (required). Must include the Category: prefix. Cannot be used together with cmpageid.

Parameters:

  • value (String)

Returns:

  • (self)


25
26
27
# File 'lib/mediawiktory/wikipedia/modules/g-categorymembers.rb', line 25

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

#type(*values) ⇒ self

Which type of category members to include. Ignored when cmsort=timestamp is set.

Parameters:

  • values (Array<String>)

    Allowed values: "page", "subcat", "file".

Returns:

  • (self)


54
55
56
# File 'lib/mediawiktory/wikipedia/modules/g-categorymembers.rb', line 54

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