Sha256: 6d7cd6c97075005d09dbd9421d9940eef3840866e0589606b328f841bfd1c0ca

Contents?: true

Size: 1.51 KB

Versions: 14

Compression:

Stored size: 1.51 KB

Contents

module OneLogin
  module RubySaml

    # SAML2 AttributeService. Auxiliary class to build the AttributeService of the SP Metadata
    #
    class AttributeService
      attr_reader :attributes
      attr_reader :name
      attr_reader :index

      # Initializes the AttributeService, set the index value as 1 and an empty array as attributes
      #
      def initialize
        @index = "1"
        @attributes = []
      end

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

      # @return [Boolean] True if the AttributeService object has been initialized and set with the required values
      #                   (has attributes and a name)
      def configured?
        @attributes.length > 0 && !@name.nil?
      end

      # Set a name to the service
      # @param name [String] The service name
      #
      def service_name(name)
        @name = name
      end

      # Set an index to the service
      # @param index [Integer] An index
      #
      def service_index(index)
        @index = index
      end

      # Add an AttributeService
      # @param options [Hash] AttributeService option values
      #   add_attribute(
      #                 :name => "Name",
      #                 :name_format => "Name Format",
      #                 :index => 1,
      #                 :friendly_name => "Friendly Name",
      #                 :attribute_value => "Attribute Value"
      #                )
      #
      def add_attribute(options={})
        attributes << options
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ruby-saml-1.17.0 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.12.3 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.16.0 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.15.0 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.14.0 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.13.0 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.12.2 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.12.1 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.12.0 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.11.0 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.10.2 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.10.1 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.10.0 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.9.0 lib/onelogin/ruby-saml/attribute_service.rb