Created
February 17, 2015 17:57
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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