Class: RSAML::Protocol::Status
- Inherits:
-
Object
- Object
- RSAML::Protocol::Status
- Defined in:
- lib/rsaml/protocol/status.rb
Overview
A SAML status indicator.
Instance Attribute Summary collapse
-
#status_code ⇒ Object
A code representing the status of the activity carried out in response to the corresponding request.
-
#status_message ⇒ Object
A message which MAY be returned to an operator.
Instance Method Summary collapse
-
#initialize(status_code) ⇒ Status
constructor
Initialize the status with the given status code.
-
#status_detail ⇒ Object
Additional information concerning the status of the request.
-
#to_xml(xml = Builder::XmlMarkup.new) ⇒ Object
Construct an XML fragment representing the request.
-
#validate ⇒ Object
Validate the structure of the Status instance.
Constructor Details
#initialize(status_code) ⇒ Status
Initialize the status with the given status code
12 13 14 |
# File 'lib/rsaml/protocol/status.rb', line 12 def initialize(status_code) @status_code = status_code end |
Instance Attribute Details
#status_code ⇒ Object
A code representing the status of the activity carried out in response to the corresponding request.
6 7 8 |
# File 'lib/rsaml/protocol/status.rb', line 6 def status_code @status_code end |
#status_message ⇒ Object
A message which MAY be returned to an operator.
9 10 11 |
# File 'lib/rsaml/protocol/status.rb', line 9 def @status_message end |
Instance Method Details
#status_detail ⇒ Object
Additional information concerning the status of the request. All objects in the collection must respond to the to_xml method.
18 19 20 |
# File 'lib/rsaml/protocol/status.rb', line 18 def status_detail @status_detail ||= [] end |
#to_xml(xml = Builder::XmlMarkup.new) ⇒ Object
Construct an XML fragment representing the request
29 30 31 32 33 34 35 |
# File 'lib/rsaml/protocol/status.rb', line 29 def to_xml(xml=Builder::XmlMarkup.new) xml.tag!('samlp:Status') { xml << status_code.to_xml unless status_code.nil? xml.tag!('StatusMessage', ) unless .nil? status_detail.each { |status_detail| xml << status_detail.to_xml } } end |
#validate ⇒ Object
Validate the structure of the Status instance
23 24 25 26 |
# File 'lib/rsaml/protocol/status.rb', line 23 def validate raise ValidationError, "Status code required" if status_code.nil? raise ValidationError, "Status code must be a RSAML::Protocol::StatusCode instance" unless status_code.is_a?(StatusCode) end |