Created
February 2, 2015 05:50
-
-
Save lucasuyezu/51ac0f18c9c2a6b33217 to your computer and use it in GitHub Desktop.
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
puts "1) Fetching data" | |
http = EventMachine::HttpRequest.new("https://api.bitcoinaverage.com/ticker/global/all").get | |
http.errback { p '3) Not-done! Error!'; EM.stop } | |
http.callback do | |
# 1 second later | |
$redis.set(response_body["data"]) | |
puts "3) Storing fetched data" | |
p http.response_header.status | |
p http.response_header | |
p http.response | |
puts "4) Done!" | |
EventMachine.stop | |
end | |
puts "2) Doing other things" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment