DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Pattabhi has posted 1 posts at DZone. View Full User Profile

using json api url to read weather api

07.04.2014
| 4754 views |
  • submit to reddit
class WeatherController < ApplicationController
  
  def home
    @report = nil
  end
  
  def find
    @city = params[:q]
   @weather = WeatherModel.get("http://api.worldweatheronline.com/free/v1/weather.ashx?q=#{@city}&format=json&num_of_days=1&key=KEY")
  
  respond_to do |format|
    format.js { render 'find.js.erb'}
  end
   
   
  end
  
  
end

 this snippet shows how to get json api from online weather.com api

Comments

Pattabhi Ramarao replied on Fri, 2014/07/04 - 5:34am

 missing how to parse json