Class: MediaWiktory::Wikipedia::Actions::Watch
- Defined in:
- lib/mediawiktory/wikipedia/actions/watch.rb
Overview
Add or remove pages from the current user's watchlist.
Usage:
api.watch.title(value).perform # returns string with raw output
# or
api.watch.title(value).response # returns output parsed and wrapped into Response object
See Base for generic explanation of working with MediaWiki actions and Response for working with action responses.
All action'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.
-
#converttitles ⇒ self
Convert titles to other variants if necessary.
-
#generator(value) ⇒ self
Get the list of pages to work on by executing the specified query module.
-
#pageids(*values) ⇒ self
A list of page IDs to work on.
-
#redirects ⇒ self
Automatically resolve redirects in titles, pageids, and revids, and in pages returned by generator.
-
#revids(*values) ⇒ self
A list of revision IDs to work on.
-
#title(value) ⇒ self
The page to (un)watch.
-
#titles(*values) ⇒ self
A list of titles to work on.
-
#token(value) ⇒ self
A "watch" token retrieved from action=query&meta=tokens.
-
#unwatch ⇒ self
If set the page will be unwatched rather than watched.
Methods inherited from Post
Methods inherited from Base
#inspect, #merge, #name, #perform, #response, #to_h, #to_param, #to_url
Methods included from GlobalParams
#assert, #assertuser, #centralauthtoken, #curtimestamp, #errorformat, #errorlang, #errorsuselocal, #format, #maxage, #maxlag, #origin, #requestid, #responselanginfo, #servedby, #smaxage, #uselang
Instance Method Details
#continue(value) ⇒ self
When more results are available, use this to continue.
41 42 43 |
# File 'lib/mediawiktory/wikipedia/actions/watch.rb', line 41 def continue(value) merge(continue: value.to_s) end |
#converttitles ⇒ self
Convert titles to other variants if necessary. Only works if the wiki's content language supports variant conversion. Languages that support variant conversion include gan, iu, kk, ku, shi, sr, tg, uz and zh.
151 152 153 |
# File 'lib/mediawiktory/wikipedia/actions/watch.rb', line 151 def converttitles() merge(converttitles: 'true') end |
#generator(value) ⇒ self
Get the list of pages to work on by executing the specified query module.
132 133 134 |
# File 'lib/mediawiktory/wikipedia/actions/watch.rb', line 132 def generator(value) _generator(value) or fail ArgumentError, "Unknown value for generator: #{value}" end |
#pageids(*values) ⇒ self
A list of page IDs to work on.
62 63 64 |
# File 'lib/mediawiktory/wikipedia/actions/watch.rb', line 62 def pageids(*values) values.inject(self) { |res, val| res._pageids(val) } end |
#redirects ⇒ self
Automatically resolve redirects in titles, pageids, and revids, and in pages returned by generator.
144 145 146 |
# File 'lib/mediawiktory/wikipedia/actions/watch.rb', line 144 def redirects() merge(redirects: 'true') end |
#revids(*values) ⇒ self
A list of revision IDs to work on.
75 76 77 |
# File 'lib/mediawiktory/wikipedia/actions/watch.rb', line 75 def revids(*values) values.inject(self) { |res, val| res._revids(val) } end |
#title(value) ⇒ self
The page to (un)watch. Use titles instead.
26 27 28 |
# File 'lib/mediawiktory/wikipedia/actions/watch.rb', line 26 def title(value) merge(title: value.to_s) end |
#titles(*values) ⇒ self
A list of titles to work on.
49 50 51 |
# File 'lib/mediawiktory/wikipedia/actions/watch.rb', line 49 def titles(*values) values.inject(self) { |res, val| res._titles(val) } end |
#token(value) ⇒ self
A "watch" token retrieved from action=query&meta=tokens
159 160 161 |
# File 'lib/mediawiktory/wikipedia/actions/watch.rb', line 159 def token(value) merge(token: value.to_s) end |
#unwatch ⇒ self
If set the page will be unwatched rather than watched.
33 34 35 |
# File 'lib/mediawiktory/wikipedia/actions/watch.rb', line 33 def unwatch() merge(unwatch: 'true') end |