This is an OnTheSnow Web Services REST API Ruby wrapper that aims to support all the API methods.
- Tested against Ruby 1.9.2, 1.9.3, Rubinius (1.9) & JRuby (1.9).
- Not compatible with Ruby 1.8!
Add this line to your application's Gemfile
:
gem 'on_the_snow'
And then execute:
$ bundle
on_the_snow = OnTheSnow::Client.new(domain: 'google.com',
token: 'abcd1234',
subscription: 'lite',
lang: 'en',
metric: 'met')
on_the_snow.resort(5).attribution
=> { credit_line: 'Snow Reports provided by OnTheSnow.com', ... }
# you can also use the shortcut method:
on_the_snow = OnTheSnow.new(...)
:domain # Your subscription domain, mandatory.
:token # Your subscritpion token, mandatory. You can find your token by visiting http://services.onthesnow.com/axis2/services/SnowReport2009/tokens/YOUREMAIL/YOURPASSWORD
:subscription # Represents your level of subscription. It can be set to 'lite', 'mobile', 'plus' (aka Mobile plus) and 'web', defaults to 'web'.
:lang # Language for the results.
:metric # Metric system for the results. It can be set to 'imp' (imperial) and 'met' (metric).
# Note: You must include both language and metric in your query string to override the default language.
Method:
.new(options = {})
: this is an alias forOnTheSnow::Client.new
Methods:
.new(options = {})
#resort(resort_id)
: returns a newOnTheSnow::Client::Resort
Provides the #attribution
method to any instance of OnTheSnow::Client
.
Example:
on_the_snow = OnTheSnow::Client.new
on_the_snow.attribution
=> { credit_line: 'Snow Reports provided by OnTheSnow.com' }
Provides the #region
method to any instance of OnTheSnow::Client
.
Method:
#states
Example:
on_the_snow = OnTheSnow::Client.new
on_the_snow.region(5).states
=> [{ id: 5, name: 'Europe', ... }]
Provides the #regions
method to any instance of OnTheSnow::Client
.
Example:
on_the_snow = OnTheSnow::Client.new
on_the_snow.regions
=> [{ id: 5, name: 'Europe', states: [{ id: 73, abbrev: 'UK' }, ...] }]
Provides the #resort
method to any instance of OnTheSnow::Client
.
Methods:
#attribution
#cams
#deals
#info
#news
#photos
#snow_report
Example:
on_the_snow = OnTheSnow::Client.new
on_the_snow.resort(5).attribution
=> { credit_line: 'Snow Reports provided by OnTheSnow.com', ... }
Provides the following methods to any instance of OnTheSnow::Client
:
#search_resorts_by_geocode
#search_resorts_by_name
Example:
on_the_snow = OnTheSnow::Client.new
on_the_snow.search_resorts_by_geocode(lat: 38, lon: -121, distance: 200)
=> [{ id: 42, distance: 94, ... }]
on_the_snow = OnTheSnow::Client.new
on_the_snow.search_resorts_by_name(search: 'mammoth')
=> [{ id: 42, ... }]
Provides the #state
method to any instance of OnTheSnow::Client
.
Methods:
#cams
#deals
#news
#photos
#resorts_last_update
#snow_report
Example:
on_the_snow = OnTheSnow::Client.new
on_the_snow.state('CN').news
=> [{ id: 42, description: 'News content.', ... }]
Please consult the RubyDoc for more details.
Before you file an issue, make sure you have read the Contributing guide that contains some important information.
You can report bugs and feature requests to GitHub Issues.
Pull requests are very welcome! Please try to follow these simple rules if applicable:
- Please create a topic branch for every separate change you make.
- Make sure your patches are well tested. All specs must pass on Travis CI.
- Update the Yard documentation.
- Update the README.
- Update the CHANGELOG for noteworthy changes (don't forget to run
bundle exec pimpmychangelog
and watch the magic happen)! - Please do not change the version number.