Class: MediaWiktory::Wikipedia::Actions::Rollback
- Defined in:
- lib/mediawiktory/wikipedia/actions/rollback.rb
Overview
Undo the last edit to the page.
Usage:
api.rollback.title(value).perform # returns string with raw output
# or
api.rollback.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
-
#markbot ⇒ self
Mark the reverted edits and the revert as bot edits.
-
#pageid(value) ⇒ self
Page ID of the page to roll back.
-
#summary(value) ⇒ self
Custom edit summary.
-
#tags(*values) ⇒ self
Tags to apply to the rollback.
-
#title(value) ⇒ self
Title of the page to roll back.
-
#token(value) ⇒ self
A "rollback" token retrieved from action=query&meta=tokens.
-
#user(value) ⇒ self
Name of the user whose edits are to be rolled back.
-
#watchlist(value) ⇒ self
Unconditionally add or remove the page from the current user's watchlist, use preferences or do not change watch.
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
#markbot ⇒ self
Mark the reverted edits and the revert as bot edits.
70 71 72 |
# File 'lib/mediawiktory/wikipedia/actions/rollback.rb', line 70 def markbot() merge(markbot: 'true') end |
#pageid(value) ⇒ self
Page ID of the page to roll back. Cannot be used together with title.
34 35 36 |
# File 'lib/mediawiktory/wikipedia/actions/rollback.rb', line 34 def pageid(value) merge(pageid: value.to_s) end |
#summary(value) ⇒ self
Custom edit summary. If empty, default summary will be used.
63 64 65 |
# File 'lib/mediawiktory/wikipedia/actions/rollback.rb', line 63 def summary(value) merge(summary: value.to_s) end |
#tags(*values) ⇒ self
Tags to apply to the rollback.
42 43 44 |
# File 'lib/mediawiktory/wikipedia/actions/rollback.rb', line 42 def (*values) values.inject(self) { |res, val| res.(val) or fail ArgumentError, "Unknown value for tags: #{val}" } end |
#title(value) ⇒ self
Title of the page to roll back. Cannot be used together with pageid.
26 27 28 |
# File 'lib/mediawiktory/wikipedia/actions/rollback.rb', line 26 def title(value) merge(title: value.to_s) end |
#token(value) ⇒ self
A "rollback" token retrieved from action=query&meta=tokens
91 92 93 |
# File 'lib/mediawiktory/wikipedia/actions/rollback.rb', line 91 def token(value) merge(token: value.to_s) end |
#user(value) ⇒ self
Name of the user whose edits are to be rolled back.
55 56 57 |
# File 'lib/mediawiktory/wikipedia/actions/rollback.rb', line 55 def user(value) merge(user: value.to_s) end |
#watchlist(value) ⇒ self
Unconditionally add or remove the page from the current user's watchlist, use preferences or do not change watch.
78 79 80 |
# File 'lib/mediawiktory/wikipedia/actions/rollback.rb', line 78 def watchlist(value) _watchlist(value) or fail ArgumentError, "Unknown value for watchlist: #{value}" end |