Class: MediaWiktory::Wikipedia::Actions::Options
- Defined in:
- lib/mediawiktory/wikipedia/actions/options.rb
Overview
Change preferences of the current user.
Usage:
api..reset(value).perform # returns string with raw output
# or
api..reset(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
-
#change(*values) ⇒ self
List of changes, formatted name=value (e.g. skin=vector).
-
#optionname(value) ⇒ self
The name of the option that should be set to the value given by optionvalue.
-
#optionvalue(value) ⇒ self
The value for the option specified by optionname.
-
#reset ⇒ self
Resets preferences to the site defaults.
-
#resetkinds(*values) ⇒ self
List of types of options to reset when the reset option is set.
-
#token(value) ⇒ self
A "csrf" token retrieved from action=query&meta=tokens.
Methods inherited from Post
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
#change(*values) ⇒ self
List of changes, formatted name=value (e.g. skin=vector). If no value is given (not even an equals sign), e.g., optionname|otheroption|..., the option will be reset to its default value. If any value passed contains the pipe character (|), use the alternative multiple-value separator for correct operation.
46 47 48 |
# File 'lib/mediawiktory/wikipedia/actions/options.rb', line 46 def change(*values) values.inject(self) { |res, val| res._change(val) } end |
#optionname(value) ⇒ self
The name of the option that should be set to the value given by optionvalue.
59 60 61 |
# File 'lib/mediawiktory/wikipedia/actions/options.rb', line 59 def optionname(value) merge(optionname: value.to_s) end |
#optionvalue(value) ⇒ self
The value for the option specified by optionname.
67 68 69 |
# File 'lib/mediawiktory/wikipedia/actions/options.rb', line 67 def optionvalue(value) merge(optionvalue: value.to_s) end |
#reset ⇒ self
Resets preferences to the site defaults.
25 26 27 |
# File 'lib/mediawiktory/wikipedia/actions/options.rb', line 25 def reset() merge(reset: 'true') end |
#resetkinds(*values) ⇒ self
List of types of options to reset when the reset option is set.
33 34 35 |
# File 'lib/mediawiktory/wikipedia/actions/options.rb', line 33 def resetkinds(*values) values.inject(self) { |res, val| res._resetkinds(val) or fail ArgumentError, "Unknown value for resetkinds: #{val}" } end |
#token(value) ⇒ self
A "csrf" token retrieved from action=query&meta=tokens
75 76 77 |
# File 'lib/mediawiktory/wikipedia/actions/options.rb', line 75 def token(value) merge(token: value.to_s) end |