Reputation: 23
I'm pretty new to Ruby and would like to use it in a project in school. I've done the blog tutorial and I have a little understanding of how it works.
The question: Can someone give me a tip on how to start to get data from the forecast_io API? A simple request to get some data to my page. Where should I start?
Thanks!
Upvotes: 0
Views: 854
Reputation: 13574
The forecast_io gem helps you here. First you need an API key. You can get the API key through registering here. Then the forecast_io github readme helps you.
Forecast::IO.api_key = 'this-is-your-api-key'
forecast = Forecast::IO.forecast(37.8267, -122.423) # params are: latitude, longitude
forecast.currently # gives you the current forecast datapoint
forecast.currently.summary # =>"Mostly Cloudy"
You can read the forecast.io API docs for more details.
Upvotes: 2
Reputation: 6258
A good place to start is always The Ruby Toolbox. If you search for forecast.io there, it will point you to a suitable gem.
Upvotes: 0