Sha256: a5805f959d8e7e9b7a361f9b6c89280514e859b97b1641b1717e91675c89fa88

Contents?: true

Size: 914 Bytes

Versions: 6

Compression:

Stored size: 914 Bytes

Contents

# frozen_string_literal: true

module Scim
  module Kit
    module V2
      # Represents a SCIM Schema
      class Schema
        include Templatable

        attr_reader :id, :name, :attributes, :meta
        attr_accessor :description

        def initialize(id:, name:, location:)
          @id = id
          @name = name
          @description = name
          @meta = Meta.new('Schema', location)
          @meta.created = @meta.last_modified = @meta.version = nil
          @attributes = []
        end

        def add_attribute(name:, type: :string)
          attribute = AttributeType.new(name: name, type: type)
          yield attribute if block_given?
          attributes << attribute
        end

        def core?
          id.include?(Schemas::CORE)
        end

        def self.build(*args)
          item = new(*args)
          yield item
          item
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
scim-kit-0.2.13 lib/scim/kit/v2/schema.rb
scim-kit-0.2.12 lib/scim/kit/v2/schema.rb
scim-kit-0.2.11 lib/scim/kit/v2/schema.rb
scim-kit-0.2.10 lib/scim/kit/v2/schema.rb
scim-kit-0.2.9 lib/scim/kit/v2/schema.rb
scim-kit-0.2.8 lib/scim/kit/v2/schema.rb