Sha256: f063eac6ed22f450d86e12e91ed971278e2df87b79de7e8d2ee51f8c623cbb29
Contents?: true
Size: 732 Bytes
Versions: 1
Compression:
Stored size: 732 Bytes
Contents
require "net/http" require 'json' module Forecastr class Radar API_URL = "http://api.openweathermap.org/data/2.5/weather?" class << self def find_by_city(city_name) radar = new radar.find_by_city(city_name) end def find_by_coordinates(lat, lon) radar = new radar.find_by_coordinates(lat, lon) end end def find_by_city(city_name) uri = URI(API_URL + "q=" + city_name) @json = JSON.parse(Net::HTTP.get(uri)) Forecastr::Forecast.new(@json) end def find_by_coordinates(lat, lon) uri = URI(API_URL + "lat=#{lat}&lon=#{lon}") @json = JSON.parse(Net::HTTP.get(uri)) Forecastr::Forecast.new(@json) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
forecastr-0.1.2 | lib/forecastr/radar.rb |