Skip to content

Instantly share code, notes, and snippets.

@tiomoreno
Created June 20, 2014 02:47
Show Gist options
  • Save tiomoreno/e5f15bc028e4a7538bf4 to your computer and use it in GitHub Desktop.
Save tiomoreno/e5f15bc028e4a7538bf4 to your computer and use it in GitHub Desktop.
Um hack simples para pegar uma parcial com os jogos da copa em Ruby
require 'net/http'
require 'json'
response = Net::HTTP.get('worldcup.sfg.io', '/matches')
JSON.parse(response).each do |jogo|
if jogo['status'] === 'completed'
home = [jogo['home_team']['country'], jogo['home_team']['goals'].to_s].join(' ')
away = [jogo['away_team']['country'], jogo['away_team']['goals'].to_s].join(' ')
puts home << ' x ' << away
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment