Sha256: 58e0e53c794a5a114f6a30716814df81ae619e8e6dc8f7f7a5230f337664c089

Contents?: true

Size: 955 Bytes

Versions: 1

Compression:

Stored size: 955 Bytes

Contents

require "owmo/version"
require "owmo/weather"


=begin rdoc
OMWO = OpenWeatherMap.org client for current and forecasted weather conditions.
=end
module OWMO

=begin rdoc
Openweathermap.org URL
=end
  URL = 'http://api.openweathermap.org/data/2.5'

=begin rdoc
Yield a weather object for querying weather data
==== Attributes
* +api_key:+ - {OpenWeatherMap.org API key}[http://openweathermap.org/appid]
==== Examples
* Single request:
  api_key = ''
  OWMO::weather(api_key).get :current, city_name: "London,UK"
* Muliple requests:
  api_key = ''
  OWMO::weather(api_key) do |weather|
    puts weather.get :current, city_name: "London,UK"
    puts weather.get :forecast5, city_name: "London,UK"
    puts weather.get :forecast16, city_name: "London,UK"
  end
=end
  public
  def self.weather(api_key, **params)
    Weather.new(api_key, params) do |weather|
      if block_given?
        yield weather
      else
        weather
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
owmo-2.0.1 lib/owmo.rb