module MediaWiktory::Wikipedia::Modules::Usercontribs
Get all edits by a user.
The “submodule” (MediaWiki API term) is included in action after setting some param, providing additional tweaking for this param. Example (for {MediaWiktory::Wikipedia::Actions::Query} and its submodules):
“`ruby api.query # returns Actions::Query
.prop(:revisions) # adds prop=revisions to action URL, and includes Modules::Revisions into action .limit(10) # method of Modules::Revisions, adds rvlimit=10 to URL
“`
All submodule's parameters are documented as its public methods, see below.
Public Instance Methods
@private
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 96 def _dir(value) defined?(super) && super || ["newer", "older"].include?(value.to_s) && merge(ucdir: value.to_s) end
@private
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 109 def _namespace(value) defined?(super) && super || ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "100", "101", "108", "109", "118", "119", "446", "447", "710", "711", "828", "829", "2300", "2301", "2302", "2303"].include?(value.to_s) && merge(ucnamespace: value.to_s, replace: false) end
@private
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 122 def _prop(value) defined?(super) && super || ["ids", "title", "timestamp", "comment", "parsedcomment", "size", "sizediff", "flags", "patrolled", "tags"].include?(value.to_s) && merge(ucprop: value.to_s, replace: false) end
@private
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 135 def _show(value) defined?(super) && super || ["minor", "!minor", "patrolled", "!patrolled", "top", "!top", "new", "!new"].include?(value.to_s) && merge(ucshow: value.to_s, replace: false) end
@private
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 62 def _user(value) merge(ucuser: value.to_s, replace: false) end
@private
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 75 def _userids(value) merge(ucuserids: value.to_s, replace: false) end
When more results are available, use this to continue.
@param value [String] @return [self]
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 49 def continue(value) merge(uccontinue: value.to_s) end
In which direction to enumerate:
@param value [String] One of “newer” (List oldest first. Note: ucstart has to be before ucend), “older” (List newest first (default). Note: ucstart has to be later than ucend). @return [self]
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 91 def dir(value) _dir(value) or fail ArgumentError, "Unknown value for dir: #{value}" end
The end timestamp to return to.
@param value [Time] @return [self]
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 41 def end(value) merge(ucend: value.iso8601) end
The maximum number of contributions to return.
@param value [Integer, “max”] @return [self]
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 25 def limit(value) merge(uclimit: value.to_s) end
Only list contributions in these namespaces.
@param values [Array<String>] Allowed values: “0”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “10”, “11”, “12”, “13”, “14”, “15”, “100”, “101”, “108”, “109”, “118”, “119”, “446”, “447”, “710”, “711”, “828”, “829”, “2300”, “2301”, “2302”, “2303”. @return [self]
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 104 def namespace(*values) values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, "Unknown value for namespace: #{val}" } end
Include additional pieces of information:
@param values [Array<String>] Allowed values: “ids” (Adds the page ID and revision ID), “title” (Adds the title and namespace ID of the page), “timestamp” (Adds the timestamp of the edit), “comment” (Adds the comment of the edit), “parsedcomment” (Adds the parsed comment of the edit), “size” (Adds the new size of the edit), “sizediff” (Adds the size delta of the edit against its parent), “flags” (Adds flags of the edit), “patrolled” (Tags
patrolled edits), “tags” (Lists tags for the edit). @return [self]
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 117 def prop(*values) values.inject(self) { |res, val| res._prop(val) or fail ArgumentError, "Unknown value for prop: #{val}" } end
Show only items that meet these criteria, e.g. non minor edits only: ucshow=!minor.
@param values [Array<String>] Allowed values: “minor”, “!minor”, “patrolled”, “!patrolled”, “top”, “!top”, “new”, “!new”. @return [self]
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 130 def show(*values) values.inject(self) { |res, val| res._show(val) or fail ArgumentError, "Unknown value for show: #{val}" } end
The start timestamp to return from.
@param value [Time] @return [self]
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 33 def start(value) merge(ucstart: value.iso8601) end
Only list revisions tagged with this tag.
@param value [String] @return [self]
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 143 def tag(value) merge(uctag: value.to_s) end
Only list changes which are the latest revision.
@return [self]
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 150 def toponly() merge(uctoponly: 'true') end
The users to retrieve contributions for. Cannot be used with ucuserids or ucuserprefix.
@param values [Array<String>] @return [self]
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 57 def user(*values) values.inject(self) { |res, val| res._user(val) } end
The user IDs to retrieve contributions for. Cannot be used with ucuser or ucuserprefix.
@param values [Array<Integer>] @return [self]
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 70 def userids(*values) values.inject(self) { |res, val| res._userids(val) } end
Retrieve contributions for all users whose names begin with this value. Cannot be used with ucuser or ucuserids.
@param value [String] @return [self]
# File lib/mediawiktory/wikipedia/modules/usercontribs.rb, line 83 def userprefix(value) merge(ucuserprefix: value.to_s) end