No commit activity in last 3 years
No release in over 3 years
Wrapper for the WDT SkyWise Forecast API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 5.0
~> 10.0

Runtime

~> 0.14.0
 Project Readme

WDT SkyWise Current & Forecast API

Code Climate Gem Version Build Status Coverage Status

Provides an easy-to-use wrapper for the WDT SkyWise Current and Forecast API.

Installation

Add this line to your application's Gemfile:

gem 'wdt-skywise-forecast'

And then execute:

$ bundle

Or install it yourself as:

$ gem install wdt-skywise-forecast

Usage

You will need your API credentials before you start. Sign up for a demo account here.

First configure your credientials and additional options in config/initializers/wdt.rb.

Wdt::Skywise::Forecast::Client.app_id = '<your application id>'
Wdt::Skywise::Forecast::Client.app_key = '<your application key>'
Wdt::Skywise::Forecast::Client.units = '<us or all>'

Get weather data:

wdt_client = Wdt::Skywise::Forecast::Client.new

weather_data = wdt_client.weather_for(ZIP: '32128')

weather_data.success            # => true
weather_data.error              # => nil

weather_data.response.present?  # => true

The full structure can be found here.

Example

wdt_client = Wdt::Skywise::Forecast::Client.new
ret = wdt_client.weather_for(ZIP: '32128')

if ret.success
    weather_data = ret.response
    
    weather_data.language                        # => "en"
    
    # location details
    weather_data.location["@attributes"].city    # => "Port Orange"
    weather_data.location["@attributes"].lat     # => "29.0905"
    
    # current conditions
    weather_data.location.sfc_ob.temp_F          # => "78"
    weather_data.location.sfc_ob.wx              # => "Mostly clear"
    weather_data.location.sfc_ob.moon_phase      # => "Waxing Gibbous Moon"
    
    # daily summaries
    weather_data.location.daily_summaries.daily_summary.count           # => 10
    weather_data.location.daily_summaries.daily_summary[0].max_temp_F   # => "82"
    weather_data.location.daily_summaries.daily_summary[0].wx           # => "Partly cloudy"
    
    # hourly summaries
    weather_data.location.hourly_summaries.hourly_summary.count         # => 240
    weather_data.location.hourly_summaries.hourly_summary[0].temp_F     # => "75"
    weather_data.location.hourly_summaries.hourly_summary[0].wx         # => "Rain showers"
else
    puts ret.error
end

License

The gem is available as open source under the terms of the MIT License.

Developed by Knockdown Outdoors