Sha256: ae83f2582cedc0bf41d7d07fc303d7f8d21700a6df46f5caf612033c00537dae

Contents?: true

Size: 1019 Bytes

Versions: 6

Compression:

Stored size: 1019 Bytes

Contents

# frozen_string_literal: true

require 'owmo/version'
require 'owmo/weather'

# rdoc
# OMWO = OpenWeatherMap.org client for current and forecasted weather conditions.
module OWMO
  # rdoc
  # Openweathermap.org URL
  URL = 'http://api.openweathermap.org/data/2.5'

  # 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

  def self.weather(api_key, **kwargs)
    OWMO::Weather.new(api_key, **kwargs) do |weather|
      if block_given?
        yield weather
      else
        weather
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
owmo-2.1.5 lib/owmo.rb
owmo-2.1.2 lib/owmo.rb
owmo-2.1.1 lib/owmo.rb
owmo-2.1.0 lib/owmo.rb
owmo-2.0.4 lib/owmo.rb
owmo-2.0.3 lib/owmo.rb