Class: Scim::Kit::V2::ResourceType
- Inherits:
-
Object
- Object
- Scim::Kit::V2::ResourceType
show all
- Includes:
- Templatable
- Defined in:
- lib/scim/kit/v2/resource_type.rb
Overview
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#as_json, #render, #template_name, #to_h, #to_json
Constructor Details
#initialize(location:) ⇒ ResourceType
Returns a new instance of ResourceType.
18
19
20
21
22
|
# File 'lib/scim/kit/v2/resource_type.rb', line 18
def initialize(location:)
@meta = Meta.new('ResourceType', location)
@meta.version = @meta.created = @meta.last_modified = nil
@schema_extensions = []
end
|
Instance Attribute Details
#description ⇒ Object
12
13
14
|
# File 'lib/scim/kit/v2/resource_type.rb', line 12
def description
@description
end
|
#endpoint ⇒ Object
13
14
15
|
# File 'lib/scim/kit/v2/resource_type.rb', line 13
def endpoint
@endpoint
end
|
#id ⇒ Object
10
11
12
|
# File 'lib/scim/kit/v2/resource_type.rb', line 10
def id
@id
end
|
16
17
18
|
# File 'lib/scim/kit/v2/resource_type.rb', line 16
def meta
@meta
end
|
#name ⇒ Object
11
12
13
|
# File 'lib/scim/kit/v2/resource_type.rb', line 11
def name
@name
end
|
#schema ⇒ Object
14
15
16
|
# File 'lib/scim/kit/v2/resource_type.rb', line 14
def schema
@schema
end
|
#schema_extensions ⇒ Object
15
16
17
|
# File 'lib/scim/kit/v2/resource_type.rb', line 15
def schema_extensions
@schema_extensions
end
|
Class Method Details
.build(**args) {|item| ... } ⇒ Object
29
30
31
32
33
|
# File 'lib/scim/kit/v2/resource_type.rb', line 29
def build(**args)
item = new(**args)
yield item
item
end
|
.from(hash) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/scim/kit/v2/resource_type.rb', line 35
def from(hash)
x = new(location: hash[:location])
x.meta = Meta.from(hash[:meta])
%i[id name description endpoint schema].each do |key|
x.public_send("#{key}=", hash[key])
end
hash[:schemaExtensions].each do |y|
x.add_schema_extension(schema: y[:schema], required: y[:required])
end
x
end
|
.parse(json) ⇒ Object
47
48
49
|
# File 'lib/scim/kit/v2/resource_type.rb', line 47
def parse(json)
from(JSON.parse(json, symbolize_names: true))
end
|
Instance Method Details
#add_schema_extension(schema:, required: false) ⇒ Object
24
25
26
|
# File 'lib/scim/kit/v2/resource_type.rb', line 24
def add_schema_extension(schema:, required: false)
@schema_extensions.push(schema: schema, required: required)
end
|