Skip to content

Instantly share code, notes, and snippets.

@jamesdabbs
Created February 17, 2015 17:57
Show Gist options
  • Save jamesdabbs/811c7398c872771af308 to your computer and use it in GitHub Desktop.
Save jamesdabbs/811c7398c872771af308 to your computer and use it in GitHub Desktop.
A (deliberately not-so-great) example of making HTTP request from Ruby using curl
require 'json'
require 'pry'
url = "https://api.github.com/orgs/TIY-DC-ROR-2015-Jan/repos"
response = `curl #{url}`
data = JSON.parse response
# Try poking around here and taking a look at `data`
# binding.pry
random_repo = data.sample
puts "#{random_repo['name']} is located at #{random_repo['html_url']}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment