Sha256: 7e68ffd585ce47a38df0dbef1cfbd18ba6f112891c279cdfdd0e8f5ca6e5ad52

Contents?: true

Size: 363 Bytes

Versions: 3

Compression:

Stored size: 363 Bytes

Contents

require 'net/http'

class Meteo
  OPEN_WEATHER_MAP_SERVICE_URL = 'http://api.openweathermap.org/data/2.5/weather'

  attr_reader :url

  def initialize
    @url = OPEN_WEATHER_MAP_SERVICE_URL
  end

  def quote location, units
    quote_url = "#{url}?q=#{location}%20nj&units=#{units}"

    uri = URI.parse(URI.escape(quote_url))

    Net::HTTP.get(uri)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
meteo-1.0.2 lib/meteo/meteo.rb
meteo-1.0.1 lib/meteo/meteo.rb
meteo-1.0.0 lib/meteo/meteo.rb