module MediaWiktory::Wikipedia::Modules::Coordinates

Returns coordinates of the given pages.

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

_primary(value) click to toggle source

@private

Calls superclass method
# File lib/mediawiktory/wikipedia/modules/coordinates.rb, line 59
def _primary(value)
  defined?(super) && super || ["primary", "secondary", "all"].include?(value.to_s) && merge(coprimary: value.to_s)
end
_prop(value) click to toggle source

@private

Calls superclass method
# File lib/mediawiktory/wikipedia/modules/coordinates.rb, line 46
def _prop(value)
  defined?(super) && super || ["type", "name", "dim", "country", "region", "globe"].include?(value.to_s) && merge(coprop: value.to_s, replace: false)
end
continue(value) click to toggle source

When more results are available, use this to continue.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/modules/coordinates.rb, line 33
def continue(value)
  merge(cocontinue: value.to_s)
end
distancefrompage(value) click to toggle source

Return distance in meters from the geographical coordinates of every valid result from the coordinates of this page.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/modules/coordinates.rb, line 75
def distancefrompage(value)
  merge(codistancefrompage: value.to_s)
end
distancefrompoint(value) click to toggle source

Return distance in meters from the geographical coordinates of every valid result from the given coordinates.

@param value [String] @return [self]

# File lib/mediawiktory/wikipedia/modules/coordinates.rb, line 67
def distancefrompoint(value)
  merge(codistancefrompoint: value.to_s)
end
limit(value) click to toggle source

How many coordinates to return.

@param value [Integer, “max”] @return [self]

# File lib/mediawiktory/wikipedia/modules/coordinates.rb, line 25
def limit(value)
  merge(colimit: value.to_s)
end
primary(value) click to toggle source

Whether to return only primary coordinates (“primary”), secondary (“secondary”) or both (“all”).

@param value [String] One of “primary”, “secondary”, “all”. @return [self]

# File lib/mediawiktory/wikipedia/modules/coordinates.rb, line 54
def primary(value)
  _primary(value) or fail ArgumentError, "Unknown value for primary: #{value}"
end
prop(*values) click to toggle source

Which additional coordinate properties to return.

@param values [Array<String>] Allowed values: “type”, “name”, “dim”, “country”, “region”, “globe”. @return [self]

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