Class: OverpassAPI::Base
- Inherits:
-
Object
- Object
- OverpassAPI::Base
- Defined in:
- lib/base.rb
Overview
base class, ql and xml extend this
Constant Summary collapse
- DEFAULT_ENDPOINT =
'http://overpass-api.de/api/interpreter'.freeze
Instance Method Summary collapse
- #bounding_box(south, north, west, east) ⇒ Object
-
#initialize(args = {}) ⇒ Base
constructor
A new instance of Base.
- #query(query) ⇒ Object
- #raw_query(query) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 14 15 |
# File 'lib/base.rb', line 9 def initialize(args = {}) bbox = args[:bbox] bounding_box(bbox[:s], bbox[:n], bbox[:w], bbox[:e]) if bbox @endpoint = args[:endpoint] || DEFAULT_ENDPOINT @timeout = args[:timeout] end |
Instance Method Details
#bounding_box(south, north, west, east) ⇒ Object
17 18 19 |
# File 'lib/base.rb', line 17 def bounding_box(south, north, west, east) @bbox = "#{south},#{west},#{north},#{east}" end |
#query(query) ⇒ Object
21 22 23 |
# File 'lib/base.rb', line 21 def query(query) perform build_query(query) end |
#raw_query(query) ⇒ Object
25 26 27 |
# File 'lib/base.rb', line 25 def raw_query(query) perform query end |