Class: OneLogin::RubySaml::AttributeService

Inherits:
Object
  • Object
show all
Defined in:
lib/onelogin/ruby-saml/attribute_service.rb

Overview

SAML2 AttributeService. Auxiliary class to build the AttributeService of the SP Metadata

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAttributeService

Initializes the AttributeService, set the index value as 1 and an empty array as attributes



13
14
15
16
# File 'lib/onelogin/ruby-saml/attribute_service.rb', line 13

def initialize
  @index = "1"
  @attributes = []
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



7
8
9
# File 'lib/onelogin/ruby-saml/attribute_service.rb', line 7

def attributes
  @attributes
end

#indexObject (readonly)

Returns the value of attribute index.



9
10
11
# File 'lib/onelogin/ruby-saml/attribute_service.rb', line 9

def index
  @index
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/onelogin/ruby-saml/attribute_service.rb', line 8

def name
  @name
end

Instance Method Details

#add_attribute(options = {}) ⇒ Object

Add an AttributeService

Parameters:

  • options (Hash) (defaults to: {})

    AttributeService option values add_attribute(

     :name => "Name",
     :name_format => "Name Format",
     :index => 1,
     :friendly_name => "Friendly Name",
     :attribute_value => "Attribute Value"
    )
    


52
53
54
# File 'lib/onelogin/ruby-saml/attribute_service.rb', line 52

def add_attribute(options={})
  attributes << options
end

#configure(&block) ⇒ Object



18
19
20
# File 'lib/onelogin/ruby-saml/attribute_service.rb', line 18

def configure(&block)
  instance_eval(&block)
end

#configured?Boolean

Returns True if the AttributeService object has been initialized and set with the required values (has attributes and a name).

Returns:

  • (Boolean)

    True if the AttributeService object has been initialized and set with the required values (has attributes and a name)



24
25
26
# File 'lib/onelogin/ruby-saml/attribute_service.rb', line 24

def configured?
  @attributes.length > 0 && !@name.nil?
end

#service_index(index) ⇒ Object

Set an index to the service

Parameters:

  • index (Integer)

    An index



38
39
40
# File 'lib/onelogin/ruby-saml/attribute_service.rb', line 38

def service_index(index)
  @index = index
end

#service_name(name) ⇒ Object

Set a name to the service

Parameters:

  • name (String)

    The service name



31
32
33
# File 'lib/onelogin/ruby-saml/attribute_service.rb', line 31

def service_name(name)
  @name = name
end