Class: MediaWiktory::Wikipedia::Actions::Clientlogin

Inherits:
Post
  • Object
show all
Defined in:
lib/mediawiktory/wikipedia/actions/clientlogin.rb

Overview

Log in to the wiki using the interactive flow.

Usage:

api.clientlogin.requests(value).perform # returns string with raw output
# or
api.clientlogin.requests(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

#continueself

This request is a continuation after an earlier UI or REDIRECT response. Either this or loginreturnurl is required.

Returns:

  • (self)


73
74
75
# File 'lib/mediawiktory/wikipedia/actions/clientlogin.rb', line 73

def continue()
  merge(logincontinue: 'true')
end

#mergerequestfieldsself

Merge field information for all authentication requests into one array.

Returns:

  • (self)


51
52
53
# File 'lib/mediawiktory/wikipedia/actions/clientlogin.rb', line 51

def mergerequestfields()
  merge(loginmergerequestfields: 'true')
end

#messageformat(value) ⇒ self

Format to use for returning messages.

Parameters:

  • value (String)

    One of "html", "wikitext", "raw", "none".

Returns:

  • (self)


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

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

#preservestateself

Preserve state from a previous failed login attempt, if possible.

Returns:

  • (self)


58
59
60
# File 'lib/mediawiktory/wikipedia/actions/clientlogin.rb', line 58

def preservestate()
  merge(loginpreservestate: 'true')
end

#requests(*values) ⇒ self

Only use these authentication requests, by the id returned from action=query&meta=authmanagerinfo with amirequestsfor=login or from a previous response from this module.

Parameters:

  • values (Array<String>)

Returns:

  • (self)


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

def requests(*values)
  values.inject(self) { |res, val| res._requests(val) }
end

#returnurl(value) ⇒ self

Return URL for third-party authentication flows, must be absolute. Either this or logincontinue is required.

Parameters:

  • value (String)

Returns:

  • (self)


66
67
68
# File 'lib/mediawiktory/wikipedia/actions/clientlogin.rb', line 66

def returnurl(value)
  merge(loginreturnurl: value.to_s)
end

#token(value) ⇒ self

A "login" token retrieved from action=query&meta=tokens

Parameters:

  • value (String)

Returns:

  • (self)


81
82
83
# File 'lib/mediawiktory/wikipedia/actions/clientlogin.rb', line 81

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