scim-kit 0.2.12 → 0.2.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/scim/kit/v2/attributable.rb +18 -3
- data/lib/scim/kit/v2/resource.rb +2 -2
- data/lib/scim/kit/v2/schemas.rb +5 -1
- data/lib/scim/kit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cd1a84727f27f1044be51ade6de69ff5ff77907d6bb93f3a523838107672ba3
|
4
|
+
data.tar.gz: 9d0e8a6b8a2f254283771f7ee73bc46b32ed5755ac0ae6f5a893ae9b6a8f579e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 361acda38071926afc31f12eec8a11cf319898e43dffec6f16a3ffa2ce937d6524d116783ffa8d5bb138a05c45fa57c60d27d6efbb9ee31bebbacc17fd4ce1ee
|
7
|
+
data.tar.gz: 910f10496c0409ee027f557d8737a2b12abaf72355947348c6fb450e4ccb566329b7244a56fedd7451db22d2e34031d115c4ce75d8cabba67aab4f5a168de6df
|
@@ -12,10 +12,22 @@ module Scim
|
|
12
12
|
types.each { |x| attribute(x, resource) }
|
13
13
|
end
|
14
14
|
|
15
|
+
def assign_attributes(attributes = {})
|
16
|
+
attributes.each do |key, value|
|
17
|
+
next if key.to_sym == :schemas
|
18
|
+
|
19
|
+
if key.to_s.start_with?(Schemas::EXTENSION)
|
20
|
+
assign_attributes(value)
|
21
|
+
else
|
22
|
+
write_attribute(key, value)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
15
27
|
private
|
16
28
|
|
17
29
|
def attribute_for(name)
|
18
|
-
dynamic_attributes[name]
|
30
|
+
dynamic_attributes[name.to_s.underscore]
|
19
31
|
end
|
20
32
|
|
21
33
|
def read_attribute(name)
|
@@ -26,8 +38,11 @@ module Scim
|
|
26
38
|
end
|
27
39
|
|
28
40
|
def write_attribute(name, value)
|
29
|
-
|
30
|
-
|
41
|
+
if value.is_a?(Hash)
|
42
|
+
attribute_for(name)&.assign_attributes(value)
|
43
|
+
else
|
44
|
+
attribute_for(name)&._value = value
|
45
|
+
end
|
31
46
|
end
|
32
47
|
|
33
48
|
def create_module_for(type)
|
data/lib/scim/kit/v2/resource.rb
CHANGED
@@ -13,16 +13,16 @@ module Scim
|
|
13
13
|
attr_reader :meta
|
14
14
|
attr_reader :schemas
|
15
15
|
|
16
|
-
validates_presence_of :id
|
17
16
|
validate :schema_validations
|
18
17
|
|
19
|
-
def initialize(schemas:, location: nil)
|
18
|
+
def initialize(schemas:, location: nil, attributes: {})
|
20
19
|
@meta = Meta.new(schemas[0].name, location)
|
21
20
|
@meta.disable_timestamps
|
22
21
|
@schemas = schemas
|
23
22
|
schemas.each do |schema|
|
24
23
|
define_attributes_for(self, schema.attributes)
|
25
24
|
end
|
25
|
+
assign_attributes(attributes)
|
26
26
|
yield self if block_given?
|
27
27
|
end
|
28
28
|
|
data/lib/scim/kit/v2/schemas.rb
CHANGED
@@ -4,7 +4,11 @@ module Scim
|
|
4
4
|
module Kit
|
5
5
|
module V2
|
6
6
|
module Schemas
|
7
|
-
|
7
|
+
ROOT = 'urn:ietf:params:scim:schemas'
|
8
|
+
|
9
|
+
CORE = "#{ROOT}:core:2.0"
|
10
|
+
EXTENSION = "#{ROOT}:extension"
|
11
|
+
ENTERPRISE_USER = "#{EXTENSION}:enterprise:2.0:User"
|
8
12
|
GROUP = "#{CORE}:Group"
|
9
13
|
RESOURCE_TYPE = "#{CORE}:ResourceType"
|
10
14
|
SERVICE_PROVIDER_CONFIGURATION = "#{CORE}:ServiceProviderConfig"
|
data/lib/scim/kit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scim-kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|