Class: OSRM::Query

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*locations) ⇒ Query

Returns a new instance of Query.



10
11
12
# File 'lib/osrm/query.rb', line 10

def initialize(*locations)
  @locations = locations.compact.reject(&:empty?)
end

Instance Attribute Details

#locationsObject

Returns the value of attribute locations.



8
9
10
# File 'lib/osrm/query.rb', line 8

def locations
  @locations
end

Instance Method Details

#execute(alternatives: nil, overview: nil, profile: nil) ⇒ Object



14
15
16
17
# File 'lib/osrm/query.rb', line 14

def execute(alternatives: nil, overview: nil, profile: nil)
  build_uri(alternatives: alternatives, overview: overview, profile: profile)
  fetch_json_data[:routes].map { |route| Route.new(route) }
end