Module: GoogleDirectionsApi::Client::Request

Included in:
GoogleDirectionsApi::Client
Defined in:
lib/google_directions_api/client/request.rb

Overview

methods for request

Instance Method Summary collapse

Instance Method Details

#call(args = {}) ⇒ Object

make request to API



6
7
8
9
# File 'lib/google_directions_api/client/request.rb', line 6

def call(args = {})
  body = { origin: args[:origin], destination: args[:destination], mode: 'driving', key: ENV['GOOGLE_DIRECTIONS_API_KEY'] }
  self.class.get(url(args[:output_format]), query: body).parsed_response
end