Class: MediaWiktory::Wikipedia::Actions::Userrights
- 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
-
#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.
-
#expiry(*values) ⇒ self
Expiry timestamps.
-
#reason(value) ⇒ self
Reason for the change.
-
#remove(*values) ⇒ self
Remove the user from these groups.
-
#tags(*values) ⇒ self
Change tags to apply to the entry in the user rights log.
-
#token(value) ⇒ self
A "userrights" token retrieved from action=query&meta=tokens.
-
#user(value) ⇒ self
User name.
-
#userid(value) ⇒ self
User ID.
Methods inherited from Post
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.
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.
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.
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.
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.
97 98 99 |
# File 'lib/mediawiktory/wikipedia/actions/userrights.rb', line 97 def (*values) values.inject(self) { |res, val| res.(val) or fail ArgumentError, "Unknown value for tags: #{val}" } end |
#token(value) ⇒ self
A "userrights" token retrieved from action=query&meta=tokens
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.
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.
34 35 36 |
# File 'lib/mediawiktory/wikipedia/actions/userrights.rb', line 34 def userid(value) merge(userid: value.to_s) end |