Module: MediaWiktory::Wikipedia::Modules::Pageimages

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

Overview

Returns information about images on the page, such as thumbnail and presence of photos.

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

#continue(value) ⇒ self

When more results are available, use this to continue.

Parameters:

  • value (Integer)

Returns:

  • (self)


67
68
69
# File 'lib/mediawiktory/wikipedia/modules/pageimages.rb', line 67

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

#license(value) ⇒ self

Limit page images to a certain license type

Parameters:

  • value (String)

    One of "free", "any".

Returns:

  • (self)


54
55
56
# File 'lib/mediawiktory/wikipedia/modules/pageimages.rb', line 54

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

#limit(value) ⇒ self

Properties of how many pages to return.

Parameters:

  • value (Integer, "max")

Returns:

  • (self)


46
47
48
# File 'lib/mediawiktory/wikipedia/modules/pageimages.rb', line 46

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

#prop(*values) ⇒ self

Which information to return:

Parameters:

  • values (Array<String>)

    Allowed values: "thumbnail" (URL and dimensions of thumbnail image associated with page, if any), "original" (URL and original dimensions of image associated with page, if any), "name" (Image title).

Returns:

  • (self)


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

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

#thumbsize(value) ⇒ self

Maximum thumbnail dimension.

Parameters:

  • value (Integer)

Returns:

  • (self)


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

def thumbsize(value)
  merge(pithumbsize: value.to_s)
end