Class: OSRM::Query
- Inherits:
-
Object
- Object
- OSRM::Query
- Defined in:
- lib/osrm/query.rb
Instance Attribute Summary collapse
-
#locations ⇒ Object
Returns the value of attribute locations.
Instance Method Summary collapse
- #execute(alternatives: nil, overview: nil, profile: nil) ⇒ Object
-
#initialize(*locations) ⇒ Query
constructor
A new instance of Query.
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
#locations ⇒ Object
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 |