Class: Routing::Adapter::Here
- Inherits:
-
RestAdapter
- Object
- RestAdapter
- Routing::Adapter::Here
- Defined in:
- lib/routing/adapter/here.rb
Overview
Class Method Summary collapse
Instance Method Summary collapse
- #calculate(geo_points) ⇒ Object
-
#initialize(attrs = {}) ⇒ Here
constructor
A new instance of Here.
Methods inherited from RestAdapter
Constructor Details
#initialize(attrs = {}) ⇒ Here
Returns a new instance of Here.
21 22 23 24 25 26 |
# File 'lib/routing/adapter/here.rb', line 21 def initialize(attrs = {}) attrs[:host] ||= 'route.api.here.com' attrs[:path] ||= '/routing/7.2/calculateroute.json' attrs[:parser] ||= ::Routing::Parser::HereSimple super(attrs) end |
Class Method Details
.default_params ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/routing/adapter/here.rb', line 11 def self.default_params { departure: Time.now.utc.iso8601, mode: "fastest;car", language: "de_DE", legattributes: "all,-links", maneuverattributes: "position,travelTime,length,time" } end |
Instance Method Details
#calculate(geo_points) ⇒ Object
28 29 30 31 |
# File 'lib/routing/adapter/here.rb', line 28 def calculate(geo_points) response = request(params.merge(convert_geo_points_to_params(geo_points)).merge(credentials)) parse(response.body) end |