Class: MediaWiktory::Wikipedia::Actions::Block
- Defined in:
- lib/mediawiktory/wikipedia/actions/block.rb
Overview
Block a user.
Usage:
api.block.user(value).perform # returns string with raw output
# or
api.block.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
-
#allowusertalk ⇒ self
Allow the user to edit their own talk page (depends on $wgBlockAllowsUTEdit).
-
#anononly ⇒ self
Block anonymous users only (i.e. disable anonymous edits for this IP address).
-
#autoblock ⇒ self
Automatically block the last used IP address, and any subsequent IP addresses they try to login from.
-
#expiry(value) ⇒ self
Expiry time.
-
#hidename ⇒ self
Hide the username from the block log.
-
#nocreate ⇒ self
Prevent account creation.
-
#noemail ⇒ self
Prevent user from sending email through the wiki.
-
#reason(value) ⇒ self
Reason for block.
-
#reblock ⇒ self
If the user is already blocked, overwrite the existing block.
-
#tags(*values) ⇒ self
Change tags to apply to the entry in the block log.
-
#token(value) ⇒ self
A "csrf" token retrieved from action=query&meta=tokens.
-
#user(value) ⇒ self
Username, IP address, or IP address range to block.
-
#userid(value) ⇒ self
User ID to block.
-
#watchuser ⇒ self
Watch the user's or IP address's user and talk pages.
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
#allowusertalk ⇒ self
Allow the user to edit their own talk page (depends on $wgBlockAllowsUTEdit).
92 93 94 |
# File 'lib/mediawiktory/wikipedia/actions/block.rb', line 92 def allowusertalk() merge(allowusertalk: 'true') end |
#anononly ⇒ self
Block anonymous users only (i.e. disable anonymous edits for this IP address).
57 58 59 |
# File 'lib/mediawiktory/wikipedia/actions/block.rb', line 57 def anononly() merge(anononly: 'true') end |
#autoblock ⇒ self
Automatically block the last used IP address, and any subsequent IP addresses they try to login from.
71 72 73 |
# File 'lib/mediawiktory/wikipedia/actions/block.rb', line 71 def autoblock() merge(autoblock: 'true') end |
#expiry(value) ⇒ self
Expiry time. May be relative (e.g. 5 months or 2 weeks) or absolute (e.g. 2014-09-18T12:34:56Z). If set to infinite, indefinite, or never, the block will never expire.
42 43 44 |
# File 'lib/mediawiktory/wikipedia/actions/block.rb', line 42 def expiry(value) merge(expiry: value.to_s) end |
#hidename ⇒ self
Hide the username from the block log. (Requires the hideuser right).
85 86 87 |
# File 'lib/mediawiktory/wikipedia/actions/block.rb', line 85 def hidename() merge(hidename: 'true') end |
#nocreate ⇒ self
Prevent account creation.
64 65 66 |
# File 'lib/mediawiktory/wikipedia/actions/block.rb', line 64 def nocreate() merge(nocreate: 'true') end |
#noemail ⇒ self
Prevent user from sending email through the wiki. (Requires the blockemail right).
78 79 80 |
# File 'lib/mediawiktory/wikipedia/actions/block.rb', line 78 def noemail() merge(noemail: 'true') end |
#reason(value) ⇒ self
Reason for block.
50 51 52 |
# File 'lib/mediawiktory/wikipedia/actions/block.rb', line 50 def reason(value) merge(reason: value.to_s) end |
#reblock ⇒ self
If the user is already blocked, overwrite the existing block.
99 100 101 |
# File 'lib/mediawiktory/wikipedia/actions/block.rb', line 99 def reblock() merge(reblock: 'true') end |
#tags(*values) ⇒ self
Change tags to apply to the entry in the block log.
114 115 116 |
# File 'lib/mediawiktory/wikipedia/actions/block.rb', line 114 def (*values) values.inject(self) { |res, val| res.(val) or fail ArgumentError, "Unknown value for tags: #{val}" } end |
#token(value) ⇒ self
A "csrf" token retrieved from action=query&meta=tokens
127 128 129 |
# File 'lib/mediawiktory/wikipedia/actions/block.rb', line 127 def token(value) merge(token: value.to_s) end |
#user(value) ⇒ self
Username, IP address, or IP address range to block. Cannot be used together with userid
26 27 28 |
# File 'lib/mediawiktory/wikipedia/actions/block.rb', line 26 def user(value) merge(user: value.to_s) end |
#userid(value) ⇒ self
User ID to block. Cannot be used together with user.
34 35 36 |
# File 'lib/mediawiktory/wikipedia/actions/block.rb', line 34 def userid(value) merge(userid: value.to_s) end |
#watchuser ⇒ self
Watch the user's or IP address's user and talk pages.
106 107 108 |
# File 'lib/mediawiktory/wikipedia/actions/block.rb', line 106 def watchuser() merge(watchuser: 'true') end |