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
-
#continue(value) ⇒ self
When more results are available, use this to continue.
-
#dir(value) ⇒ self
In which direction to sort.
-
#end(value) ⇒ self
Timestamp to end listing at.
-
#endhexsortkey(value) ⇒ self
Sortkey to end listing at, as returned by cmprop=sortkey.
-
#endsortkey(value) ⇒ self
Use cmendhexsortkey instead.
-
#endsortkeyprefix(value) ⇒ self
Sortkey prefix to end listing before (not at; if this value occurs it will not be included!).
-
#limit(value) ⇒ self
The maximum number of pages to return.
-
#namespace(*values) ⇒ self
Only include pages in these namespaces.
-
#pageid(value) ⇒ self
Page ID of the category to enumerate.
-
#sort(value) ⇒ self
Property to sort by.
-
#start(value) ⇒ self
Timestamp to start listing from.
-
#starthexsortkey(value) ⇒ self
Sortkey to start listing from, as returned by cmprop=sortkey.
-
#startsortkey(value) ⇒ self
Use cmstarthexsortkey instead.
-
#startsortkeyprefix(value) ⇒ self
Sortkey prefix to start listing from.
-
#title(value) ⇒ self
Which category to enumerate (required).
-
#type(*values) ⇒ self
Which type of category members to include.
Instance Method Details
#continue(value) ⇒ self
When more results are available, use this to continue.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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 |