Class: MediaWiktory::Wikipedia::Actions::Globalblock
- Defined in:
- lib/mediawiktory/wikipedia/actions/globalblock.rb
Overview
Globally block or unblock a user.
Usage:
api.globalblock.target(value).perform # returns string with raw output
# or
api.globalblock.target(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
-
#anononly ⇒ self
Specify this if the block should only affect logged-out users.
-
#expiry(value) ⇒ self
If specified, will block or reblock the user.
-
#modify ⇒ self
Specify this if the existing block on the target should be modified.
-
#reason(value) ⇒ self
The reason for blocking/unblocking.
-
#target(value) ⇒ self
The target IP address.
-
#token(value) ⇒ self
A "csrf" token retrieved from action=query&meta=tokens.
-
#unblock ⇒ self
If specified, will unblock the user.
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
#anononly ⇒ self
Specify this if the block should only affect logged-out users.
56 57 58 |
# File 'lib/mediawiktory/wikipedia/actions/globalblock.rb', line 56 def anononly() merge(anononly: 'true') end |
#expiry(value) ⇒ self
If specified, will block or reblock the user. Determines how long the block will last for, e.g. "5 months" or "2 weeks". If set to "infinite" or "indefinite" the block will never expire.
34 35 36 |
# File 'lib/mediawiktory/wikipedia/actions/globalblock.rb', line 34 def expiry(value) merge(expiry: value.to_s) end |
#modify ⇒ self
Specify this if the existing block on the target should be modified
63 64 65 |
# File 'lib/mediawiktory/wikipedia/actions/globalblock.rb', line 63 def modify() merge(modify: 'true') end |
#reason(value) ⇒ self
The reason for blocking/unblocking.
49 50 51 |
# File 'lib/mediawiktory/wikipedia/actions/globalblock.rb', line 49 def reason(value) merge(reason: value.to_s) end |
#target(value) ⇒ self
The target IP address.
26 27 28 |
# File 'lib/mediawiktory/wikipedia/actions/globalblock.rb', line 26 def target(value) merge(target: value.to_s) end |
#token(value) ⇒ self
A "csrf" token retrieved from action=query&meta=tokens
71 72 73 |
# File 'lib/mediawiktory/wikipedia/actions/globalblock.rb', line 71 def token(value) merge(token: value.to_s) end |
#unblock ⇒ self
If specified, will unblock the user.
41 42 43 |
# File 'lib/mediawiktory/wikipedia/actions/globalblock.rb', line 41 def unblock() merge(unblock: 'true') end |