class Underpass::QL::Request
Deals with performing the Overpass API request
Constants
- API_URI
- QUERY_TEMPLATE
Public Class Methods
new(query, bbox)
click to toggle source
# File lib/underpass/ql/request.rb, line 18 def initialize(query, bbox) @overpass_query = query @global_bbox ||= "[#{bbox}]" end
Public Instance Methods
run()
click to toggle source
Performs the API request
# File lib/underpass/ql/request.rb, line 24 def run Net::HTTP.post_form(URI(API_URI), data: build_query) end
Private Instance Methods
build_query()
click to toggle source
# File lib/underpass/ql/request.rb, line 30 def build_query QUERY_TEMPLATE.sub('BBOX', @global_bbox) .sub('QUERY', @overpass_query) end