scim-kit 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.travis.yml +3 -2
- data/CHANGELOG.md +8 -2
- data/Gemfile.lock +39 -37
- data/lib/scim/kit.rb +1 -0
- data/lib/scim/kit/v2.rb +2 -0
- data/lib/scim/kit/v2/filter.rb +6 -0
- data/lib/scim/kit/v2/filter/node.rb +56 -0
- data/lib/scim/kit/v2/filter/visitor.rb +98 -0
- data/lib/scim/kit/version.rb +1 -1
- data/scim-kit.gemspec +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b60b3e63ba6e9f5c06f8599ab0bd96bc240368de942e0a1794f9a9a5fff3ad6
|
4
|
+
data.tar.gz: d4eba2104e2a74c0e0b392307441c4488daae459cb93f68543cb9f5381963613
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 012120f9e716e26a55f4fbaf62c4801013a8ce15f107e5a586a8d6088c343b1d67da8837fe62984e197a5bd3c800d805e280d5b9edc04225b6f2fee39cf7bfc7
|
7
|
+
data.tar.gz: 76da061e7b3a041efe01bce32625efbcd6bd7a62c383f3c5404e9d83d45678b8ab314ec50f0251e604f3656df5af73a94aa10c8b3b008df65397259344a9384a
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Version 0.
|
1
|
+
Version 0.5.0
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
All notable changes to this project will be documented in this file.
|
@@ -9,7 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
9
9
|
## [Unreleased]
|
10
10
|
- nil
|
11
11
|
|
12
|
+
## [0.5.0] - 2020-01-21
|
13
|
+
### Added
|
14
|
+
- Add API to traverse a SCIM filter AST
|
15
|
+
|
12
16
|
## [0.4.0] - 2019-06-15
|
17
|
+
### Added
|
13
18
|
- add implementation of SCIM 2.0 filter parser. [RFC-7644](https://tools.ietf.org/html/rfc7644#section-3.4.2.2)
|
14
19
|
|
15
20
|
## [0.3.2] - 2019-02-23
|
@@ -39,7 +44,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
39
44
|
- \_assign does not coerce values by default.
|
40
45
|
- errors are merged together instead of overwritten during attribute validation.
|
41
46
|
|
42
|
-
[Unreleased]: https://github.com/mokhan/scim-kit/compare/v0.
|
47
|
+
[Unreleased]: https://github.com/mokhan/scim-kit/compare/v0.5.0...HEAD
|
48
|
+
[0.4.0]: https://github.com/mokhan/scim-kit/compare/v0.4.0...v0.5.0
|
43
49
|
[0.4.0]: https://github.com/mokhan/scim-kit/compare/v0.3.2...v0.4.0
|
44
50
|
[0.3.2]: https://github.com/mokhan/scim-kit/compare/v0.3.1...v0.3.2
|
45
51
|
[0.3.1]: https://github.com/mokhan/scim-kit/compare/v0.3.0...v0.3.1
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
scim-kit (0.
|
4
|
+
scim-kit (0.5.0)
|
5
5
|
activemodel (>= 5.2.0)
|
6
6
|
net-hippie (~> 0.2)
|
7
7
|
parslet (~> 1.8)
|
@@ -11,77 +11,79 @@ PATH
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
activemodel (
|
15
|
-
activesupport (=
|
16
|
-
activesupport (
|
14
|
+
activemodel (6.0.2.1)
|
15
|
+
activesupport (= 6.0.2.1)
|
16
|
+
activesupport (6.0.2.1)
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
18
|
i18n (>= 0.7, < 2)
|
19
19
|
minitest (~> 5.1)
|
20
20
|
tzinfo (~> 1.1)
|
21
|
-
|
22
|
-
|
21
|
+
zeitwerk (~> 2.2)
|
22
|
+
addressable (2.7.0)
|
23
|
+
public_suffix (>= 2.0.2, < 5.0)
|
23
24
|
ast (2.4.0)
|
24
25
|
bundler-audit (0.6.1)
|
25
26
|
bundler (>= 1.2.0, < 3)
|
26
27
|
thor (~> 0.18)
|
27
|
-
byebug (11.0
|
28
|
+
byebug (11.1.0)
|
28
29
|
concurrent-ruby (1.1.5)
|
29
30
|
crack (0.4.3)
|
30
31
|
safe_yaml (~> 1.0.0)
|
31
32
|
diff-lcs (1.3)
|
32
|
-
ffaker (2.
|
33
|
-
hashdiff (0.
|
34
|
-
i18n (1.
|
33
|
+
ffaker (2.13.0)
|
34
|
+
hashdiff (1.0.0)
|
35
|
+
i18n (1.8.2)
|
35
36
|
concurrent-ruby (~> 1.0)
|
36
|
-
jaro_winkler (1.5.
|
37
|
+
jaro_winkler (1.5.4)
|
37
38
|
jbuilder (2.9.1)
|
38
39
|
activesupport (>= 4.2.0)
|
39
|
-
minitest (5.
|
40
|
-
net-hippie (0.
|
41
|
-
parallel (1.
|
42
|
-
parser (2.
|
40
|
+
minitest (5.14.0)
|
41
|
+
net-hippie (0.3.1)
|
42
|
+
parallel (1.19.1)
|
43
|
+
parser (2.7.0.2)
|
43
44
|
ast (~> 2.4.0)
|
44
45
|
parslet (1.8.2)
|
45
|
-
public_suffix (
|
46
|
+
public_suffix (4.0.3)
|
46
47
|
rainbow (3.0.0)
|
47
|
-
rake (
|
48
|
-
rspec (3.
|
49
|
-
rspec-core (~> 3.
|
50
|
-
rspec-expectations (~> 3.
|
51
|
-
rspec-mocks (~> 3.
|
52
|
-
rspec-core (3.
|
53
|
-
rspec-support (~> 3.
|
54
|
-
rspec-expectations (3.
|
48
|
+
rake (13.0.1)
|
49
|
+
rspec (3.9.0)
|
50
|
+
rspec-core (~> 3.9.0)
|
51
|
+
rspec-expectations (~> 3.9.0)
|
52
|
+
rspec-mocks (~> 3.9.0)
|
53
|
+
rspec-core (3.9.1)
|
54
|
+
rspec-support (~> 3.9.1)
|
55
|
+
rspec-expectations (3.9.0)
|
55
56
|
diff-lcs (>= 1.2.0, < 2.0)
|
56
|
-
rspec-support (~> 3.
|
57
|
-
rspec-mocks (3.
|
57
|
+
rspec-support (~> 3.9.0)
|
58
|
+
rspec-mocks (3.9.1)
|
58
59
|
diff-lcs (>= 1.2.0, < 2.0)
|
59
|
-
rspec-support (~> 3.
|
60
|
-
rspec-support (3.
|
61
|
-
rubocop (0.
|
60
|
+
rspec-support (~> 3.9.0)
|
61
|
+
rspec-support (3.9.2)
|
62
|
+
rubocop (0.79.0)
|
62
63
|
jaro_winkler (~> 1.5.1)
|
63
64
|
parallel (~> 1.10)
|
64
|
-
parser (>= 2.
|
65
|
+
parser (>= 2.7.0.1)
|
65
66
|
rainbow (>= 2.2.2, < 4.0)
|
66
67
|
ruby-progressbar (~> 1.7)
|
67
68
|
unicode-display_width (>= 1.4.0, < 1.7)
|
68
|
-
rubocop-rspec (1.
|
69
|
-
rubocop (>= 0.
|
69
|
+
rubocop-rspec (1.37.1)
|
70
|
+
rubocop (>= 0.68.1)
|
70
71
|
ruby-progressbar (1.10.1)
|
71
72
|
safe_yaml (1.0.5)
|
72
73
|
thor (0.20.3)
|
73
74
|
thread_safe (0.3.6)
|
74
|
-
tilt (2.0.
|
75
|
+
tilt (2.0.10)
|
75
76
|
tilt-jbuilder (0.7.1)
|
76
77
|
jbuilder
|
77
78
|
tilt (>= 1.3.0, < 3)
|
78
|
-
tzinfo (1.2.
|
79
|
+
tzinfo (1.2.6)
|
79
80
|
thread_safe (~> 0.1)
|
80
|
-
unicode-display_width (1.6.
|
81
|
-
webmock (3.
|
81
|
+
unicode-display_width (1.6.1)
|
82
|
+
webmock (3.8.0)
|
82
83
|
addressable (>= 2.3.6)
|
83
84
|
crack (>= 0.3.2)
|
84
85
|
hashdiff (>= 0.4.0, < 2.0.0)
|
86
|
+
zeitwerk (2.2.2)
|
85
87
|
|
86
88
|
PLATFORMS
|
87
89
|
ruby
|
@@ -91,7 +93,7 @@ DEPENDENCIES
|
|
91
93
|
bundler-audit (~> 0.6)
|
92
94
|
byebug
|
93
95
|
ffaker (~> 2.7)
|
94
|
-
rake (~>
|
96
|
+
rake (~> 13.0)
|
95
97
|
rspec (~> 3.0)
|
96
98
|
rubocop (~> 0.52)
|
97
99
|
rubocop-rspec (~> 1.22)
|
data/lib/scim/kit.rb
CHANGED
data/lib/scim/kit/v2.rb
CHANGED
@@ -12,6 +12,8 @@ require 'scim/kit/v2/mutability'
|
|
12
12
|
require 'scim/kit/v2/resource'
|
13
13
|
require 'scim/kit/v2/error'
|
14
14
|
require 'scim/kit/v2/filter'
|
15
|
+
require 'scim/kit/v2/filter/node'
|
16
|
+
require 'scim/kit/v2/filter/visitor'
|
15
17
|
require 'scim/kit/v2/resource_type'
|
16
18
|
require 'scim/kit/v2/returned'
|
17
19
|
require 'scim/kit/v2/schema'
|
data/lib/scim/kit/v2/filter.rb
CHANGED
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'parslet'
|
4
|
+
|
5
|
+
module Scim
|
6
|
+
module Kit
|
7
|
+
module V2
|
8
|
+
class Filter
|
9
|
+
# @private
|
10
|
+
class Node
|
11
|
+
def initialize(hash)
|
12
|
+
@hash = hash
|
13
|
+
end
|
14
|
+
|
15
|
+
def operator
|
16
|
+
self[:operator].to_sym
|
17
|
+
end
|
18
|
+
|
19
|
+
def attribute
|
20
|
+
self[:attribute].to_s
|
21
|
+
end
|
22
|
+
|
23
|
+
def value
|
24
|
+
self[:value].to_s[1..-2]
|
25
|
+
end
|
26
|
+
|
27
|
+
def not?
|
28
|
+
@hash.key?(:not)
|
29
|
+
end
|
30
|
+
|
31
|
+
def accept(visitor)
|
32
|
+
visitor.visit(self)
|
33
|
+
end
|
34
|
+
|
35
|
+
def left
|
36
|
+
self.class.new(self[:left])
|
37
|
+
end
|
38
|
+
|
39
|
+
def right
|
40
|
+
self.class.new(self[:right])
|
41
|
+
end
|
42
|
+
|
43
|
+
def inspect
|
44
|
+
@hash.inspect
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def [](key)
|
50
|
+
@hash[key]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'parslet'
|
4
|
+
|
5
|
+
module Scim
|
6
|
+
module Kit
|
7
|
+
module V2
|
8
|
+
class Filter
|
9
|
+
# @private
|
10
|
+
class Visitor
|
11
|
+
VISITORS = {
|
12
|
+
and: :visit_and,
|
13
|
+
co: :visit_contains,
|
14
|
+
eq: :visit_equals,
|
15
|
+
ew: :visit_ends_with,
|
16
|
+
ge: :visit_greater_than_equals,
|
17
|
+
gt: :visit_greater_than,
|
18
|
+
le: :visit_less_than_equals,
|
19
|
+
lt: :visit_less_than,
|
20
|
+
ne: :visit_not_equals,
|
21
|
+
or: :visit_or,
|
22
|
+
pr: :visit_presence,
|
23
|
+
sw: :visit_starts_with
|
24
|
+
}.freeze
|
25
|
+
|
26
|
+
def visit(node)
|
27
|
+
visitor_for(node).call(node)
|
28
|
+
end
|
29
|
+
|
30
|
+
protected
|
31
|
+
|
32
|
+
def visitor_for(node)
|
33
|
+
method(VISITORS.fetch(node.operator, :visit_unknown))
|
34
|
+
end
|
35
|
+
|
36
|
+
def visit_and(node)
|
37
|
+
visit(node.left).merge(visit(node.right))
|
38
|
+
raise error_for(:visit_and)
|
39
|
+
end
|
40
|
+
|
41
|
+
def visit_or(_node)
|
42
|
+
raise error_for(:visit_or)
|
43
|
+
end
|
44
|
+
|
45
|
+
def visit_equals(_node)
|
46
|
+
raise error_for(:visit_equals)
|
47
|
+
end
|
48
|
+
|
49
|
+
def visit_not_equals(_node)
|
50
|
+
raise error_for(:visit_not_equals)
|
51
|
+
end
|
52
|
+
|
53
|
+
def visit_contains(_node)
|
54
|
+
raise error_for(:visit_contains)
|
55
|
+
end
|
56
|
+
|
57
|
+
def visit_starts_with(_node)
|
58
|
+
raise error_for(:visit_starts_with)
|
59
|
+
end
|
60
|
+
|
61
|
+
def visit_ends_with(_node)
|
62
|
+
raise error_for(:visit_ends_with)
|
63
|
+
end
|
64
|
+
|
65
|
+
def visit_greater_than(_node)
|
66
|
+
raise error_for(:visit_greater_than)
|
67
|
+
end
|
68
|
+
|
69
|
+
def visit_greater_than_equals(_node)
|
70
|
+
raise error_for(:visit_greater_than_equals)
|
71
|
+
end
|
72
|
+
|
73
|
+
def visit_less_than(_node)
|
74
|
+
raise error_for(:visit_less_than)
|
75
|
+
end
|
76
|
+
|
77
|
+
def visit_less_than_equals(_node)
|
78
|
+
raise error_for(:visit_less_than_equals)
|
79
|
+
end
|
80
|
+
|
81
|
+
def visit_presence(_node)
|
82
|
+
raise error_for(:visit_presence)
|
83
|
+
end
|
84
|
+
|
85
|
+
def visit_unknown(_node)
|
86
|
+
raise error_for(:visit_unknown)
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
|
91
|
+
def error_for(method)
|
92
|
+
::Scim::Kit::NotImplementedError.new("#{method} is not implemented")
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
data/lib/scim/kit/version.rb
CHANGED
data/scim-kit.gemspec
CHANGED
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
|
|
39
39
|
spec.add_development_dependency 'bundler-audit', '~> 0.6'
|
40
40
|
spec.add_development_dependency 'byebug'
|
41
41
|
spec.add_development_dependency 'ffaker', '~> 2.7'
|
42
|
-
spec.add_development_dependency 'rake', '~>
|
42
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
43
43
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
44
44
|
spec.add_development_dependency 'rubocop', '~> 0.52'
|
45
45
|
spec.add_development_dependency 'rubocop-rspec', '~> 1.22'
|
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.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
145
|
+
version: '13.0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
152
|
+
version: '13.0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rspec
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -245,6 +245,8 @@ files:
|
|
245
245
|
- lib/scim/kit/v2/configuration.rb
|
246
246
|
- lib/scim/kit/v2/error.rb
|
247
247
|
- lib/scim/kit/v2/filter.rb
|
248
|
+
- lib/scim/kit/v2/filter/node.rb
|
249
|
+
- lib/scim/kit/v2/filter/visitor.rb
|
248
250
|
- lib/scim/kit/v2/messages.rb
|
249
251
|
- lib/scim/kit/v2/meta.rb
|
250
252
|
- lib/scim/kit/v2/mutability.rb
|
@@ -289,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
289
291
|
- !ruby/object:Gem::Version
|
290
292
|
version: '0'
|
291
293
|
requirements: []
|
292
|
-
rubygems_version: 3.
|
294
|
+
rubygems_version: 3.1.2
|
293
295
|
signing_key:
|
294
296
|
specification_version: 4
|
295
297
|
summary: A simple toolkit for working with SCIM 2.0
|