class MediaWiktory::Wikipedia::Actions::Upload

Upload a file, or get the status of pending uploads.

Usage:

“`ruby api.upload.filename(value).perform # returns string with raw output # or api.upload.filename(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

_tags(value) click to toggle source

@private

Calls superclass method
# File lib/mediawiktory/wikipedia/actions/upload.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
_watchlist(value) click to toggle source

@private

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

Make potentially large file operations asynchronous when possible.

@return [self]

# File lib/mediawiktory/wikipedia/actions/upload.rb, line 152
def async()
  merge(async: 'true')
end
checkstatus() click to toggle source

Only fetch the upload status for the given file key.

@return [self]

# File lib/mediawiktory/wikipedia/actions/upload.rb, line 159
def checkstatus()
  merge(checkstatus: 'true')
end
chunk(value) click to toggle source

Chunk contents.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/upload.rb, line 145
def chunk(value)
  merge(chunk: value.to_s)
end
comment(value) click to toggle source

Upload comment. Also used as the initial page text for new files if text is not specified.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/upload.rb, line 34
def comment(value)
  merge(comment: value.to_s)
end
file(value) click to toggle source

File contents.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/upload.rb, line 90
def file(value)
  merge(file: value.to_s)
end
filekey(value) click to toggle source

Key that identifies a previous upload that was stashed temporarily.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/upload.rb, line 106
def filekey(value)
  merge(filekey: value.to_s)
end
filename(value) click to toggle source

Target filename.

@param value [String] @return [self]

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

Filesize of entire upload.

@param value [Integer] @return [self]

# File lib/mediawiktory/wikipedia/actions/upload.rb, line 129
def filesize(value)
  merge(filesize: value.to_s)
end
ignorewarnings() click to toggle source

Ignore any warnings.

@return [self]

# File lib/mediawiktory/wikipedia/actions/upload.rb, line 82
def ignorewarnings()
  merge(ignorewarnings: 'true')
end
offset(value) click to toggle source

Offset of chunk in bytes.

@param value [Integer] @return [self]

# File lib/mediawiktory/wikipedia/actions/upload.rb, line 137
def offset(value)
  merge(offset: value.to_s)
end
sessionkey(value) click to toggle source

Same as filekey, maintained for backward compatibility.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/upload.rb, line 114
def sessionkey(value)
  merge(sessionkey: value.to_s)
end
stash() click to toggle source

If set, the server will stash the file temporarily instead of adding it to the repository.

@return [self]

# File lib/mediawiktory/wikipedia/actions/upload.rb, line 121
def stash()
  merge(stash: 'true')
end
tags(*values) click to toggle source

Change tags to apply to the upload log entry and file page revision.

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

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

Initial page text for new files.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/upload.rb, line 55
def text(value)
  merge(text: 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/upload.rb, line 167
def token(value)
  merge(token: value.to_s)
end
url(value) click to toggle source

URL to fetch the file from.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/upload.rb, line 98
def url(value)
  merge(url: value.to_s)
end
watch() click to toggle source

Watch the page.

@return [self]

# File lib/mediawiktory/wikipedia/actions/upload.rb, line 62
def watch()
  merge(watch: 'true')
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”, “preferences”, “nochange”. @return [self]

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