module MediaWiktory::Wikipedia::Modules::Pageimages
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 {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
@private
# File lib/mediawiktory/wikipedia/modules/pageimages.rb, line 59 def _license(value) defined?(super) && super || ["free", "any"].include?(value.to_s) && merge(pilicense: value.to_s) end
@private
# File lib/mediawiktory/wikipedia/modules/pageimages.rb, line 30 def _prop(value) defined?(super) && super || ["thumbnail", "original", "name"].include?(value.to_s) && merge(piprop: value.to_s, replace: false) end
When more results are available, use this to continue.
@param value [Integer] @return [self]
# File lib/mediawiktory/wikipedia/modules/pageimages.rb, line 67 def continue(value) merge(picontinue: value.to_s) end
Limit page images to a certain license type
@param value [String] One of “free”, “any”. @return [self]
# File lib/mediawiktory/wikipedia/modules/pageimages.rb, line 54 def license(value) _license(value) or fail ArgumentError, "Unknown value for license: #{value}" end
Properties of how many pages to return.
@param value [Integer, “max”] @return [self]
# File lib/mediawiktory/wikipedia/modules/pageimages.rb, line 46 def limit(value) merge(pilimit: value.to_s) end
Which information to return:
@param 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). @return [self]
# 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
Maximum thumbnail dimension.
@param value [Integer] @return [self]
# File lib/mediawiktory/wikipedia/modules/pageimages.rb, line 38 def thumbsize(value) merge(pithumbsize: value.to_s) end