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?data='

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Base

Returns a new instance of Base.



9
10
11
12
13
14
15
16
# 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]
  @maxsize = args[:maxsize]
end

Instance Method Details

#bounding_box(s, n, w, e) ⇒ Object



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

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

#query(q) ⇒ Object



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

def query(q)
  perform build_query(q)
end

#raw_query(q) ⇒ Object



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

def raw_query(q)
  perform q
end