Skip to content

Instantly share code, notes, and snippets.

@jerzygangi
Created May 31, 2015 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerzygangi/76714b9ca7e28ea525fc to your computer and use it in GitHub Desktop.
Save jerzygangi/76714b9ca7e28ea525fc to your computer and use it in GitHub Desktop.
How to get the current Bitcoin price from a JSON API
require "rubygems"
require "json"
require "net/http"
response = Net::HTTP.get_response(URI.parse("https://api.bitcoinaverage.com/exchanges/USD"))
parsed_response = JSON.parse(response.body)
puts parsed_response["bitex"]["rates"]["last"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment