Class: MediaWiktory::Wikipedia::Actions::Jsonconfig

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

Overview

Allows direct access to JsonConfig subsystem.

Usage:

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

#command(value) ⇒ self

Which sub-action to perform on JsonConfig:

Parameters:

  • value (String)

    One of "status" (Shows JsonConfig configuration), "reset" (Clears configurations from cache. Requires title parameter and jsonconfig-reset right), "reload" (Reloads and caches configurations from config store. Requires title parameter and jsonconfig-reset right).

Returns:

  • (self)


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

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

#content(value) ⇒ self

For command=reload, use this content instead.

Parameters:

  • value (String)

Returns:

  • (self)


55
56
57
# File 'lib/mediawiktory/wikipedia/actions/jsonconfig.rb', line 55

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

#namespace(value) ⇒ self

Namespace number of the title to process.

Parameters:

  • value (Integer)

Returns:

  • (self)


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

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

#title(value) ⇒ self

Title to process without namespace prefix.

Parameters:

  • value (String)

Returns:

  • (self)


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

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