lib/graticule/geocoder/geonames.rb in graticule-2.5.0 vs lib/graticule/geocoder/geonames.rb in graticule-2.6.0

- old
+ new

@@ -1,15 +1,20 @@ # encoding: UTF-8 module Graticule #:nodoc: module Geocoder #:nodoc: class Geonames < Base - def initialize - @url = URI.parse 'http://ws.geonames.org/timezone' + def initialize(username) + @url = URI.parse('http://ws.geonames.org/timezone') + @username = URI.encode(username) end def time_zone(location) - get :formatted => 'true', :style => 'full', :lat => location.latitude, :lng => location.longitude + get :formatted => 'true', + :style => 'full', + :lat => location.latitude, + :lng => location.longitude, + :username => @username end private class Status include HappyMapper