No commit activity in last 3 years
No release in over 3 years
integrates simpleWeather.js with Rails Asset Pipeline
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.14
~> 10.0
~> 3.0
 Project Readme

simpleweather-rails

simpleweather-rails is a gem to include simpleWeather.js (GitHub) within your rails app.

This gem uses simpleWeather.js version 3.1.0

Installation

Add this line to your application's Gemfile:

gem 'simpleweather-rails'

Add the following line to /assets/javascripts/application.js

//= simpleWeather

And then execute:

$ bundle

Or install it yourself as:

$ gem install simpleweather-rails

Usage

Javascript

$.simpleWeather({
  location: 'Las Vegas, NV',
  unit: 'f',
  success: function(weather){
    html = '<h1>' + weather.temp + '</h1>';
    $('#weather').html(html);
  },
  error: function(error){
    $('#weather').html('<p>' + error + '</p>');
  }
});

HTML

<div id="weather"></div>

The documentation for simpleWeather.js can be found here. There are tons of more complete examples on the website and Github.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/45sixty/simpleweather-rails.

License

The gem is available as open source under the terms of the MIT License and any applicable licensing by the creator of simpleWeather.js.