Class: RSAML::AssertionIDRef

Inherits:
Object
  • Object
show all
Includes:
Validatable
Defined in:
lib/rsaml/assertion.rb

Overview

Reference to an assertion via ID

Instance Attribute Summary collapse

Attributes included from Validatable

#verbose

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Validatable

#valid?

Constructor Details

#initialize(id) ⇒ AssertionIDRef

Initialize the AssertionIDRef with the given assertion ID



39
40
41
# File 'lib/rsaml/assertion.rb', line 39

def initialize(id)
  @id = id
end

Instance Attribute Details

#idObject

The ID reference



36
37
38
# File 'lib/rsaml/assertion.rb', line 36

def id
  @id
end

Class Method Details

.from_xml(element) ⇒ Object

Construct an Action instance from the given XML Element or fragment.



54
55
56
57
# File 'lib/rsaml/assertion.rb', line 54

def self.from_xml(element)
  element = REXML::Document.new(element).root if element.is_a?(String)
  AssertionIDRef.new(element.text)
end

Instance Method Details

#to_xml(xml = Builder::XmlMarkup.new) ⇒ Object

Construct an XML fragment representing the assertion ID ref



49
50
51
# File 'lib/rsaml/assertion.rb', line 49

def to_xml(xml=Builder::XmlMarkup.new)
  xml.tag!('saml:AssertionIDRef', id)
end

#validateObject

Validate that the AssertionIDRef is structurally valid

Raises:



44
45
46
# File 'lib/rsaml/assertion.rb', line 44

def validate
  raise ValidationError, "An id is required" if id.nil?
end