class Forecastr::Client

Constants

API_URL

Public Class Methods

search_by_city(city_name) click to toggle source
# File lib/forecastr/client.rb, line 9
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
search_by_coordinates(lat, lon) click to toggle source
# File lib/forecastr/client.rb, line 15
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