scim-kit 0.2.14 → 0.2.15
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 +7 -3
- data/lib/scim/kit/v2/meta.rb +1 -1
- data/lib/scim/kit/v2/resource.rb +8 -5
- data/lib/scim/kit/version.rb +1 -1
- data/lib/scim/kit.rb +3 -0
- 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: 29f7f31b1bd1883c5596ae65c31154ccc5a677e3544b99bc1b094a5d642cabe3
|
4
|
+
data.tar.gz: 7410afff1d62abb9707de138964af6c05cfb144be5b81391f6c8d16a36bbb730
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e160792a08bd353d7e7b087a3bccb1ee858bfc1b049c56f74d00d5965a37b7a71f5b7761ba5173a67bba7e51489eca37e8fafd67c2489fe73aafb3b9196ad9c2
|
7
|
+
data.tar.gz: 218155f337f9d0f2ce1a989208ec9368be426d25f691bcda9bb437a130251bd53e9f0c3e09bda6743bc604311cdb6385fd9604c4b60ffa680607473ab9d32448
|
@@ -5,10 +5,11 @@ module Scim
|
|
5
5
|
module V2
|
6
6
|
# Represents a dynamic attribute that corresponds to a SCIM type
|
7
7
|
module Attributable
|
8
|
-
|
8
|
+
def dynamic_attributes
|
9
|
+
@dynamic_attributes ||= {}.with_indifferent_access
|
10
|
+
end
|
9
11
|
|
10
12
|
def define_attributes_for(resource, types)
|
11
|
-
@dynamic_attributes ||= {}.with_indifferent_access
|
12
13
|
types.each { |x| attribute(x, resource) }
|
13
14
|
end
|
14
15
|
|
@@ -41,7 +42,10 @@ module Scim
|
|
41
42
|
if value.is_a?(Hash)
|
42
43
|
attribute_for(name)&.assign_attributes(value)
|
43
44
|
else
|
44
|
-
attribute_for(name)
|
45
|
+
attribute = attribute_for(name)
|
46
|
+
raise Scim::Kit::UnknownAttributeError, name unless attribute
|
47
|
+
|
48
|
+
attribute._value = value
|
45
49
|
end
|
46
50
|
end
|
47
51
|
|
data/lib/scim/kit/v2/meta.rb
CHANGED
@@ -12,7 +12,7 @@ module Scim
|
|
12
12
|
attr_reader :resource_type
|
13
13
|
|
14
14
|
def initialize(resource_type, location)
|
15
|
-
@resource_type = resource_type
|
15
|
+
@resource_type = resource_type || 'Unknown'
|
16
16
|
@location = location
|
17
17
|
@created = @last_modified = Time.now
|
18
18
|
@version = @created.to_i
|
data/lib/scim/kit/v2/resource.rb
CHANGED
@@ -9,7 +9,6 @@ module Scim
|
|
9
9
|
include Attributable
|
10
10
|
include Templatable
|
11
11
|
|
12
|
-
attr_accessor :id, :external_id
|
13
12
|
attr_reader :meta
|
14
13
|
attr_reader :schemas
|
15
14
|
attr_reader :raw_attributes
|
@@ -17,13 +16,13 @@ module Scim
|
|
17
16
|
validate :schema_validations
|
18
17
|
|
19
18
|
def initialize(schemas:, location: nil, attributes: {})
|
20
|
-
@meta = Meta.new(schemas[0]
|
19
|
+
@meta = Meta.new(schemas[0]&.name, location)
|
21
20
|
@meta.disable_timestamps
|
22
21
|
@schemas = schemas
|
23
22
|
@raw_attributes = attributes
|
24
|
-
schemas.each
|
25
|
-
|
26
|
-
|
23
|
+
schemas.each { |x| define_attributes_for(self, x.attributes) }
|
24
|
+
attribute(AttributeType.new(name: :id), self)
|
25
|
+
attribute(AttributeType.new(name: :external_id), self)
|
27
26
|
assign_attributes(attributes)
|
28
27
|
yield self if block_given?
|
29
28
|
end
|
@@ -37,6 +36,10 @@ module Scim
|
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
39
|
+
def template_name
|
40
|
+
'resource.json.jbuilder'
|
41
|
+
end
|
42
|
+
|
40
43
|
private
|
41
44
|
|
42
45
|
def schema_validations
|
data/lib/scim/kit/version.rb
CHANGED
data/lib/scim/kit.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'active_model'
|
4
4
|
require 'active_support/core_ext/hash/indifferent_access'
|
5
|
+
require 'json'
|
6
|
+
require 'pathname'
|
5
7
|
require 'tilt'
|
6
8
|
require 'tilt/jbuilder'
|
7
9
|
|
@@ -14,5 +16,6 @@ require 'scim/kit/version'
|
|
14
16
|
module Scim
|
15
17
|
module Kit
|
16
18
|
class Error < StandardError; end
|
19
|
+
class UnknownAttributeError < Error; end
|
17
20
|
end
|
18
21
|
end
|
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.15
|
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-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|