Class: MediaWiktory::Wikipedia::Actions::Delete
- Defined in:
- lib/mediawiktory/wikipedia/actions/delete.rb
Overview
Delete a page.
Usage:
api.delete.title(value).perform # returns string with raw output
# or
api.delete.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
-
#oldimage(value) ⇒ self
The name of the old image to delete as provided by action=query&prop=imageinfo&iiprop=archivename.
-
#pageid(value) ⇒ self
Page ID of the page to delete.
-
#reason(value) ⇒ self
Reason for the deletion.
-
#tags(*values) ⇒ self
Change tags to apply to the entry in the deletion log.
-
#title(value) ⇒ self
Title of the page to delete.
-
#token(value) ⇒ self
A "csrf" token retrieved from action=query&meta=tokens.
-
#unwatch ⇒ self
Remove the page from the current user's watchlist.
-
#watch ⇒ self
Add the page to the current user's watchlist.
-
#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
#oldimage(value) ⇒ self
The name of the old image to delete as provided by action=query&prop=imageinfo&iiprop=archivename.
90 91 92 |
# File 'lib/mediawiktory/wikipedia/actions/delete.rb', line 90 def oldimage(value) merge(oldimage: value.to_s) end |
#pageid(value) ⇒ self
Page ID of the page to delete. Cannot be used together with title.
34 35 36 |
# File 'lib/mediawiktory/wikipedia/actions/delete.rb', line 34 def pageid(value) merge(pageid: value.to_s) end |
#reason(value) ⇒ self
Reason for the deletion. If not set, an automatically generated reason will be used.
42 43 44 |
# File 'lib/mediawiktory/wikipedia/actions/delete.rb', line 42 def reason(value) merge(reason: value.to_s) end |
#tags(*values) ⇒ self
Change tags to apply to the entry in the deletion log.
50 51 52 |
# File 'lib/mediawiktory/wikipedia/actions/delete.rb', line 50 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 delete. Cannot be used together with pageid.
26 27 28 |
# File 'lib/mediawiktory/wikipedia/actions/delete.rb', line 26 def title(value) merge(title: value.to_s) end |
#token(value) ⇒ self
A "csrf" token retrieved from action=query&meta=tokens
98 99 100 |
# File 'lib/mediawiktory/wikipedia/actions/delete.rb', line 98 def token(value) merge(token: value.to_s) end |
#unwatch ⇒ self
Remove the page from the current user's watchlist.
82 83 84 |
# File 'lib/mediawiktory/wikipedia/actions/delete.rb', line 82 def unwatch() merge(unwatch: 'true') end |
#watch ⇒ self
Add the page to the current user's watchlist.
62 63 64 |
# File 'lib/mediawiktory/wikipedia/actions/delete.rb', line 62 def watch() merge(watch: 'true') end |
#watchlist(value) ⇒ self
Unconditionally add or remove the page from the current user's watchlist, use preferences or do not change watch.
70 71 72 |
# File 'lib/mediawiktory/wikipedia/actions/delete.rb', line 70 def watchlist(value) _watchlist(value) or fail ArgumentError, "Unknown value for watchlist: #{value}" end |