Sha256: 8570874f4ac95ee9c3b1bd989985e0432b14a7fe1b6df17fef96d10c79e618e9
Contents?: true
Size: 545 Bytes
Versions: 3
Compression:
Stored size: 545 Bytes
Contents
require "net/http" require 'json' module Forecastr class Client API_URL = "http://api.openweathermap.org/data/2.5/weather?" class << self def search_by_city(city_name) uri = URI(API_URL + "q=" + city_name) json = JSON.parse(Net::HTTP.get(uri)) Forecastr::DataContainer.new(json) end def search_by_coordinates(lat, lon) uri = URI(API_URL + "lat=#{lat}&lon=#{lon}") json = JSON.parse(Net::HTTP.get(uri)) Forecastr::DataContainer.new(json) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
forecastr-0.1.5 | lib/forecastr/client.rb |
forecastr-0.1.4 | lib/forecastr/client.rb |
forecastr-0.1.3 | lib/forecastr/client.rb |