Class: Cassette::Http::TicketResponse
- Inherits:
-
Object
- Object
- Cassette::Http::TicketResponse
- Defined in:
- lib/cassette/http/ticket_response.rb
Instance Attribute Summary collapse
-
#authorities ⇒ Object
readonly
Returns the value of attribute authorities.
-
#login ⇒ Object
readonly
Returns the value of attribute login.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(response) ⇒ TicketResponse
constructor
A new instance of TicketResponse.
Constructor Details
#initialize(response) ⇒ TicketResponse
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cassette/http/ticket_response.rb', line 9 def initialize(response) namespaces = { "cas" => "http://www.yale.edu/tp/cas" } query = "//cas:serviceResponse/cas:authenticationSuccess/cas:user" document = REXML::Document.new(response) element = REXML::XPath.first(document, query, namespaces) @login = element.try(:text) if @login attributes_query = "//cas:serviceResponse/cas:authenticationSuccess/cas:attributes" attributes = Hash[REXML::XPath. first(document, attributes_query, namespaces). elements. map { |e| [e.name, e.text] }] @name = attributes['cn'] = attributes['authorities'] end end |
Instance Attribute Details
#authorities ⇒ Object (readonly)
Returns the value of attribute authorities.
7 8 9 |
# File 'lib/cassette/http/ticket_response.rb', line 7 def end |
#login ⇒ Object (readonly)
Returns the value of attribute login.
7 8 9 |
# File 'lib/cassette/http/ticket_response.rb', line 7 def login @login end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/cassette/http/ticket_response.rb', line 7 def name @name end |