Skip to content

Instantly share code, notes, and snippets.

@joellusky
Created August 8, 2014 02:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joellusky/ad368430431b1f388fe2 to your computer and use it in GitHub Desktop.
Save joellusky/ad368430431b1f388fe2 to your computer and use it in GitHub Desktop.
require 'unirest'
puts "Please enter you city to find out the highs for the week"
city = gets.chomp.downcase
response = Unirest.get "https://george-vustrey-weather.p.mashape.com/api.php?location=#{city}",
headers:{'X-Mashape-Key'=> "17ECFHpjXjmshRDL0utKUrvKjcj6p1Yrg9TjsnJfGjy3okl7rq", 'Content-Type'=> "application/x-www-form-urlencoded"}
weather = response.body
weather.each {|x|
day_of_week = x["day_of_week"]
high = x["high"]
puts "The high for #{day_of_week} is #{high}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment