Skip to content

Instantly share code, notes, and snippets.

@raghubetina
Created January 16, 2013 16:40
Show Gist options
  • Save raghubetina/4548674 to your computer and use it in GitHub Desktop.
Save raghubetina/4548674 to your computer and use it in GitHub Desktop.
require 'open-uri'
require 'json'
require './student.rb'
s1 = Student.new
s1.name = "Raghu Betina"
s1.photo_url = "https://graph.facebook.com/rbetina/picture"
s1.section = "am"
s1.twitter = "rbetina717"
students = Array.new
students.push s1
url = "http://tslwebdev.herokuapp.com/am.json"
list_from_api = JSON.parse(open(url).read)
list_from_api.each do |student_hash|
individual = Student.new
individual.name = student_hash["name"]
individual.photo_url = student_hash["photo_url"]
individual.section = student_hash["section"]
individual.twitter = student_hash["twitter"]
students.push individual
end
students.each do |student|
puts student.introduce
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment