Created
June 20, 2014 02:47
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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