Class: OverpassAPI::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/base.rb

Overview

base class, ql and xml extend this

Direct Known Subclasses

QL, XML

Constant Summary collapse

DEFAULT_ENDPOINT =
'http://overpass-api.de/api/interpreter'.freeze

Instance Method Summary collapse

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