class MediaWiktory::Wikipedia::Actions::Block

Block a user.

Usage:

“`ruby 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 {MediaWiktory::Wikipedia::Response} for working with action responses.

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

Public Instance Methods

_tags(value) click to toggle source

@private

Calls superclass method
# File lib/mediawiktory/wikipedia/actions/block.rb, line 119
def _tags(value)
  defined?(super) && super || ["ProveIt edit", "WPCleaner", "huggle", "large plot addition"].include?(value.to_s) && merge(tags: value.to_s, replace: false)
end
allowusertalk() click to toggle source

Allow the user to edit their own talk page (depends on $wgBlockAllowsUTEdit).

@return [self]

# File lib/mediawiktory/wikipedia/actions/block.rb, line 92
def allowusertalk()
  merge(allowusertalk: 'true')
end
anononly() click to toggle source

Block anonymous users only (i.e. disable anonymous edits for this IP address).

@return [self]

# File lib/mediawiktory/wikipedia/actions/block.rb, line 57
def anononly()
  merge(anononly: 'true')
end
autoblock() click to toggle source

Automatically block the last used IP address, and any subsequent IP addresses they try to login from.

@return [self]

# File lib/mediawiktory/wikipedia/actions/block.rb, line 71
def autoblock()
  merge(autoblock: 'true')
end
expiry(value) click to toggle source

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.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/block.rb, line 42
def expiry(value)
  merge(expiry: value.to_s)
end
hidename() click to toggle source

Hide the username from the block log. (Requires the hideuser right).

@return [self]

# File lib/mediawiktory/wikipedia/actions/block.rb, line 85
def hidename()
  merge(hidename: 'true')
end
nocreate() click to toggle source

Prevent account creation.

@return [self]

# File lib/mediawiktory/wikipedia/actions/block.rb, line 64
def nocreate()
  merge(nocreate: 'true')
end
noemail() click to toggle source

Prevent user from sending email through the wiki. (Requires the blockemail right).

@return [self]

# File lib/mediawiktory/wikipedia/actions/block.rb, line 78
def noemail()
  merge(noemail: 'true')
end
reason(value) click to toggle source

Reason for block.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/block.rb, line 50
def reason(value)
  merge(reason: value.to_s)
end
reblock() click to toggle source

If the user is already blocked, overwrite the existing block.

@return [self]

# File lib/mediawiktory/wikipedia/actions/block.rb, line 99
def reblock()
  merge(reblock: 'true')
end
tags(*values) click to toggle source

Change tags to apply to the entry in the block log.

@param values [Array<String>] Allowed values: “ProveIt edit”, “WPCleaner”, “huggle”, “large plot addition”. @return [self]

# File lib/mediawiktory/wikipedia/actions/block.rb, line 114
def tags(*values)
  values.inject(self) { |res, val| res._tags(val) or fail ArgumentError, "Unknown value for tags: #{val}" }
end
token(value) click to toggle source

A “csrf” token retrieved from action=query&meta=tokens

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/block.rb, line 127
def token(value)
  merge(token: value.to_s)
end
user(value) click to toggle source

Username, IP address, or IP address range to block. Cannot be used together with userid

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/actions/block.rb, line 26
def user(value)
  merge(user: value.to_s)
end
userid(value) click to toggle source

User ID to block. Cannot be used together with user.

@param value [Integer] @return [self]

# File lib/mediawiktory/wikipedia/actions/block.rb, line 34
def userid(value)
  merge(userid: value.to_s)
end
watchuser() click to toggle source

Watch the user's or IP address's user and talk pages.

@return [self]

# File lib/mediawiktory/wikipedia/actions/block.rb, line 106
def watchuser()
  merge(watchuser: 'true')
end