module MediaWiktory::Wikipedia::Modules::Gadgets

Returns a list of gadgets used on this wiki.

The “submodule” (MediaWiki API term) is included in action after setting some param, providing additional tweaking for this param. Example (for {MediaWiktory::Wikipedia::Actions::Query} and its submodules):

“`ruby api.query # returns Actions::Query

.prop(:revisions)  # adds prop=revisions to action URL, and includes Modules::Revisions into action
.limit(10)         # method of Modules::Revisions, adds rvlimit=10 to URL

“`

All submodule's parameters are documented as its public methods, see below.

Public Instance Methods

_categories(value) click to toggle source

@private

# File lib/mediawiktory/wikipedia/modules/gadgets.rb, line 43
def _categories(value)
  merge(gacategories: value.to_s, replace: false)
end
_ids(value) click to toggle source

@private

# File lib/mediawiktory/wikipedia/modules/gadgets.rb, line 56
def _ids(value)
  merge(gaids: value.to_s, replace: false)
end
_prop(value) click to toggle source

@private

Calls superclass method
# File lib/mediawiktory/wikipedia/modules/gadgets.rb, line 30
def _prop(value)
  defined?(super) && super || ["id", "metadata", "desc"].include?(value.to_s) && merge(gaprop: value.to_s, replace: false)
end
allowedonly() click to toggle source

List only gadgets allowed to current user.

@return [self]

# File lib/mediawiktory/wikipedia/modules/gadgets.rb, line 63
def allowedonly()
  merge(gaallowedonly: 'true')
end
categories(*values) click to toggle source

Gadgets from what categories to retrieve.

@param values [Array<String>] @return [self]

# File lib/mediawiktory/wikipedia/modules/gadgets.rb, line 38
def categories(*values)
  values.inject(self) { |res, val| res._categories(val) }
end
enabledonly() click to toggle source

List only gadgets enabled by current user.

@return [self]

# File lib/mediawiktory/wikipedia/modules/gadgets.rb, line 70
def enabledonly()
  merge(gaenabledonly: 'true')
end
ids(*values) click to toggle source

IDs of gadgets to retrieve.

@param values [Array<String>] @return [self]

# File lib/mediawiktory/wikipedia/modules/gadgets.rb, line 51
def ids(*values)
  values.inject(self) { |res, val| res._ids(val) }
end
prop(*values) click to toggle source

What gadget information to get:

@param values [Array<String>] Allowed values: “id” (Internal gadget ID), “metadata” (The gadget metadata), “desc” (Gadget description transformed into HTML (can be slow, use only if really needed)). @return [self]

# File lib/mediawiktory/wikipedia/modules/gadgets.rb, line 25
def prop(*values)
  values.inject(self) { |res, val| res._prop(val) or fail ArgumentError, "Unknown value for prop: #{val}" }
end