Sha256: e2371b0b9887fb21400570cb9c0a975e9ad1e24aede132153435ceb94f73dc89

Contents?: true

Size: 1.51 KB

Versions: 23

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

23 entries across 23 versions & 3 rubygems

Version Path
ruby-saml-1.8.0 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.7.2 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.7.1 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.6.2 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.7.0 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.6.1 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.6.0 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.5.0 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.4.3 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.4.2 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.4.1 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.4.0 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.3.1 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.3.0 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.2.0 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.1.2 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.1.1 lib/onelogin/ruby-saml/attribute_service.rb
ruby-saml-1.1.0 lib/onelogin/ruby-saml/attribute_service.rb
r-saml-1.0.1 lib/onelogin/ruby-saml/attribute_service.rb
kl-ruby-saml-0.0.3 lib/onelogin/ruby-saml/attribute_service.rb