Sha256: 14a3d4a98a56755999677769f7519a55b9b782c5cf1b5db00dfc090faed4688c
Contents?: true
Size: 497 Bytes
Versions: 2
Compression:
Stored size: 497 Bytes
Contents
require "us_time_zones/version" require "json" require "httparty" class USTZones def self.getZone(lat, lng) url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=#{lat},#{lng}&key=AIzaSyBgUT0t3K3y9cKJgITa8X1O7uGYjguNZT4" response = HTTParty.get(url).to_json response = JSON.parse(response) if response["results"] != [] p "Error" elsif response["results"][0]["formatted_address"].include?("USA") p "You're in the USA" else p "You're not in the USA" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
us_time_zones-1.0.3 | lib/us_time_zones.rb |
us_time_zones-1.0.0 | lib/us_time_zones.rb |