Skip to content

Instantly share code, notes, and snippets.

@hannahwhy
Created December 10, 2010 23:47
Show Gist options
  • Select an option

  • Save hannahwhy/736995 to your computer and use it in GitHub Desktop.

Select an option

Save hannahwhy/736995 to your computer and use it in GitHub Desktop.
$ bundle exec irb
ruby-1.8.7-p302 > require 'pp'
=> ["PP"]
ruby-1.8.7-p302 > require 'active_support'
=> true
ruby-1.8.7-p302 > resp = %q{<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
ruby-1.8.7-p302'> <cas:authenticationSuccess>
ruby-1.8.7-p302'> <cas:user>username</cas:user>
ruby-1.8.7-p302'> <cas:proxyGrantingTicket>PGTIOU-84678-8a9d...</cas:proxyGrantingTicket>
ruby-1.8.7-p302'> <cas:proxies>
ruby-1.8.7-p302'> <cas:proxy>https://proxy2/pgtUrl</cas:proxy>
ruby-1.8.7-p302'> <cas:proxy>https://proxy1/pgtUrl</cas:proxy>
ruby-1.8.7-p302'> </cas:proxies>
ruby-1.8.7-p302'> </cas:authenticationSuccess>
ruby-1.8.7-p302'> </cas:serviceResponse>
ruby-1.8.7-p302'> };1
=> 1
ruby-1.8.7-p302 > pp Hash.from_xml(resp)
{"serviceResponse"=>
{"authenticationSuccess"=>
{"proxies"=>{"proxy"=>["https://proxy2/pgtUrl", "https://proxy1/pgtUrl"]},
"proxyGrantingTicket"=>"PGTIOU-84678-8a9d...",
"user"=>"username"},
"xmlns:cas"=>"http://www.yale.edu/tp/cas"}}
=> nil
{"serviceResponse"=>
{"authenticationSuccess"=>
{"proxies"=>{"proxy"=>["https://proxy2/pgtUrl", "https://proxy1/pgtUrl"]},
"proxyGrantingTicket"=>"PGTIOU-84678-8a9d...",
"user"=>"username"},
"xmlns:cas"=>"http://www.yale.edu/tp/cas"}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment