Class: Timezone::Lookup::Google
- Defined in:
- lib/timezone/lookup/google.rb
Instance Attribute Summary
Attributes inherited from Basic
Instance Method Summary collapse
Methods inherited from Basic
Constructor Details
This class inherits a constructor from Timezone::Lookup::Basic
Instance Method Details
#lookup(lat, lng) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/timezone/lookup/google.rb', line 9 def lookup(lat,lng) response = client.get(url(lat,lng)) return unless response.code =~ /^2\d\d$/ data = JSON.parse(response.body) if data['status'] != 'OK' raise(Timezone::Error::Google, data['errorMessage']) end data['timeZoneId'] rescue => e raise(Timezone::Error::Google, e.) end |