Class: Scim::Kit::V2::Schema

Inherits:
Object
  • Object
show all
Includes:
Templatable
Defined in:
lib/scim/kit/v2/schema.rb

Overview

Represents a SCIM Schema

Constant Summary collapse

CORE =
'urn:ietf:params:scim:schemas:core:2.0'
ERROR =
'urn:ietf:params:scim:api:messages:2.0:Error'
GROUP =
"#{CORE}:Group"
RESOURCE_TYPE =
"#{CORE}:ResourceType"
SERVICE_PROVIDER_CONFIGURATION =
"#{CORE}:ServiceProviderConfig"
USER =
"#{CORE}:User"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Templatable

#as_json, #render, #to_h, #to_json

Constructor Details

#initialize(id:, name:, location:) ⇒ Schema

Returns a new instance of Schema.



20
21
22
23
24
25
# File 'lib/scim/kit/v2/schema.rb', line 20

def initialize(id:, name:, location:)
  @id = id
  @name = name
  @location = location
  @attributes = []
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



17
18
19
# File 'lib/scim/kit/v2/schema.rb', line 17

def attributes
  @attributes
end

#descriptionObject

Returns the value of attribute description.



18
19
20
# File 'lib/scim/kit/v2/schema.rb', line 18

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



17
18
19
# File 'lib/scim/kit/v2/schema.rb', line 17

def id
  @id
end

#locationObject (readonly)

Returns the value of attribute location.



17
18
19
# File 'lib/scim/kit/v2/schema.rb', line 17

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



17
18
19
# File 'lib/scim/kit/v2/schema.rb', line 17

def name
  @name
end

Class Method Details

.build(*args) {|item| ... } ⇒ Object

Yields:

  • (item)


33
34
35
36
37
# File 'lib/scim/kit/v2/schema.rb', line 33

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

Instance Method Details

#add_attribute(name:, type: :string) {|attribute| ... } ⇒ Object

Yields:

  • (attribute)


27
28
29
30
31
# File 'lib/scim/kit/v2/schema.rb', line 27

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