1. CSS
  2. Flash
  3. HTML
  4. Illustrator
  5. Java
  6. JavaScript
  7. Maya
  8. Photography
  9. Photoshop
  10. PHP
  11. Ruby
  12. Ruby on Rails
  13. 3ds Max

Ruby on Rails: Get Any city weather in ruby in 8 lines of code

  1. Clicks today:
    0
  2. Clicks this month:
    5
  3. Overall rating:
    5.00/5

Ruby on Rails » Best Practices — about 7 years ago
Get Any city weather in ruby in 8 lines of code #ruby #rails #code #weather

Comments

avatarglenowens1507 3 months ago

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

city = 'portsaid,egypt' request = "http://api.openweathermap.org/data/2.5/weather?q=#{city}" response = open(request).readlines.join print Psych.dump( JSON.parse(response) )

digital cryptography

Your Comment

You must be logged in to post a comment.