Class: MediaWiktory::Wikipedia::Actions::Userrights

Inherits:
Post
  • Object
show all
Defined in:
lib/mediawiktory/wikipedia/actions/userrights.rb

Overview

Change a user's group membership.

Usage:

api.userrights.user(value).perform # returns string with raw output
# or
api.userrights.user(value).response # returns output parsed and wrapped into Response object

See Base for generic explanation of working with MediaWiki actions and Response for working with action responses.

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

Instance Method Summary collapse

Methods inherited from Post

#perform

Methods inherited from Base

#inspect, #merge, #name, #perform, #response, #to_h, #to_param, #to_url

Methods included from GlobalParams

#assert, #assertuser, #centralauthtoken, #curtimestamp, #errorformat, #errorlang, #errorsuselocal, #format, #maxage, #maxlag, #origin, #requestid, #responselanginfo, #servedby, #smaxage, #uselang

Instance Method Details

#add(*values) ⇒ self

Add the user to these groups, or if they are already a member, update the expiry of their membership in that group.

Parameters:

  • values (Array<String>)

    Allowed values: "bot", "sysop", "bureaucrat", "reviewer", "steward", "accountcreator", "import", "transwiki", "ipblock-exempt", "oversight", "founder", "rollbacker", "autoreviewer", "researcher", "filemover", "checkuser", "templateeditor", "massmessage-sender", "extendedconfirmed", "extendedmover", "patroller", "abusefilter", "confirmed", "epcoordinator", "eponline", "epcampus", "epinstructor".

Returns:

  • (self)


42
43
44
# File 'lib/mediawiktory/wikipedia/actions/userrights.rb', line 42

def add(*values)
  values.inject(self) { |res, val| res._add(val) or fail ArgumentError, "Unknown value for add: #{val}" }
end

#expiry(*values) ⇒ self

Expiry timestamps. May be relative (e.g. 5 months or 2 weeks) or absolute (e.g. 2014-09-18T12:34:56Z). If only one timestamp is set, it will be used for all groups passed to the add parameter. Use infinite, indefinite, infinity, or never for a never-expiring user group.

Parameters:

  • values (Array<String>)

Returns:

  • (self)


55
56
57
# File 'lib/mediawiktory/wikipedia/actions/userrights.rb', line 55

def expiry(*values)
  values.inject(self) { |res, val| res._expiry(val) }
end

#reason(value) ⇒ self

Reason for the change.

Parameters:

  • value (String)

Returns:

  • (self)


81
82
83
# File 'lib/mediawiktory/wikipedia/actions/userrights.rb', line 81

def reason(value)
  merge(reason: value.to_s)
end

#remove(*values) ⇒ self

Remove the user from these groups.

Parameters:

  • values (Array<String>)

    Allowed values: "bot", "sysop", "bureaucrat", "reviewer", "steward", "accountcreator", "import", "transwiki", "ipblock-exempt", "oversight", "founder", "rollbacker", "autoreviewer", "researcher", "filemover", "checkuser", "templateeditor", "massmessage-sender", "extendedconfirmed", "extendedmover", "patroller", "abusefilter", "confirmed", "epcoordinator", "eponline", "epcampus", "epinstructor".

Returns:

  • (self)


68
69
70
# File 'lib/mediawiktory/wikipedia/actions/userrights.rb', line 68

def remove(*values)
  values.inject(self) { |res, val| res._remove(val) or fail ArgumentError, "Unknown value for remove: #{val}" }
end

#tags(*values) ⇒ self

Change tags to apply to the entry in the user rights log.

Parameters:

  • values (Array<String>)

    Allowed values: "ProveIt edit", "WPCleaner", "huggle", "large plot addition".

Returns:

  • (self)


97
98
99
# File 'lib/mediawiktory/wikipedia/actions/userrights.rb', line 97

def tags(*values)
  values.inject(self) { |res, val| res._tags(val) or fail ArgumentError, "Unknown value for tags: #{val}" }
end

#token(value) ⇒ self

A "userrights" token retrieved from action=query&meta=tokens

Parameters:

  • value (String)

Returns:

  • (self)


89
90
91
# File 'lib/mediawiktory/wikipedia/actions/userrights.rb', line 89

def token(value)
  merge(token: value.to_s)
end

#user(value) ⇒ self

User name.

Parameters:

  • value (String)

Returns:

  • (self)


26
27
28
# File 'lib/mediawiktory/wikipedia/actions/userrights.rb', line 26

def user(value)
  merge(user: value.to_s)
end

#userid(value) ⇒ self

User ID.

Parameters:

  • value (Integer)

Returns:

  • (self)


34
35
36
# File 'lib/mediawiktory/wikipedia/actions/userrights.rb', line 34

def userid(value)
  merge(userid: value.to_s)
end