Class: OverpassAPI::Base

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

Direct Known Subclasses

QL, XML

Constant Summary collapse

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

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(s, n, w, e) ⇒ Object



17
18
19
# File 'lib/base.rb', line 17

def bounding_box(s,n,w,e)
  @bbox = "#{s},#{w},#{n},#{e}"
end

#query(q) ⇒ Object



21
22
23
# File 'lib/base.rb', line 21

def query(q)
  perform build_query(q)
end

#raw_query(q) ⇒ Object



25
26
27
# File 'lib/base.rb', line 25

def raw_query(q)
  perform q
end