scim-kit 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4927e495e03c22db7cfe706323d710cc3679fa7f3f69c9e81c95eebc14c5fb2
4
- data.tar.gz: 4a465b912bc234e23eddbaa6066550b12b7a8f1a54a018ede1ceb59b0da98834
3
+ metadata.gz: 6c3387262115568567b66e8b8841b1ee4cc2b5b6ae9907a0fbe6ba8d6b370527
4
+ data.tar.gz: 7d68e2ee54e4ea77afbbd6917ff88465d1f1159a4c9875d3cfc646ded9b59fcb
5
5
  SHA512:
6
- metadata.gz: 1cfc455af11f819193eece084026a7d5dd18ae244365a543269b1027388ad1ff0ba291eb1a2a70758e2dfc6ec15a867f4339c383e996935d93df5876c00bec49
7
- data.tar.gz: 93510335e4ab9d219ef18786b5f04a086f45e6464a9c6403b2a24c9fdeec581e6c7a54b563195d5a2613708dec424d994061059acfe89bda624cf68213a12cdb
6
+ metadata.gz: 04652d7191799e43a400626471672c39fd29939bd7c7b6b84bc756a77262de54e74d624064e2ada5afd8edb0ef4e1bc4eb1137b065d3f64c2f1db7669303d359
7
+ data.tar.gz: cfb017b66a7fb18a3f97bde84043efb158015e8d3bd0b266146e203e5335e4f6aba6bc3d6abb082d124aacf83cd3707e97125b831f39ed7f1c88b60f511c15db
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- Version 0.7.0
1
+ Version 0.7.1
2
2
 
3
3
  # Changelog
4
4
  All notable changes to this project will be documented in this file.
@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.7.1] - 2022-12-12
12
+ ### Fixed
13
+ - Add support for duplicate attribute names
14
+
11
15
  ## [0.7.0] - 2022-09-28
12
16
  ### Added
13
17
  - Add constant for 'urn:ietf:params:scim:api:messages:2.0:BulkRequest' [RFC-7644](https://www.rfc-editor.org/rfc/rfc7644.html#section-3.7)
@@ -15,7 +19,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
15
19
  - Add constant for 'urn:ietf:params:scim:api:messages:2.0:PatchOp' [RFC-7644](https://www.rfc-editor.org/rfc/rfc7644.html#section-3.5.2)
16
20
  - Add constant for 'urn:ietf:params:scim:schemas:core:2.0:Schema' [RFC-7643](https://www.rfc-editor.org/rfc/rfc7643.html#section-7)
17
21
 
18
-
19
22
  ## [0.6.0] - 2022-05-23
20
23
  ### Added
21
24
  - Add support for Ruby 3.1
@@ -82,7 +85,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
82
85
  - \_assign does not coerce values by default.
83
86
  - errors are merged together instead of overwritten during attribute validation.
84
87
 
85
- [Unreleased]: https://github.com/xlgmokha/scim-kit/compare/v0.7.0...HEAD
88
+ [Unreleased]: https://github.com/xlgmokha/scim-kit/compare/v0.7.1...HEAD
89
+ [0.7.1]: https://github.com/xlgmokha/scim-kit/compare/v0.7.0...v0.7.1
86
90
  [0.7.0]: https://github.com/xlgmokha/scim-kit/compare/v0.6.0...v0.7.0
87
91
  [0.6.0]: https://github.com/xlgmokha/scim-kit/compare/v0.5.3...v0.6.0
88
92
  [0.5.3]: https://github.com/xlgmokha/scim-kit/compare/v0.5.2...v0.5.3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- scim-kit (0.7.0)
4
+ scim-kit (0.7.1)
5
5
  activemodel (>= 6.1, < 8.0)
6
6
  net-hippie (~> 1.0)
7
7
  parslet (~> 2.0)
@@ -50,10 +50,10 @@ GEM
50
50
  mini_portile2 (2.8.0)
51
51
  minitest (5.16.3)
52
52
  net-hippie (1.1.1)
53
- nokogiri (1.13.8)
53
+ nokogiri (1.13.10)
54
54
  mini_portile2 (~> 2.8.0)
55
55
  racc (~> 1.4)
56
- nokogiri (1.13.8-x86_64-linux)
56
+ nokogiri (1.13.10-x86_64-linux)
57
57
  racc (~> 1.4)
58
58
  parallel (1.21.0)
59
59
  parser (3.1.0.0)
@@ -70,19 +70,19 @@ GEM
70
70
  rake (13.0.6)
71
71
  regexp_parser (2.2.0)
72
72
  rexml (3.2.5)
73
- rspec (3.11.0)
74
- rspec-core (~> 3.11.0)
75
- rspec-expectations (~> 3.11.0)
76
- rspec-mocks (~> 3.11.0)
77
- rspec-core (3.11.0)
78
- rspec-support (~> 3.11.0)
79
- rspec-expectations (3.11.0)
73
+ rspec (3.12.0)
74
+ rspec-core (~> 3.12.0)
75
+ rspec-expectations (~> 3.12.0)
76
+ rspec-mocks (~> 3.12.0)
77
+ rspec-core (3.12.0)
78
+ rspec-support (~> 3.12.0)
79
+ rspec-expectations (3.12.0)
80
80
  diff-lcs (>= 1.2.0, < 2.0)
81
- rspec-support (~> 3.11.0)
82
- rspec-mocks (3.11.0)
81
+ rspec-support (~> 3.12.0)
82
+ rspec-mocks (3.12.0)
83
83
  diff-lcs (>= 1.2.0, < 2.0)
84
- rspec-support (~> 3.11.0)
85
- rspec-support (3.11.0)
84
+ rspec-support (~> 3.12.0)
85
+ rspec-support (3.12.0)
86
86
  rubocop (0.93.1)
87
87
  parallel (~> 1.10)
88
88
  parser (>= 2.7.1.5)
@@ -38,7 +38,9 @@ module Scim
38
38
  # @param name [String] the name of the attribute to return
39
39
  # @return [Scim::Kit::V2::Attribute] the attribute or {Scim::Kit::V2::UnknownAttribute}
40
40
  def attribute_for(name)
41
- dynamic_attributes[name.to_s.underscore] || UnknownAttribute.new(name)
41
+ dynamic_attributes[name.to_s.underscore] ||
42
+ dynamic_attributes[name] ||
43
+ UnknownAttribute.new(name)
42
44
  end
43
45
 
44
46
  # Returns the value associated with the attribute name
@@ -86,11 +88,10 @@ module Scim
86
88
  end
87
89
 
88
90
  def attribute(type, resource)
89
- dynamic_attributes[type.name] = Attribute.new(
90
- type: type,
91
- resource: resource
92
- )
93
- extend(create_module_for(type))
91
+ previously_defined = dynamic_attributes.key?(type.name)
92
+ dynamic_attributes[previously_defined ? type.fully_qualified_name : type.name] =
93
+ Attribute.new(type: type, resource: resource)
94
+ extend(create_module_for(type)) unless previously_defined
94
95
  end
95
96
  end
96
97
  end
@@ -8,16 +8,15 @@ module Scim
8
8
  include Templatable
9
9
  attr_accessor :canonical_values, :case_exact, :description
10
10
  attr_accessor :multi_valued, :required
11
- attr_reader :mutability, :name, :type, :attributes
11
+ attr_reader :mutability, :name, :fully_qualified_name, :type, :attributes
12
12
  attr_reader :reference_types, :returned, :uniqueness
13
13
 
14
- def initialize(name:, type: :string)
14
+ def initialize(name:, type: :string, schema: nil)
15
15
  @name = name.to_s.underscore
16
+ @fully_qualified_name = [schema&.id, @name].compact.join('#')
16
17
  @type = DATATYPES[type.to_sym] ? type.to_sym : (raise TYPE_ERROR)
17
18
  @description = name.to_s.camelize(:lower)
18
- @multi_valued = false
19
- @required = false
20
- @case_exact = false
19
+ @multi_valued = @required = @case_exact = false
21
20
  @mutability = Mutability::READ_WRITE
22
21
  @returned = Returned::DEFAULT
23
22
  @uniqueness = Uniqueness::NONE
@@ -21,7 +21,7 @@ module Scim
21
21
  end
22
22
 
23
23
  def add_attribute(name:, type: :string)
24
- attribute = AttributeType.new(name: name, type: type)
24
+ attribute = AttributeType.new(name: name, type: type, schema: self)
25
25
  yield attribute if block_given?
26
26
  attributes << attribute
27
27
  end
@@ -18,7 +18,8 @@ schemas.each do |schema|
18
18
  else
19
19
  json.set! schema.id do
20
20
  schema.attributes.each do |type|
21
- attribute = dynamic_attributes[type.name]
21
+ attribute = dynamic_attributes[type.fully_qualified_name] ||
22
+ dynamic_attributes[type.name]
22
23
  render attribute, json: json
23
24
  end
24
25
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Scim
4
4
  module Kit
5
- VERSION = '0.7.0'
5
+ VERSION = '0.7.1'
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.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-29 00:00:00.000000000 Z
11
+ date: 2022-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel