Module: MediaWiktory::Wikipedia::Modules::Geosearch
- Defined in:
- lib/mediawiktory/wikipedia/modules/geosearch.rb
Overview
Returns pages having coordinates that are located in a certain area.
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
-
#bbox(value) ⇒ self
Bounding box to search in: pipe (|) separated coordinates of top left and bottom right corners.
-
#coord(value) ⇒ self
Coordinate around which to search.
-
#debug ⇒ self
Whether debug information should be returned.
-
#globe(value) ⇒ self
Globe to search on (by default "earth").
-
#limit(value) ⇒ self
Maximum number of pages to return.
-
#maxdim(value) ⇒ self
Restrict search to objects no larger than this, in meters.
-
#namespace(*values) ⇒ self
Namespaces to search.
-
#page(value) ⇒ self
Title of page around which to search.
-
#primary(value) ⇒ self
Whether to return only primary coordinates ("primary"), secondary ("secondary") or both ("all").
-
#prop(*values) ⇒ self
Which additional coordinate properties to return.
-
#radius(value) ⇒ self
Search radius in meters.
Instance Method Details
#bbox(value) ⇒ self
Bounding box to search in: pipe (|) separated coordinates of top left and bottom right corners.
41 42 43 |
# File 'lib/mediawiktory/wikipedia/modules/geosearch.rb', line 41 def bbox(value) merge(gsbbox: value.to_s) end |
#coord(value) ⇒ self
Coordinate around which to search.
25 26 27 |
# File 'lib/mediawiktory/wikipedia/modules/geosearch.rb', line 25 def coord(value) merge(gscoord: value.to_s) end |
#debug ⇒ self
Whether debug information should be returned.
124 125 126 |
# File 'lib/mediawiktory/wikipedia/modules/geosearch.rb', line 124 def debug() merge(gsdebug: 'true') end |
#globe(value) ⇒ self
Globe to search on (by default "earth").
73 74 75 |
# File 'lib/mediawiktory/wikipedia/modules/geosearch.rb', line 73 def globe(value) _globe(value) or fail ArgumentError, "Unknown value for globe: #{value}" end |
#limit(value) ⇒ self
Maximum number of pages to return.
65 66 67 |
# File 'lib/mediawiktory/wikipedia/modules/geosearch.rb', line 65 def limit(value) merge(gslimit: value.to_s) end |
#maxdim(value) ⇒ self
Restrict search to objects no larger than this, in meters.
57 58 59 |
# File 'lib/mediawiktory/wikipedia/modules/geosearch.rb', line 57 def maxdim(value) merge(gsmaxdim: value.to_s) end |
#namespace(*values) ⇒ self
Namespaces to search.
86 87 88 |
# File 'lib/mediawiktory/wikipedia/modules/geosearch.rb', line 86 def namespace(*values) values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, "Unknown value for namespace: #{val}" } end |
#page(value) ⇒ self
Title of page around which to search.
33 34 35 |
# File 'lib/mediawiktory/wikipedia/modules/geosearch.rb', line 33 def page(value) merge(gspage: value.to_s) end |
#primary(value) ⇒ self
Whether to return only primary coordinates ("primary"), secondary ("secondary") or both ("all").
112 113 114 |
# File 'lib/mediawiktory/wikipedia/modules/geosearch.rb', line 112 def primary(value) _primary(value) or fail ArgumentError, "Unknown value for primary: #{value}" end |
#prop(*values) ⇒ self
Which additional coordinate properties to return.
99 100 101 |
# File 'lib/mediawiktory/wikipedia/modules/geosearch.rb', line 99 def prop(*values) values.inject(self) { |res, val| res._prop(val) or fail ArgumentError, "Unknown value for prop: #{val}" } end |
#radius(value) ⇒ self
Search radius in meters.
49 50 51 |
# File 'lib/mediawiktory/wikipedia/modules/geosearch.rb', line 49 def radius(value) merge(gsradius: value.to_s) end |