Class: MediaWiktory::Wikipedia::Actions::Move

Inherits:
Post
  • Object
show all
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

Methods inherited from Post

#perform

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.

Parameters:

  • value (String)

Returns:

  • (self)


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.

Parameters:

  • value (Integer)

Returns:

  • (self)


34
35
36
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 34

def fromid(value)
  merge(fromid: value.to_s)
end

#ignorewarningsself

Ignore any warnings.

Returns:

  • (self)


105
106
107
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 105

def ignorewarnings()
  merge(ignorewarnings: 'true')
end

#movesubpagesself

Rename subpages, if applicable.

Returns:

  • (self)


64
65
66
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 64

def movesubpages()
  merge(movesubpages: 'true')
end

#movetalkself

Rename the talk page, if it exists.

Returns:

  • (self)


57
58
59
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 57

def movetalk()
  merge(movetalk: 'true')
end

#noredirectself

Don't create a redirect.

Returns:

  • (self)


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.

Parameters:

  • value (String)

Returns:

  • (self)


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.

Parameters:

  • values (Array<String>)

    Allowed values: "ProveIt edit", "WPCleaner", "huggle", "large plot addition".

Returns:

  • (self)


113
114
115
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 113

def tags(*values)
  values.inject(self) { |res, val| res._tags(val) or fail ArgumentError, "Unknown value for tags: #{val}" }
end

#to(value) ⇒ self

Title to rename the page to.

Parameters:

  • value (String)

Returns:

  • (self)


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

Parameters:

  • value (String)

Returns:

  • (self)


126
127
128
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 126

def token(value)
  merge(token: value.to_s)
end

#unwatchself

Remove the page and the redirect from the current user's watchlist.

Returns:

  • (self)


85
86
87
# File 'lib/mediawiktory/wikipedia/actions/move.rb', line 85

def unwatch()
  merge(unwatch: 'true')
end

#watchself

Add the page and the redirect to the current user's watchlist.

Returns:

  • (self)


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.

Parameters:

  • value (String)

    One of "watch", "unwatch", "preferences", "nochange".

Returns:

  • (self)


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