class Google::GoogleApi
Service for all Google
API calls
Constants
- Google_API_URL
- Google_URL
Setting the URL and parameters
- Return_Type
- Search_Type
Attributes
google_data[R]
Search_URL = URI.join(Google_API_URL
, “#{Parms}”)
Public Class Methods
config()
click to toggle source
# File lib/Time_Traveler/google_api.rb, line 18 def self.config return @config if @config @config = { googlemap_id: ENV['GOOGLE_API'] } end
config=(credentials)
click to toggle source
# File lib/Time_Traveler/google_api.rb, line 14 def self.config=(credentials) @config ? @config.update(credentials) : @config = credentials end
distanceInfo(origins, dest, mode)
click to toggle source
# File lib/Time_Traveler/google_api.rb, line 23 def self.distanceInfo(origins, dest, mode) return @distance if @distance distanceDetail = HTTP.get(Google_API_URL, params: { key: config['googlemap_id'], origins: origins, destinations: dest, mode: mode }) distance_data = JSON.load(distanceDetail.to_s)['rows'][0]['elements'] end