Class: SAML2::RequestedAttribute

Inherits:
Attribute show all
Defined in:
lib/saml2/attribute_consuming_service.rb

Instance Attribute Summary

Attributes inherited from Attribute

#friendly_name, #name, #name_format, #value

Attributes inherited from Base

#xml

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Attribute

#build, from_xml, inherited, subclasses

Methods inherited from Base

#build, from_xml, #inspect, load_object_array, load_string_array, lookup_qname, #to_s, #to_xml

Constructor Details

#initialize(name = nil, is_required = nil, friendly_name = nil, name_format = nil) ⇒ RequestedAttribute

Returns a new instance of RequestedAttribute.



27
28
29
30
# File 'lib/saml2/attribute_consuming_service.rb', line 27

def initialize(name = nil, is_required = nil, friendly_name = nil, name_format = nil)
  super(name, nil, friendly_name, name_format)
  @is_required = is_required
end

Class Method Details

.create(name, is_required = nil) ⇒ Object



19
20
21
22
23
24
# File 'lib/saml2/attribute_consuming_service.rb', line 19

def create(name, is_required = nil)
  # use Attribute.create to get other subclasses to automatically fill out friendly_name
  # and name_format, but still return a RequestedAttribute object
  attribute = Attribute.create(name)
  new(attribute.name, is_required, attribute.friendly_name, attribute.name_format)
end

.elementObject



15
16
17
# File 'lib/saml2/attribute_consuming_service.rb', line 15

def element
  'RequestedAttribute'
end

.namespaceObject



11
12
13
# File 'lib/saml2/attribute_consuming_service.rb', line 11

def namespace
  'md'
end

Instance Method Details

#from_xml(node) ⇒ Object



32
33
34
35
# File 'lib/saml2/attribute_consuming_service.rb', line 32

def from_xml(node)
  super
  @is_required = node['isRequired'] && node['isRequired'] == 'true'
end

#required?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/saml2/attribute_consuming_service.rb', line 37

def required?
  @is_required
end