Class: Casablanca::Ticket
- Inherits:
-
Object
- Object
- Casablanca::Ticket
- Defined in:
- lib/casablanca/client.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
writeonly
Sets the attribute body.
-
#failure_code ⇒ Object
Returns the value of attribute failure_code.
-
#failure_message ⇒ Object
Returns the value of attribute failure_message.
-
#service_url ⇒ Object
readonly
Returns the value of attribute service_url.
-
#ticket ⇒ Object
readonly
Returns the value of attribute ticket.
-
#user ⇒ Object
Returns the value of attribute user.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Create a Ticket from a Hash.
Instance Method Summary collapse
- #authenticate ⇒ Object
- #authenticated? ⇒ Boolean
-
#initialize(ticket, service_url, renew = false) ⇒ Ticket
constructor
A new instance of Ticket.
-
#to_hash ⇒ Object
Convert a Ticket to a Hash.
-
#to_request_params ⇒ Object
Convert the ticket to a Hash for a request.
Constructor Details
#initialize(ticket, service_url, renew = false) ⇒ Ticket
Returns a new instance of Ticket.
169 170 171 172 173 |
# File 'lib/casablanca/client.rb', line 169 def initialize(ticket, service_url, renew = false) @service_url = service_url @ticket = ticket @renew = renew end |
Instance Attribute Details
#body=(value) ⇒ Object (writeonly)
Sets the attribute body
168 169 170 |
# File 'lib/casablanca/client.rb', line 168 def body=(value) @body = value end |
#failure_code ⇒ Object
Returns the value of attribute failure_code.
166 167 168 |
# File 'lib/casablanca/client.rb', line 166 def failure_code @failure_code end |
#failure_message ⇒ Object
Returns the value of attribute failure_message.
166 167 168 |
# File 'lib/casablanca/client.rb', line 166 def @failure_message end |
#service_url ⇒ Object (readonly)
Returns the value of attribute service_url.
167 168 169 |
# File 'lib/casablanca/client.rb', line 167 def service_url @service_url end |
#ticket ⇒ Object (readonly)
Returns the value of attribute ticket.
167 168 169 |
# File 'lib/casablanca/client.rb', line 167 def ticket @ticket end |
#user ⇒ Object
Returns the value of attribute user.
166 167 168 |
# File 'lib/casablanca/client.rb', line 166 def user @user end |
Class Method Details
Instance Method Details
#authenticate ⇒ Object
207 208 209 210 |
# File 'lib/casablanca/client.rb', line 207 def authenticate response = CasResponseParser.parse(self, @body) authenticated? end |
#authenticated? ⇒ Boolean
203 204 205 |
# File 'lib/casablanca/client.rb', line 203 def authenticated? !!@user end |
#to_hash ⇒ Object
Convert a Ticket to a Hash. Useful for serializing
185 186 187 188 189 190 191 |
# File 'lib/casablanca/client.rb', line 185 def to_hash props = {} props[:user] = @user if authenticated? props[:service_url] = @service_url props[:ticket] = @ticket props end |
#to_request_params ⇒ Object
Convert the ticket to a Hash for a request
195 196 197 198 199 200 201 |
# File 'lib/casablanca/client.rb', line 195 def to_request_params params = {} params[:service] = @service_url params[:ticket] = @ticket if @ticket params[:renew] = 'true' if @renew params end |