Class: SAML2::NameID

Inherits:
Object
  • Object
show all
Defined in:
lib/saml2/name_id.rb

Defined Under Namespace

Modules: Format Classes: Policy

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id = nil, format = nil) ⇒ NameID

Returns a new instance of NameID.



45
46
47
# File 'lib/saml2/name_id.rb', line 45

def initialize(id = nil, format = nil)
  @id, @format = id, format
end

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format.



39
40
41
# File 'lib/saml2/name_id.rb', line 39

def format
  @format
end

#idObject (readonly)

Returns the value of attribute id.



39
40
41
# File 'lib/saml2/name_id.rb', line 39

def id
  @id
end

Class Method Details

.from_xml(node) ⇒ Object



41
42
43
# File 'lib/saml2/name_id.rb', line 41

def self.from_xml(node)
  node && new(node.content.strip, node['Format'])
end

Instance Method Details

#==(rhs) ⇒ Object



49
50
51
# File 'lib/saml2/name_id.rb', line 49

def ==(rhs)
  id == rhs.id && format == rhs.format
end

#build(builder, options = {}) ⇒ Object



53
54
55
56
57
58
# File 'lib/saml2/name_id.rb', line 53

def build(builder, options = {})
  args = {}
  args['Format'] = format if format
  args['xmlns:saml'] = Namespaces::SAML if options[:include_namespace]
  builder['saml'].__send__(options.delete(:element) || 'NameID', id, args)
end