-
Notifications
You must be signed in to change notification settings - Fork 1
Usage
bmalets edited this page Jul 20, 2015
·
4 revisions
WhichTime.in somewhere, api_key: google_api_key
or
WhichTime.in somewhere, api_key: google_api_key, time: your_time
or
WhichTime.in somewhere, api_key: google_api_key, time: your_time, http_proxy: proxy_url
- "somewhere" - may be an address or some place ("Lviv city, Naykova str." or "'Naturlih' pub, Kyiv" e.g.)
- "google_api_key" - API_KEY of Google application with an access to TimeZone and Geocoding API
- "your_time" - is not mandatory (Time.now is default)
- "proxy_url" - proxy host with port ( is not mandatory, 'https://fooproxy.com:8080' etc.)
examples:
WhichTime.in "Kyiv, pub 'Naturlih'", api_key: "AIzaSyCqfXRRJ1d8mCS_I0Kcs4XnaZ9KYRUrJVE"
# => 2015-07-06 03:53:10 +0300
WhichTime.in "Kyiv", api_key: "AIzaSyCqfXRRJ1d8mCS_I0Kcs4XnaZ9KYRUrJVE", time: 2.days.ago
# => 2015-07-04 03:53:10 +0300
WhichTime.new( somewhere, api_key: google_api_key, time: your_time ).time
# => 2015-07-06 03:53:10 +0300
WhichTime.new( somewhere, api_key: google_api_key ).timezone
examples:
WhichTime.new("Kyiv, pub 'Naturlih'", api_key: "AIzaSyCqfXRRJ1d8mCS_I0Kcs4XnaZ9KYRUrJVE").timezone
WhichTime.in("Kyiv", api_key: "AIzaSyCqfXRRJ1d8mCS_I0Kcs4XnaZ9KYRUrJVE").timezone
# => "Europe/Kiev"
WhichTime.new( somewhere, api_key: google_api_key ).location
# => {"lat"=>50.4501, "lng"=>30.5234}
WhichTime.new( somewhere, api_key: google_api_key ).coordinates
# => "50.4501,30.5234"