Class: MediaWiktory::Wikipedia::Actions::Checktoken

Inherits:
Get
  • Object
show all
Defined in:
lib/mediawiktory/wikipedia/actions/checktoken.rb

Overview

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

Usage:

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 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 Get

#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

#maxtokenage(value) ⇒ self

Maximum allowed age of the token, in seconds.

Parameters:

  • value (Integer)

Returns:

  • (self)


47
48
49
# File 'lib/mediawiktory/wikipedia/actions/checktoken.rb', line 47

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

#token(value) ⇒ self

Token to test.

Parameters:

  • value (String)

Returns:

  • (self)


39
40
41
# File 'lib/mediawiktory/wikipedia/actions/checktoken.rb', line 39

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

#type(value) ⇒ self

Type of token being tested.

Parameters:

  • value (String)

    One of "createaccount", "csrf", "deleteglobalaccount", "login", "patrol", "rollback", "setglobalaccountstatus", "userrights", "watch".

Returns:

  • (self)


26
27
28
# File 'lib/mediawiktory/wikipedia/actions/checktoken.rb', line 26

def type(value)
  _type(value) or fail ArgumentError, "Unknown value for type: #{value}"
end