class MediaWiktory::Wikipedia::Actions::Undelete

Restore revisions of a deleted page.

Usage:

“`ruby api.undelete.title(value).perform # returns string with raw output # or api.undelete.title(value).response # returns output parsed and wrapped into Response object “`

See {Base} for generic explanation of working with MediaWiki actions and {MediaWiktory::Wikipedia::Response} for working with action responses.

All action's parameters are documented as its public methods, see below.

Public Instance Methods

_fileids(value) click to toggle source

@private

# File lib/mediawiktory/wikipedia/actions/undelete.rb, line 73
def _fileids(value)
  merge(fileids: value.to_s, replace: false)
end
_tags(value) click to toggle source

@private

Calls superclass method
# File lib/mediawiktory/wikipedia/actions/undelete.rb, line 47
def _tags(value)
  defined?(super) && super || ["ProveIt edit", "WPCleaner", "huggle", "large plot addition"].include?(value.to_s) && merge(tags: value.to_s, replace: false)
end
_timestamps(value) click to toggle source

@private

# File lib/mediawiktory/wikipedia/actions/undelete.rb, line 60
def _timestamps(value)
  merge(timestamps: value.iso8601, replace: false)
end
_watchlist(value) click to toggle source

@private

Calls superclass method
# File lib/mediawiktory/wikipedia/actions/undelete.rb, line 86
def _watchlist(value)
  defined?(super) && super || ["watch", "unwatch", "preferences", "nochange"].include?(value.to_s) && merge(watchlist: value.to_s)
end
fileids(*values) click to toggle source

IDs of the file revisions to restore. If both timestamps and fileids are empty, all will be restored.

@param values [Array<Integer>] @return [self]

# File lib/mediawiktory/wikipedia/actions/undelete.rb, line 68
def fileids(*values)
  values.inject(self) { |res, val| res._fileids(val) }
end
reason(value) click to toggle source

Reason for restoring.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/undelete.rb, line 34
def reason(value)
  merge(reason: value.to_s)
end
tags(*values) click to toggle source

Change tags to apply to the entry in the deletion log.

@param values [Array<String>] Allowed values: “ProveIt edit”, “WPCleaner”, “huggle”, “large plot addition”. @return [self]

# File lib/mediawiktory/wikipedia/actions/undelete.rb, line 42
def tags(*values)
  values.inject(self) { |res, val| res._tags(val) or fail ArgumentError, "Unknown value for tags: #{val}" }
end
timestamps(*values) click to toggle source

Timestamps of the revisions to restore. If both timestamps and fileids are empty, all will be restored.

@param values [Array<Time>] @return [self]

# File lib/mediawiktory/wikipedia/actions/undelete.rb, line 55
def timestamps(*values)
  values.inject(self) { |res, val| res._timestamps(val) }
end
title(value) click to toggle source

Title of the page to restore.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/undelete.rb, line 26
def title(value)
  merge(title: value.to_s)
end
token(value) click to toggle source

A “csrf” token retrieved from action=query&meta=tokens

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/undelete.rb, line 94
def token(value)
  merge(token: value.to_s)
end
watchlist(value) click to toggle source

Unconditionally add or remove the page from the current user's watchlist, use preferences or do not change watch.

@param value [String] One of “watch”, “unwatch”, “preferences”, “nochange”. @return [self]

# File lib/mediawiktory/wikipedia/actions/undelete.rb, line 81
def watchlist(value)
  _watchlist(value) or fail ArgumentError, "Unknown value for watchlist: #{value}"
end