Last Updated: February 25, 2016
· blazeeboy

Getting weather of any city with Ruby

well, this is simple, open the url of the Open weather map api and parse it,
i additionally converted it into YML to be human readable.

require 'open-uri'
require 'json'
require 'psych'

city = 'portsaid,egypt'
request = "{city}"
response = open(request).readlines.join
print Psych.dump( JSON.parse(response) )