Module: MediaWiktory::Wikipedia::Modules::Wbentityusage

Defined in:
lib/mediawiktory/wikipedia/modules/wbentityusage.rb

Overview

Returns all entity IDs used in the given pages.

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

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.

Instance Method Summary collapse

Instance Method Details

#aspect(*values) ⇒ self

Only return entity IDs that used this aspect.

Parameters:

  • values (Array<String>)

    Allowed values: "S", "L", "T", "X", "O".

Returns:

  • (self)


38
39
40
# File 'lib/mediawiktory/wikipedia/modules/wbentityusage.rb', line 38

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

#continue(value) ⇒ self

When more results are available, use this to continue.

Parameters:

  • value (String)

Returns:

  • (self)


72
73
74
# File 'lib/mediawiktory/wikipedia/modules/wbentityusage.rb', line 72

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

#entities(*values) ⇒ self

Only return page that used these entities.

Parameters:

  • values (Array<String>)

Returns:

  • (self)


51
52
53
# File 'lib/mediawiktory/wikipedia/modules/wbentityusage.rb', line 51

def entities(*values)
  values.inject(self) { |res, val| res._entities(val) }
end

#limit(value) ⇒ self

How many entity usages to return.

Parameters:

  • value (Integer, "max")

Returns:

  • (self)


64
65
66
# File 'lib/mediawiktory/wikipedia/modules/wbentityusage.rb', line 64

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

#prop(*values) ⇒ self

Properties to add to the result.

Parameters:

  • values (Array<String>)

    Allowed values: "url" (If enabled url of entity will be added).

Returns:

  • (self)


25
26
27
# File 'lib/mediawiktory/wikipedia/modules/wbentityusage.rb', line 25

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