Module: MediaWiktory::Wikipedia::Modules::Categorymembers
- Defined in:
- lib/mediawiktory/wikipedia/modules/categorymembers.rb
Overview
List all pages in a given category.
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.
-
#prop(*values) ⇒ self
Which pieces of information to include:.
-
#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.
80 81 82 |
# File 'lib/mediawiktory/wikipedia/modules/categorymembers.rb', line 80 def continue(value) merge(cmcontinue: value.to_s) end |
#dir(value) ⇒ self
In which direction to sort.
109 110 111 |
# File 'lib/mediawiktory/wikipedia/modules/categorymembers.rb', line 109 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.
130 131 132 |
# File 'lib/mediawiktory/wikipedia/modules/categorymembers.rb', line 130 def end(value) merge(cmend: value.iso8601) end |
#endhexsortkey(value) ⇒ self
Sortkey to end listing at, as returned by cmprop=sortkey. Can only be used with cmsort=sortkey.
146 147 148 |
# File 'lib/mediawiktory/wikipedia/modules/categorymembers.rb', line 146 def endhexsortkey(value) merge(cmendhexsortkey: value.to_s) end |
#endsortkey(value) ⇒ self
Use cmendhexsortkey instead.
178 179 180 |
# File 'lib/mediawiktory/wikipedia/modules/categorymembers.rb', line 178 def endsortkey(value) merge(cmendsortkey: 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.
162 163 164 |
# File 'lib/mediawiktory/wikipedia/modules/categorymembers.rb', line 162 def endsortkeyprefix(value) merge(cmendsortkeyprefix: value.to_s) end |
#limit(value) ⇒ self
The maximum number of pages to return.
88 89 90 |
# File 'lib/mediawiktory/wikipedia/modules/categorymembers.rb', line 88 def limit(value) merge(cmlimit: 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.
54 55 56 |
# File 'lib/mediawiktory/wikipedia/modules/categorymembers.rb', line 54 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/categorymembers.rb', line 33 def pageid(value) merge(cmpageid: value.to_s) end |
#prop(*values) ⇒ self
Which pieces of information to include:
41 42 43 |
# File 'lib/mediawiktory/wikipedia/modules/categorymembers.rb', line 41 def prop(*values) values.inject(self) { |res, val| res._prop(val) or fail ArgumentError, "Unknown value for prop: #{val}" } end |
#sort(value) ⇒ self
Property to sort by.
96 97 98 |
# File 'lib/mediawiktory/wikipedia/modules/categorymembers.rb', line 96 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.
122 123 124 |
# File 'lib/mediawiktory/wikipedia/modules/categorymembers.rb', line 122 def start(value) merge(cmstart: value.iso8601) end |
#starthexsortkey(value) ⇒ self
Sortkey to start listing from, as returned by cmprop=sortkey. Can only be used with cmsort=sortkey.
138 139 140 |
# File 'lib/mediawiktory/wikipedia/modules/categorymembers.rb', line 138 def starthexsortkey(value) merge(cmstarthexsortkey: value.to_s) end |
#startsortkey(value) ⇒ self
Use cmstarthexsortkey instead.
170 171 172 |
# File 'lib/mediawiktory/wikipedia/modules/categorymembers.rb', line 170 def startsortkey(value) merge(cmstartsortkey: value.to_s) end |
#startsortkeyprefix(value) ⇒ self
Sortkey prefix to start listing from. Can only be used with cmsort=sortkey. Overrides cmstarthexsortkey.
154 155 156 |
# File 'lib/mediawiktory/wikipedia/modules/categorymembers.rb', line 154 def startsortkeyprefix(value) merge(cmstartsortkeyprefix: 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/categorymembers.rb', line 25 def title(value) merge(cmtitle: value.to_s) end |
#type(*values) ⇒ self
Which type of category members to include. Ignored when cmsort=timestamp is set.
67 68 69 |
# File 'lib/mediawiktory/wikipedia/modules/categorymembers.rb', line 67 def type(*values) values.inject(self) { |res, val| res._type(val) or fail ArgumentError, "Unknown value for type: #{val}" } end |