class MediaWiktory::Wikipedia::Actions::Checktoken

Check the validity of a token from action=query&meta=tokens.

Usage:

“`ruby api.checktoken.type(value).perform # returns string with raw output # or api.checktoken.type(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

_type(value) click to toggle source

@private

Calls superclass method
# File lib/mediawiktory/wikipedia/actions/checktoken.rb, line 31
def _type(value)
  defined?(super) && super || ["createaccount", "csrf", "deleteglobalaccount", "login", "patrol", "rollback", "setglobalaccountstatus", "userrights", "watch"].include?(value.to_s) && merge(type: value.to_s)
end
maxtokenage(value) click to toggle source

Maximum allowed age of the token, in seconds.

@param value [Integer] @return [self]

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

Token to test.

@param value [String] @return [self]

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

Type of token being tested.

@param value [String] One of “createaccount”, “csrf”, “deleteglobalaccount”, “login”, “patrol”, “rollback”, “setglobalaccountstatus”, “userrights”, “watch”. @return [self]

# File lib/mediawiktory/wikipedia/actions/checktoken.rb, line 26
def type(value)
  _type(value) or fail ArgumentError, "Unknown value for type: #{value}"
end