module Locotimezone::ResultsFormatter
Public Class Methods
build_geolocation_hash_for(location)
click to toggle source
# File lib/locotimezone/results_formatter.rb, line 18 def self.build_geolocation_hash_for(location) return {} if location['results'].empty? { formatted_address: location['results'][0]['formatted_address'], location: symbolize_keys(location['results'][0]['geometry']['location']) } end
build_hash_for(location, timezone)
click to toggle source
# File lib/locotimezone/results_formatter.rb, line 3 def self.build_hash_for(location, timezone) { geo: location, timezone: timezone } end
build_timezone_hash_for(timezone)
click to toggle source
# File lib/locotimezone/results_formatter.rb, line 10 def self.build_timezone_hash_for(timezone) return {} if timezone['timeZoneId'].nil? { timezone_id: timezone['timeZoneId'], timezone_name: timezone['timeZoneName'] } end
symbolize_keys(hash)
click to toggle source
# File lib/locotimezone/results_formatter.rb, line 26 def self.symbolize_keys(hash) hash.map { |key, value| [key.to_sym, value] }.to_h end