require 'net/http' require 'rexml/document' # change the key and parameters following our documentation - http://www.spock.com/api uri_path = '/api/2/search.xml?api_key=115c5ab1fb7dec3a8ce457fee8e6f0eb&query=spock-team&show_blurb=1&sig=3462c6f4692d6977bd8f734c6584b42b' http = Net::HTTP.new("www.spock.com") xml_data = http.request(Net::HTTP::Get.new(uri_path, {"User-Agent"=>"Spock API Ruby Sample Client"})).body REXML::Document.new(xml_data).elements.each('response/search_results/person') do |elem| blurb = '' elem.each_element {|sub_elem| blurb = sub_elem.text if sub_elem.name == 'blurb'} print "#{elem.attribute('id')}: #{blurb}\n" end