Skip to content

Instantly share code, notes, and snippets.

@daqing
Created September 3, 2010 05:24
Show Gist options
  • Save daqing/563457 to your computer and use it in GitHub Desktop.
Save daqing/563457 to your computer and use it in GitHub Desktop.
def v2ex_api(path)
url = URI.parse("http://v2ex.appspot.com")
res = Net::HTTP.start(url.host, url.port) do |http|
http.get(path)
end
ActiveSupport::JSON.decode res.body
end
puts v2ex_api("/api/members/show.json?username=daqing").inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment