Skip to content

Instantly share code, notes, and snippets.

@universal
Last active June 7, 2017 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save universal/bfcf6b7368801692198eeb0ab4d70ff4 to your computer and use it in GitHub Desktop.
Save universal/bfcf6b7368801692198eeb0ab4d70ff4 to your computer and use it in GitHub Desktop.
finished = true
timer = EM::PeriodicTimer.new(5) do
if finished
finished = false
method = http.post :body => { data: { serial_no: serial } }
method.errback { $stderr.puts 'Can\'t connect to cloud'; finished = true }
method.callback do
finished = true
p method.response_header.status
p method.response_header
p method.response
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment