scim-kit 0.2.12 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aafb2f3aa6f0b41a4ebde4b089882c524cf66d2e21f235ee052a0c675cc019c8
4
- data.tar.gz: dd26edce1bcdde02047b660430ef1621b802f974b6e43575bf438c77c48d2a5b
3
+ metadata.gz: 5cd1a84727f27f1044be51ade6de69ff5ff77907d6bb93f3a523838107672ba3
4
+ data.tar.gz: 9d0e8a6b8a2f254283771f7ee73bc46b32ed5755ac0ae6f5a893ae9b6a8f579e
5
5
  SHA512:
6
- metadata.gz: cc0f4f87fa2e6c74084e8e757ebdceac4ddf8837b11170a0b0a0947aa9637f3af7652b8605bf0c9fad796eef0d1f451f0dd87023f1ce9422cfc3d46c79372a49
7
- data.tar.gz: c280082b331cb57b282ff72592e6f0a7b911032b3e2e8840c6b34d812b660817f64afcdb1656d57b26b20af3658420aedc7f96e3a75ee48cf1861f74033aa922
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
- attribute = attribute_for(name)
30
- attribute._value = value
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)
@@ -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
 
@@ -4,7 +4,11 @@ module Scim
4
4
  module Kit
5
5
  module V2
6
6
  module Schemas
7
- CORE = 'urn:ietf:params:scim:schemas:core:2.0'
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"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Scim
4
4
  module Kit
5
- VERSION = '0.2.12'
5
+ VERSION = '0.2.13'
6
6
  end
7
7
  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.12
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-13 00:00:00.000000000 Z
11
+ date: 2019-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel