Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Road To Code: Ruby

The Road To Code: Ruby

Brooks Swinnerton

May 25, 2016
Tweet

More Decks by Brooks Swinnerton

Other Decks in Programming

Transcript

  1. require 'net/http' require 'json' uri = URI('https://www.reddit.com/r/CatsStandingUp.json') response = Net::HTTP.get(uri)

    parsed_response = JSON.parse(response) posts = parsed_response['data']['children'] html = "" posts.each do |post| thumbnail = post['data']['thumbnail'] html << "<img src='#{thumbnail}' />" end File.write('cats_standing_up.html', html)