Class: MediaWiktory::Wikipedia::Actions::Move
- Defined in:
- lib/mediawiktory/wikipedia/actions/move.rb
Overview
Move a page.
Usage:
api.move.from(value).perform # returns string with raw output
# or
api.move.from(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
-
#from(value) ⇒ self
Title of the page to rename.
-
#fromid(value) ⇒ self
Page ID of the page to rename.
-
#ignorewarnings ⇒ self
Ignore any warnings.
-
#movesubpages ⇒ self
Rename subpages, if applicable.
-
#movetalk ⇒ self
Rename the talk page, if it exists.
-
#noredirect ⇒ self
Don't create a redirect.
-
#reason(value) ⇒ self
Reason for the rename.
-
#tags(*values) ⇒ self
Change tags to apply to the entry in the move log and to the null revision on the destination page.
-
#to(value) ⇒ self
Title to rename the page to.
-
#token(value) ⇒ self
A "csrf" token retrieved from action=query&meta=tokens.
-
#unwatch ⇒ self
Remove the page and the redirect from the current user's watchlist.
-
#watch ⇒ self
Add the page and the redirect 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
#from(value) ⇒ self
Title of the page to rename. Cannot be used together with fromid.
26 27 28 |
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 26 def from(value) merge(from: value.to_s) end |
#fromid(value) ⇒ self
Page ID of the page to rename. Cannot be used together with from.
34 35 36 |
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 34 def fromid(value) merge(fromid: value.to_s) end |
#ignorewarnings ⇒ self
Ignore any warnings.
105 106 107 |
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 105 def ignorewarnings() merge(ignorewarnings: 'true') end |
#movesubpages ⇒ self
Rename subpages, if applicable.
64 65 66 |
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 64 def movesubpages() merge(movesubpages: 'true') end |
#movetalk ⇒ self
Rename the talk page, if it exists.
57 58 59 |
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 57 def movetalk() merge(movetalk: 'true') end |
#noredirect ⇒ self
Don't create a redirect.
71 72 73 |
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 71 def noredirect() merge(noredirect: 'true') end |
#reason(value) ⇒ self
Reason for the rename.
50 51 52 |
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 50 def reason(value) merge(reason: value.to_s) end |
#tags(*values) ⇒ self
Change tags to apply to the entry in the move log and to the null revision on the destination page.
113 114 115 |
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 113 def (*values) values.inject(self) { |res, val| res.(val) or fail ArgumentError, "Unknown value for tags: #{val}" } end |
#to(value) ⇒ self
Title to rename the page to.
42 43 44 |
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 42 def to(value) merge(to: value.to_s) end |
#token(value) ⇒ self
A "csrf" token retrieved from action=query&meta=tokens
126 127 128 |
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 126 def token(value) merge(token: value.to_s) end |
#unwatch ⇒ self
Remove the page and the redirect from the current user's watchlist.
85 86 87 |
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 85 def unwatch() merge(unwatch: 'true') end |
#watch ⇒ self
Add the page and the redirect to the current user's watchlist.
78 79 80 |
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 78 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.
93 94 95 |
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 93 def watchlist(value) _watchlist(value) or fail ArgumentError, "Unknown value for watchlist: #{value}" end |