Module: MediaWiktory::Wikipedia::Modules::Usercontribs

Defined in:
lib/mediawiktory/wikipedia/modules/usercontribs.rb

Overview

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 Actions::Query and its submodules):

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.

Instance Method Summary collapse

Instance Method Details

#continue(value) ⇒ self

When more results are available, use this to continue.

Parameters:

  • value (String)

Returns:

  • (self)


49
50
51
# File 'lib/mediawiktory/wikipedia/modules/usercontribs.rb', line 49

def continue(value)
  merge(uccontinue: value.to_s)
end

#dir(value) ⇒ self

In which direction to enumerate:

Parameters:

  • 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).

Returns:

  • (self)


91
92
93
# File 'lib/mediawiktory/wikipedia/modules/usercontribs.rb', line 91

def dir(value)
  _dir(value) or fail ArgumentError, "Unknown value for dir: #{value}"
end

#end(value) ⇒ self

The end timestamp to return to.

Parameters:

  • value (Time)

Returns:

  • (self)


41
42
43
# File 'lib/mediawiktory/wikipedia/modules/usercontribs.rb', line 41

def end(value)
  merge(ucend: value.iso8601)
end

#limit(value) ⇒ self

The maximum number of contributions to return.

Parameters:

  • value (Integer, "max")

Returns:

  • (self)


25
26
27
# File 'lib/mediawiktory/wikipedia/modules/usercontribs.rb', line 25

def limit(value)
  merge(uclimit: value.to_s)
end

#namespace(*values) ⇒ self

Only list contributions in these namespaces.

Parameters:

  • 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".

Returns:

  • (self)


104
105
106
# 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

#prop(*values) ⇒ self

Include additional pieces of information:

Parameters:

  • 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).

Returns:

  • (self)


117
118
119
# 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(*values) ⇒ self

Show only items that meet these criteria, e.g. non minor edits only: ucshow=!minor.

Parameters:

  • values (Array<String>)

    Allowed values: "minor", "!minor", "patrolled", "!patrolled", "top", "!top", "new", "!new".

Returns:

  • (self)


130
131
132
# 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

#start(value) ⇒ self

The start timestamp to return from.

Parameters:

  • value (Time)

Returns:

  • (self)


33
34
35
# File 'lib/mediawiktory/wikipedia/modules/usercontribs.rb', line 33

def start(value)
  merge(ucstart: value.iso8601)
end

#tag(value) ⇒ self

Only list revisions tagged with this tag.

Parameters:

  • value (String)

Returns:

  • (self)


143
144
145
# File 'lib/mediawiktory/wikipedia/modules/usercontribs.rb', line 143

def tag(value)
  merge(uctag: value.to_s)
end

#toponlyself

Only list changes which are the latest revision.

Returns:

  • (self)


150
151
152
# File 'lib/mediawiktory/wikipedia/modules/usercontribs.rb', line 150

def toponly()
  merge(uctoponly: 'true')
end

#user(*values) ⇒ self

The users to retrieve contributions for. Cannot be used with ucuserids or ucuserprefix.

Parameters:

  • values (Array<String>)

Returns:

  • (self)


57
58
59
# File 'lib/mediawiktory/wikipedia/modules/usercontribs.rb', line 57

def user(*values)
  values.inject(self) { |res, val| res._user(val) }
end

#userids(*values) ⇒ self

The user IDs to retrieve contributions for. Cannot be used with ucuser or ucuserprefix.

Parameters:

  • values (Array<Integer>)

Returns:

  • (self)


70
71
72
# File 'lib/mediawiktory/wikipedia/modules/usercontribs.rb', line 70

def userids(*values)
  values.inject(self) { |res, val| res._userids(val) }
end

#userprefix(value) ⇒ self

Retrieve contributions for all users whose names begin with this value. Cannot be used with ucuser or ucuserids.

Parameters:

  • value (String)

Returns:

  • (self)


83
84
85
# File 'lib/mediawiktory/wikipedia/modules/usercontribs.rb', line 83

def userprefix(value)
  merge(ucuserprefix: value.to_s)
end