Class: RSAML::Protocol::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/rsaml/protocol/status.rb

Overview

A SAML status indicator.

Instance Attribute Summary collapse

Instance Method Summary collapse

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_codeObject

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_messageObject

A message which MAY be returned to an operator.



9
10
11
# File 'lib/rsaml/protocol/status.rb', line 9

def status_message
  @status_message
end

Instance Method Details

#status_detailObject

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', status_message) unless status_message.nil?
    status_detail.each { |status_detail| xml << status_detail.to_xml }
  }
end

#validateObject

Validate the structure of the Status instance

Raises:



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