Skip to content

Instantly share code, notes, and snippets.

@khakimov
Created May 13, 2014 21:07
Show Gist options
  • Save khakimov/dea87dbdfefbe95820db to your computer and use it in GitHub Desktop.
Save khakimov/dea87dbdfefbe95820db to your computer and use it in GitHub Desktop.
require 'json'
require 'open-uri'
url = 'https://www.theranos.com/api/tests'
resp = open(url).read
json_tests = JSON.parse(resp)
all_tests_price = 0
json_tests.each do |x|
all_tests_price += x["TheranosPrice"].to_f
end
p "$#{all_tests_price} for #{json_tests.count} tests."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment