Class: RSAML::AssertionURIRef

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

Overview

Reference to an assertion via URI

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(uri) ⇒ AssertionURIRef

Initialize the AssertionURIRef with the given URI



10
11
12
# File 'lib/rsaml/assertion.rb', line 10

def initialize(uri)
  @uri = uri
end

Instance Attribute Details

#uriObject

The URI reference



7
8
9
# File 'lib/rsaml/assertion.rb', line 7

def uri
  @uri
end

Class Method Details

.from_xml(element) ⇒ Object

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



25
26
27
28
# File 'lib/rsaml/assertion.rb', line 25

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

Instance Method Details

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

Construct an XML fragment representing the assertion uri ref



20
21
22
# File 'lib/rsaml/assertion.rb', line 20

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

#validateObject

Validate that the AssertionURIRef is structurally valid

Raises:



15
16
17
# File 'lib/rsaml/assertion.rb', line 15

def validate
  raise ValidationError, "A URI is required" if uri.nil?
end