Class: MediaWiktory::Wikipedia::Actions::Sitematrix

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

Overview

Get Wikimedia sites list.

Usage:

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

#continue(value) ⇒ self

When more results are available, use this to continue.

Parameters:

  • value (String)

Returns:

  • (self)


86
87
88
# File 'lib/mediawiktory/wikipedia/actions/sitematrix.rb', line 86

def continue(value)
  merge(smcontinue: value.to_s)
end

#langprop(*values) ⇒ self

Which information about a language to return.

Parameters:

  • values (Array<String>)

    Allowed values: "code", "name", "site", "localname".

Returns:

  • (self)


52
53
54
# File 'lib/mediawiktory/wikipedia/actions/sitematrix.rb', line 52

def langprop(*values)
  values.inject(self) { |res, val| res._langprop(val) or fail ArgumentError, "Unknown value for langprop: #{val}" }
end

#limit(value) ⇒ self

Maximum number of results.

Parameters:

  • value (Integer, "max")

Returns:

  • (self)


78
79
80
# File 'lib/mediawiktory/wikipedia/actions/sitematrix.rb', line 78

def limit(value)
  merge(smlimit: value.to_s)
end

#siteprop(*values) ⇒ self

Which information about a site to return.

Parameters:

  • values (Array<String>)

    Allowed values: "url", "dbname", "code", "sitename".

Returns:

  • (self)


65
66
67
# File 'lib/mediawiktory/wikipedia/actions/sitematrix.rb', line 65

def siteprop(*values)
  values.inject(self) { |res, val| res._siteprop(val) or fail ArgumentError, "Unknown value for siteprop: #{val}" }
end

#state(*values) ⇒ self

Filter the Site Matrix by wiki state:

Parameters:

  • values (Array<String>)

    Allowed values: "all", "closed", "private", "fishbowl", "nonglobal".

Returns:

  • (self)


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

def state(*values)
  values.inject(self) { |res, val| res._state(val) or fail ArgumentError, "Unknown value for state: #{val}" }
end

#type(*values) ⇒ self

Filter the Site Matrix by type:

Parameters:

  • values (Array<String>)

    Allowed values: "special" (One off and multilingual Wikimedia projects), "language" (Wikimedia projects under this language code).

Returns:

  • (self)


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

def type(*values)
  values.inject(self) { |res, val| res._type(val) or fail ArgumentError, "Unknown value for type: #{val}" }
end