Class: WeatherByIp
- Inherits:
-
Object
- Object
- WeatherByIp
- Extended by:
- WeatherInfo
- Defined in:
- lib/weather_by_ip.rb
Constant Summary
Constants included from WeatherInfo
WeatherInfo::IMG_URL, WeatherInfo::URL, WeatherInfo::VERSION
Class Method Summary collapse
Methods included from WeatherInfo
Class Method Details
.get_weather(location, key = GeoIp.api_key) ⇒ Object
11 12 13 14 15 |
# File 'lib/weather_by_ip.rb', line 11 def get_weather location, key = GeoIp.api_key zipcode_opt = key.nil? ? :zipcode : :zip_code #difference between freegeoip and ipinfodb services results = (location_ip? location) ? Weather.get_results_by_ip(location, :key => key, :weather => zipcode_opt) : Weather.get_results(:weather => URI.escape(location)) Weather.new(results) end |