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
@private
# 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
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
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 contents.
@param value [String] @return [self]
# File lib/mediawiktory/wikipedia/actions/upload.rb, line 145 def chunk(value) merge(chunk: value.to_s) end
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 contents.
@param value [String] @return [self]
# File lib/mediawiktory/wikipedia/actions/upload.rb, line 90 def file(value) merge(file: value.to_s) end
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
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 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
Ignore any warnings.
@return [self]
# File lib/mediawiktory/wikipedia/actions/upload.rb, line 82 def ignorewarnings() merge(ignorewarnings: 'true') end
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
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
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
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
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 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
the page.
@return [self]
# File lib/mediawiktory/wikipedia/actions/upload.rb, line 62 def watch() merge(watch: 'true') end
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