Sha256: fe2d73988c4dd6445fe24234035ea20121315f733bc99962797b03a468d60c6e

Contents?: true

Size: 472 Bytes

Versions: 3

Compression:

Stored size: 472 Bytes

Contents

class Wettr::WeatherAPI
  include HTTParty
  # debug_output STDOUT

  base_uri "https://api.openweathermap.org"
  default_params appid: ENV["API_KEY"], units: "imperial"

  def self.call_with_lat_and_lon(lat:, lon:)
    @options = { query: { lat: lat, lon: lon } }
    call
  end

  def self.call_with_zip(zip)
    @options = { query: { zip: zip } }
    call
  end

  private
  
  def self.call
    response = self.get("/data/2.5/weather", @options)
    response
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wettr-0.1.2 lib/wettr/weather_api.rb
wettr-0.1.1 lib/wettr/weather_api.rb
wettr-0.1.0 lib/wettr/weather_api.rb