Class: MediaWiktory::Wikipedia::Actions::Globalblock

Inherits:
Post
  • Object
show all
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

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

#anononlyself

Specify this if the block should only affect logged-out users.

Returns:

  • (self)


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.

Parameters:

  • value (String)

Returns:

  • (self)


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

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

#modifyself

Specify this if the existing block on the target should be modified

Returns:

  • (self)


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.

Parameters:

  • value (String)

Returns:

  • (self)


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.

Parameters:

  • value (String)

Returns:

  • (self)


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

Parameters:

  • value (String)

Returns:

  • (self)


71
72
73
# File 'lib/mediawiktory/wikipedia/actions/globalblock.rb', line 71

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

#unblockself

If specified, will unblock the user.

Returns:

  • (self)


41
42
43
# File 'lib/mediawiktory/wikipedia/actions/globalblock.rb', line 41

def unblock()
  merge(unblock: 'true')
end