Class: Routing::Adapter::Navteq

Inherits:
Object
  • Object
show all
Defined in:
lib/routing/adapter/navteq.rb

Overview

Adapter for a NAVTEQ LBSP Routing Service v6 server. It passes the GeoPoints to the routing service and will return another Array of GeoPoints, representing the calculated route.

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Navteq

Returns a new instance of Navteq.



12
13
14
15
16
17
# File 'lib/routing/adapter/navteq.rb', line 12

def initialize(options = {})
  @options = {
    :service_path => '/routing/6.2/calculateroute.json',
    :parser => ::Routing::Parser::NavteqSimple
  }.merge(options)
end

Instance Method Details

#calculate(geo_points) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/routing/adapter/navteq.rb', line 19

def calculate(geo_points)
  response = connection.get do |request|
    request.url(options[:service_path])
    request.params = default_params.merge(geo_points_to_params(geo_points))
  end
  parse(response.body)
end