scim-kit 0.5.0 → 0.5.3

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: 0b60b3e63ba6e9f5c06f8599ab0bd96bc240368de942e0a1794f9a9a5fff3ad6
4
- data.tar.gz: d4eba2104e2a74c0e0b392307441c4488daae459cb93f68543cb9f5381963613
3
+ metadata.gz: e04da9c51b8d2f628376742ef446809322862a42d6ef08869fa6abf5d5ba9f91
4
+ data.tar.gz: 62e3543d48e16a494d86c9fc1038292729b772a942015f2625c64c3113b048d0
5
5
  SHA512:
6
- metadata.gz: 012120f9e716e26a55f4fbaf62c4801013a8ce15f107e5a586a8d6088c343b1d67da8837fe62984e197a5bd3c800d805e280d5b9edc04225b6f2fee39cf7bfc7
7
- data.tar.gz: 76da061e7b3a041efe01bce32625efbcd6bd7a62c383f3c5404e9d83d45678b8ab314ec50f0251e604f3656df5af73a94aa10c8b3b008df65397259344a9384a
6
+ metadata.gz: 3a0355d563cca429617253f4c503f1a7cfcea87da3c57b1e6a4798833065641d1c93055e296120d5ea0002fb399d98079c2af534698203296ef320990a24dfaf
7
+ data.tar.gz: 7096ac7455e0352561c34c4fe0a4d810568340cf27fb89562d6d3cb70b3f4a90c255a933382c69c7f257bc2a690e6b3fead29822bc1bb9d79752704aee60d2f0
@@ -0,0 +1,9 @@
1
+ ---
2
+ version: 2
3
+ updates:
4
+ - package-ecosystem: "bundler"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "daily"
8
+ assignees:
9
+ - "xlgmokha"
@@ -0,0 +1,41 @@
1
+ name: ci
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ pull_request:
6
+ branches: [main]
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ matrix:
12
+ ruby-version: ['2.5', '2.6', '2.7', '3.0']
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Set up Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby-version }}
19
+ - run: sh bin/setup
20
+ - name: Running tests…
21
+ run: sh bin/test
22
+ style:
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: '3.0'
29
+ bundler-cache: true
30
+ - name: Running style checks…
31
+ run: sh bin/style
32
+ audit:
33
+ runs-on: ubuntu-latest
34
+ steps:
35
+ - uses: actions/checkout@v2
36
+ - uses: ruby/setup-ruby@v1
37
+ with:
38
+ ruby-version: '3.0'
39
+ bundler-cache: true
40
+ - name: Running audit…
41
+ run: sh bin/audit
data/.rspec CHANGED
@@ -1,3 +1,3 @@
1
- --format documentation
1
+ --format progress
2
2
  --color
3
3
  --require spec_helper
data/.rubocop.yml CHANGED
@@ -9,19 +9,53 @@ AllCops:
9
9
  - 'vendor/**/*'
10
10
  TargetRubyVersion: 2.5
11
11
 
12
+ Layout/ArgumentAlignment:
13
+ EnforcedStyle: with_fixed_indentation
14
+
15
+ Layout/EndOfLine:
16
+ EnforcedStyle: lf
17
+
12
18
  Layout/FirstArrayElementIndentation:
13
19
  EnforcedStyle: consistent
14
20
 
21
+ Layout/LineLength:
22
+ Exclude:
23
+ - 'spec/**/*.rb'
24
+ IgnoredPatterns:
25
+ - '^#*'
26
+
27
+ Layout/MultilineMethodCallIndentation:
28
+ Enabled: true
29
+ EnforcedStyle: indented
30
+
31
+ Layout/ParameterAlignment:
32
+ Enabled: true
33
+ EnforcedStyle: with_fixed_indentation
34
+ IndentationWidth: 2
35
+
36
+ Lint/AmbiguousBlockAssociation:
37
+ Exclude:
38
+ - 'spec/**/*.rb'
39
+
40
+ Lint/RaiseException:
41
+ Enabled: true
42
+
43
+ Lint/StructNewOverride:
44
+ Enabled: true
45
+
46
+ Metrics/AbcSize:
47
+ Exclude:
48
+ - 'lib/scim/kit/v2/service_provider_configuration.rb'
49
+
15
50
  Metrics/BlockLength:
16
51
  Exclude:
17
52
  - '*.gemspec'
53
+ - 'Rakefile'
18
54
  - 'spec/**/*.rb'
19
55
 
20
- Metrics/LineLength:
56
+ Metrics/ModuleLength:
21
57
  Exclude:
22
58
  - 'spec/**/*.rb'
23
- IgnoredPatterns:
24
- - '^#*'
25
59
 
26
60
  Naming/FileName:
27
61
  Exclude:
@@ -30,6 +64,37 @@ Naming/FileName:
30
64
  Naming/RescuedExceptionsVariableName:
31
65
  PreferredName: error
32
66
 
67
+ Style/Documentation:
68
+ Enabled: false
69
+
70
+ Style/HashEachMethods:
71
+ Enabled: true
72
+
73
+ Style/HashTransformKeys:
74
+ Enabled: true
75
+
76
+ Style/HashTransformValues:
77
+ Enabled: true
78
+
79
+ Style/IfUnlessModifier:
80
+ Exclude:
81
+ - 'lib/scim/kit/v2/attribute.rb'
82
+
83
+ Style/StringLiterals:
84
+ EnforcedStyle: 'single_quotes'
85
+
86
+ Style/TrailingCommaInArrayLiteral:
87
+ Enabled: false
88
+
89
+ Style/TrailingCommaInHashLiteral:
90
+ Enabled: false
91
+
92
+ RSpec/FilePath:
93
+ Enabled: false
94
+
95
+ RSpec/MultipleMemoizedHelpers:
96
+ Enabled: false
97
+
33
98
  RSpec/NamedSubject:
34
99
  Enabled: false
35
100
 
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- Version 0.5.0
1
+ Version 0.5.3
2
2
 
3
3
  # Changelog
4
4
  All notable changes to this project will be documented in this file.
@@ -7,7 +7,28 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
7
7
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
 
9
9
  ## [Unreleased]
10
- - nil
10
+
11
+ ## [0.5.3] - 2022-05-13
12
+ ### Fixed
13
+
14
+ - fix: change `status` attribute to type string in [error schema](https://www.rfc-editor.org/rfc/rfc7644.html#section-3.12)
15
+ - fix: remove duplicate `invalidSyntax`
16
+ - fix: add mising `invalidFilter`
17
+
18
+ ## [0.5.2] - 2020-05-20
19
+ ### Fixed
20
+
21
+ - fix: Parse sub attributes from schema https://github.com/xlgmokha/scim-kit/pull/38
22
+
23
+ ## [0.5.1] - 2020-05-20
24
+ ### Fixed
25
+ - Specify `Accept: application/scim+json` header when discovering a SCIM API.
26
+ - Specify `Content-Type: application/scim+json` header when discovering a SCIM API.
27
+ - Specify `User-Agent: scim/kit <version>` header when discovering a SCIM API.
28
+ - Follow HTTP redirects when discovering a SCIM API.
29
+ - Retry 3 times with backoff + jitter when a connection to a SCIM discovery API fails.
30
+ - Specify a 1 second open timeout.
31
+ - Specify a 5 second read timeout.
11
32
 
12
33
  ## [0.5.0] - 2020-01-21
13
34
  ### Added
@@ -44,8 +65,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
44
65
  - \_assign does not coerce values by default.
45
66
  - errors are merged together instead of overwritten during attribute validation.
46
67
 
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
68
+ [Unreleased]: https://github.com/mokhan/scim-kit/compare/v0.5.2...HEAD
69
+ [0.5.2]: https://github.com/mokhan/scim-kit/compare/v0.5.1...v0.5.2
70
+ [0.5.1]: https://github.com/mokhan/scim-kit/compare/v0.5.0...v0.5.1
71
+ [0.5.0]: https://github.com/mokhan/scim-kit/compare/v0.4.0...v0.5.0
49
72
  [0.4.0]: https://github.com/mokhan/scim-kit/compare/v0.3.2...v0.4.0
50
73
  [0.3.2]: https://github.com/mokhan/scim-kit/compare/v0.3.1...v0.3.2
51
74
  [0.3.1]: https://github.com/mokhan/scim-kit/compare/v0.3.0...v0.3.1
data/Gemfile.lock CHANGED
@@ -1,97 +1,124 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- scim-kit (0.5.0)
5
- activemodel (>= 5.2.0)
6
- net-hippie (~> 0.2)
7
- parslet (~> 1.8)
4
+ scim-kit (0.5.3)
5
+ activemodel (>= 6.1, < 8.0)
6
+ net-hippie (~> 1.0)
7
+ parslet (~> 2.0)
8
8
  tilt (~> 2.0)
9
9
  tilt-jbuilder (~> 0.7)
10
10
 
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- activemodel (6.0.2.1)
15
- activesupport (= 6.0.2.1)
16
- activesupport (6.0.2.1)
14
+ actionview (6.1.6)
15
+ activesupport (= 6.1.6)
16
+ builder (~> 3.1)
17
+ erubi (~> 1.4)
18
+ rails-dom-testing (~> 2.0)
19
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
20
+ activemodel (6.1.6)
21
+ activesupport (= 6.1.6)
22
+ activesupport (6.1.6)
17
23
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
- i18n (>= 0.7, < 2)
19
- minitest (~> 5.1)
20
- tzinfo (~> 1.1)
21
- zeitwerk (~> 2.2)
22
- addressable (2.7.0)
24
+ i18n (>= 1.6, < 2)
25
+ minitest (>= 5.1)
26
+ tzinfo (~> 2.0)
27
+ zeitwerk (~> 2.3)
28
+ addressable (2.8.0)
23
29
  public_suffix (>= 2.0.2, < 5.0)
24
- ast (2.4.0)
25
- bundler-audit (0.6.1)
30
+ ast (2.4.2)
31
+ builder (3.2.4)
32
+ bundler-audit (0.9.0.1)
26
33
  bundler (>= 1.2.0, < 3)
27
- thor (~> 0.18)
28
- byebug (11.1.0)
29
- concurrent-ruby (1.1.5)
30
- crack (0.4.3)
31
- safe_yaml (~> 1.0.0)
32
- diff-lcs (1.3)
33
- ffaker (2.13.0)
34
- hashdiff (1.0.0)
35
- i18n (1.8.2)
34
+ thor (~> 1.0)
35
+ concurrent-ruby (1.1.10)
36
+ crack (0.4.5)
37
+ rexml
38
+ crass (1.0.6)
39
+ diff-lcs (1.5.0)
40
+ erubi (1.10.0)
41
+ ffaker (2.21.0)
42
+ hashdiff (1.0.1)
43
+ i18n (1.10.0)
36
44
  concurrent-ruby (~> 1.0)
37
- jaro_winkler (1.5.4)
38
- jbuilder (2.9.1)
45
+ jbuilder (2.11.5)
46
+ actionview (>= 5.0.0)
47
+ activesupport (>= 5.0.0)
48
+ loofah (2.17.0)
49
+ crass (~> 1.0.2)
50
+ nokogiri (>= 1.5.9)
51
+ mini_portile2 (2.6.1)
52
+ minitest (5.15.0)
53
+ net-hippie (1.1.1)
54
+ nokogiri (1.12.5)
55
+ mini_portile2 (~> 2.6.1)
56
+ racc (~> 1.4)
57
+ nokogiri (1.12.5-x86_64-linux)
58
+ racc (~> 1.4)
59
+ parallel (1.21.0)
60
+ parser (3.1.0.0)
61
+ ast (~> 2.4.1)
62
+ parslet (2.0.0)
63
+ public_suffix (4.0.6)
64
+ racc (1.6.0)
65
+ rails-dom-testing (2.0.3)
39
66
  activesupport (>= 4.2.0)
40
- minitest (5.14.0)
41
- net-hippie (0.3.1)
42
- parallel (1.19.1)
43
- parser (2.7.0.2)
44
- ast (~> 2.4.0)
45
- parslet (1.8.2)
46
- public_suffix (4.0.3)
47
- rainbow (3.0.0)
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)
67
+ nokogiri (>= 1.6)
68
+ rails-html-sanitizer (1.4.2)
69
+ loofah (~> 2.3)
70
+ rainbow (3.1.1)
71
+ rake (13.0.6)
72
+ regexp_parser (2.2.0)
73
+ rexml (3.2.5)
74
+ rspec (3.11.0)
75
+ rspec-core (~> 3.11.0)
76
+ rspec-expectations (~> 3.11.0)
77
+ rspec-mocks (~> 3.11.0)
78
+ rspec-core (3.11.0)
79
+ rspec-support (~> 3.11.0)
80
+ rspec-expectations (3.11.0)
56
81
  diff-lcs (>= 1.2.0, < 2.0)
57
- rspec-support (~> 3.9.0)
58
- rspec-mocks (3.9.1)
82
+ rspec-support (~> 3.11.0)
83
+ rspec-mocks (3.11.0)
59
84
  diff-lcs (>= 1.2.0, < 2.0)
60
- rspec-support (~> 3.9.0)
61
- rspec-support (3.9.2)
62
- rubocop (0.79.0)
63
- jaro_winkler (~> 1.5.1)
85
+ rspec-support (~> 3.11.0)
86
+ rspec-support (3.11.0)
87
+ rubocop (0.93.1)
64
88
  parallel (~> 1.10)
65
- parser (>= 2.7.0.1)
89
+ parser (>= 2.7.1.5)
66
90
  rainbow (>= 2.2.2, < 4.0)
91
+ regexp_parser (>= 1.8)
92
+ rexml
93
+ rubocop-ast (>= 0.6.0)
67
94
  ruby-progressbar (~> 1.7)
68
- unicode-display_width (>= 1.4.0, < 1.7)
69
- rubocop-rspec (1.37.1)
70
- rubocop (>= 0.68.1)
71
- ruby-progressbar (1.10.1)
72
- safe_yaml (1.0.5)
73
- thor (0.20.3)
74
- thread_safe (0.3.6)
95
+ unicode-display_width (>= 1.4.0, < 2.0)
96
+ rubocop-ast (1.15.1)
97
+ parser (>= 3.0.1.1)
98
+ rubocop-rspec (1.44.1)
99
+ rubocop (~> 0.87)
100
+ rubocop-ast (>= 0.7.1)
101
+ ruby-progressbar (1.11.0)
102
+ thor (1.2.1)
75
103
  tilt (2.0.10)
76
104
  tilt-jbuilder (0.7.1)
77
105
  jbuilder
78
106
  tilt (>= 1.3.0, < 3)
79
- tzinfo (1.2.6)
80
- thread_safe (~> 0.1)
81
- unicode-display_width (1.6.1)
82
- webmock (3.8.0)
83
- addressable (>= 2.3.6)
107
+ tzinfo (2.0.4)
108
+ concurrent-ruby (~> 1.0)
109
+ unicode-display_width (1.8.0)
110
+ webmock (3.14.0)
111
+ addressable (>= 2.8.0)
84
112
  crack (>= 0.3.2)
85
113
  hashdiff (>= 0.4.0, < 2.0.0)
86
- zeitwerk (2.2.2)
114
+ zeitwerk (2.5.4)
87
115
 
88
116
  PLATFORMS
89
117
  ruby
118
+ x86_64-linux
90
119
 
91
120
  DEPENDENCIES
92
- bundler (~> 1.17)
93
121
  bundler-audit (~> 0.6)
94
- byebug
95
122
  ffaker (~> 2.7)
96
123
  rake (~> 13.0)
97
124
  rspec (~> 3.0)
@@ -101,4 +128,4 @@ DEPENDENCIES
101
128
  webmock (~> 3.5)
102
129
 
103
130
  BUNDLED WITH
104
- 1.17.3
131
+ 2.3.6
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # Scim::Kit
2
2
 
3
- [![Build Status](https://travis-ci.org/mokhan/scim-kit.svg?branch=master)](https://travis-ci.org/mokhan/scim-kit)
4
- [![Code Climate](https://codeclimate.com/github/mokhan/scim-kit.svg)](https://codeclimate.com/github/mokhan/scim-kit)
3
+ [![Build Status](https://github.com/xlgmokha/scim-kit/workflows/ci/badge.svg)](https://github.com/xlgmokha/scim-kit/actions)
5
4
  [![Gem Version](https://badge.fury.io/rb/scim-kit.svg)](https://rubygems.org/gems/scim-kit)
6
5
 
7
6
  Scim::Kit is a library with the purpose of simplifying the generation
@@ -87,7 +86,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
87
86
 
88
87
  ## Contributing
89
88
 
90
- Bug reports and pull requests are welcome on GitHub at https://github.com/mokhan/scim-kit.
89
+ Bug reports and pull requests are welcome on GitHub at https://github.com/xlgmokha/scim-kit.
91
90
 
92
91
  ## License
93
92
 
data/Rakefile CHANGED
@@ -9,5 +9,4 @@ RSpec::Core::RakeTask.new(:spec)
9
9
  RuboCop::RakeTask.new(:rubocop)
10
10
  Bundler::Audit::Task.new
11
11
 
12
- task lint: [:rubocop, 'bundle:audit']
13
12
  task default: :spec
data/bin/audit ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+
5
+ cd "$(dirname "$0")/.."
6
+
7
+ bundle exec rake bundle:audit
data/bin/setup CHANGED
@@ -1,6 +1,9 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
1
+ #!/bin/sh
5
2
 
6
- bundle check || bundle install --jobs "$(sysctl -n hw.ncpu || nproc)"
3
+ set -e
4
+
5
+ cd "$(dirname "$0")/.."
6
+
7
+ gem update --system
8
+ gem install bundler
9
+ bundle install
data/bin/shipit ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+
5
+ cd "$(dirname "$0")/.."
6
+
7
+ bundle exec rake release
data/bin/style ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+
5
+ cd "$(dirname "$0")/.."
6
+
7
+ bundle exec rubocop "$@"
data/bin/test CHANGED
@@ -1,21 +1,9 @@
1
- #!/bin/bash
2
-
3
- # script/test: Run test suite for application. Optionally pass in a path to an
4
- # individual test file to run a single test.
5
-
1
+ #!/bin/sh
6
2
 
7
3
  set -e
8
4
 
9
5
  cd "$(dirname "$0")/.."
10
6
 
11
- [ -z "$DEBUG" ] || set -x
12
-
13
- echo ["$(date "+%H:%M:%S")"] "==> Running setup…"
14
- bin/setup
7
+ export RUBYOPT='-W0'
15
8
 
16
- echo ["$(date "+%H:%M:%S")"] "==> Running tests…"
17
- if [[ $# -eq 0 ]]; then
18
- bundle exec rake spec
19
- else
20
- bundle exec rspec "$1"
21
- fi
9
+ bundle exec rspec "$@"
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Scim
4
+ module Kit
5
+ class Http
6
+ attr_reader :driver, :retries
7
+
8
+ def initialize(driver: Http.default_driver, retries: 3)
9
+ @driver = driver
10
+ @retries = retries
11
+ end
12
+
13
+ def get(uri)
14
+ driver.with_retry(retries: retries) do |client|
15
+ response = client.get(uri)
16
+ ok?(response) ? JSON.parse(response.body, symbolize_names: true) : {}
17
+ end
18
+ rescue *Net::Hippie::CONNECTION_ERRORS => error
19
+ Scim::Kit.logger.error(error)
20
+ {}
21
+ end
22
+
23
+ def self.default_driver
24
+ @default_driver ||= Net::Hippie::Client.new(
25
+ follow_redirects: 3,
26
+ headers: headers,
27
+ logger: Scim::Kit.logger,
28
+ open_timeout: 1,
29
+ read_timeout: 5
30
+ )
31
+ end
32
+
33
+ def self.headers
34
+ {
35
+ 'Accept' => 'application/scim+json',
36
+ 'Content-Type' => 'application/scim+json',
37
+ 'User-Agent' => "scim/kit #{Scim::Kit::VERSION}"
38
+ }
39
+ end
40
+
41
+ private
42
+
43
+ def ok?(response)
44
+ response.is_a?(Net::HTTPSuccess)
45
+ end
46
+ end
47
+ end
48
+ end
@@ -108,7 +108,7 @@ module Scim
108
108
  def valid_complex?(item)
109
109
  return false unless item.is_a?(Hash)
110
110
 
111
- item.keys.each do |key|
111
+ item.each_key do |key|
112
112
  return false unless type_for(key)&.valid?(item[key])
113
113
  end
114
114
  end
@@ -40,7 +40,8 @@ module Scim
40
40
  attr_accessor :resource_types
41
41
  attr_accessor :schemas
42
42
 
43
- def initialize
43
+ def initialize(http: Scim::Kit::Http.new)
44
+ @http = http
44
45
  @resource_types = {}
45
46
  @schemas = {}
46
47
 
@@ -48,9 +49,11 @@ module Scim
48
49
  end
49
50
 
50
51
  def load_from(base_url)
52
+ base_url = "#{base_url}/"
51
53
  uri = URI.join(base_url, 'ServiceProviderConfig')
52
- self.service_provider_configuration =
53
- ServiceProviderConfiguration.parse(client.get(uri).body)
54
+ json = http.get(uri)
55
+
56
+ self.service_provider_configuration = ServiceProviderConfiguration.parse(json, json)
54
57
 
55
58
  load_items(base_url, 'Schemas', Schema, schemas)
56
59
  load_items(base_url, 'ResourceTypes', ResourceType, resource_types)
@@ -58,25 +61,15 @@ module Scim
58
61
 
59
62
  private
60
63
 
64
+ attr_reader :http
65
+
61
66
  def load_items(base_url, path, type, items)
62
- response = client.get(URI.join(base_url, path), headers: headers)
63
- hashes = JSON.parse(response.body, symbolize_names: true)
67
+ hashes = http.get(URI.join(base_url, path))
64
68
  hashes.each do |hash|
65
69
  item = type.from(hash)
66
70
  items[item.id] = item
67
71
  end
68
72
  end
69
-
70
- def client
71
- @client ||= Net::Hippie::Client.new
72
- end
73
-
74
- def headers
75
- {
76
- 'Accept' => 'application/scim+json',
77
- 'Content-Type' => 'application/scim+json'
78
- }
79
- end
80
73
  end
81
74
  end
82
75
  end
@@ -6,9 +6,9 @@ module Scim
6
6
  # Represents a SCIM Error
7
7
  class Error < Resource
8
8
  SCIM_TYPES = %w[
9
+ invalidFilter
9
10
  invalidPath
10
11
  invalidSyntax
11
- invalidSyntax
12
12
  invalidValue
13
13
  invalidVers
14
14
  mutability
@@ -32,7 +32,7 @@ module Scim
32
32
  attribute.canonical_values = SCIM_TYPES
33
33
  end
34
34
  x.add_attribute(name: :detail)
35
- x.add_attribute(name: :status, type: :integer)
35
+ x.add_attribute(name: :status, type: :string)
36
36
  end
37
37
  end
38
38
  end
@@ -26,8 +26,8 @@ module Scim
26
26
  end
27
27
 
28
28
  class << self
29
- def build(*args)
30
- item = new(*args)
29
+ def build(**args)
30
+ item = new(**args)
31
31
  yield item
32
32
  item
33
33
  end
@@ -31,8 +31,8 @@ module Scim
31
31
  end
32
32
 
33
33
  class << self
34
- def build(*args)
35
- item = new(*args)
34
+ def build(**args)
35
+ item = new(**args)
36
36
  yield item
37
37
  item
38
38
  end
@@ -45,7 +45,7 @@ module Scim
45
45
  ) do |x|
46
46
  x.meta = Meta.from(hash[:meta])
47
47
  hash[:attributes].each do |y|
48
- x.attributes << AttributeType.from(y)
48
+ x.attributes << parse_attribute_type(y)
49
49
  end
50
50
  end
51
51
  end
@@ -53,6 +53,16 @@ module Scim
53
53
  def parse(json)
54
54
  from(JSON.parse(json, symbolize_names: true))
55
55
  end
56
+
57
+ private
58
+
59
+ def parse_attribute_type(hash)
60
+ attribute_type = AttributeType.from(hash)
61
+ hash[:subAttributes]&.each do |sub_attr_hash|
62
+ attribute_type.attributes << parse_attribute_type(sub_attr_hash)
63
+ end
64
+ attribute_type
65
+ end
56
66
  end
57
67
  end
58
68
  end
@@ -3,7 +3,7 @@
3
3
  json.key_format! camelize: :lower
4
4
  if _type.complex? && !_type.multi_valued
5
5
  json.set! _type.name do
6
- dynamic_attributes.values.each do |attribute|
6
+ dynamic_attributes.each_value do |attribute|
7
7
  render attribute, json: json
8
8
  end
9
9
  end
data/lib/scim/kit/v2.rb CHANGED
@@ -68,7 +68,7 @@ module Scim
68
68
  false
69
69
  end
70
70
  },
71
- reference: ->(x) { x =~ /\A#{URI.regexp(%w[http https])}\z/ },
71
+ reference: ->(x) { x =~ /\A#{URI::DEFAULT_PARSER.make_regexp(%w[http https])}\z/ },
72
72
  string: ->(x) { x.is_a?(String) }
73
73
  }.freeze
74
74
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Scim
4
4
  module Kit
5
- VERSION = '0.5.0'
5
+ VERSION = '0.5.3'
6
6
  end
7
7
  end
data/lib/scim/kit.rb CHANGED
@@ -10,6 +10,7 @@ require 'tilt'
10
10
  require 'tilt/jbuilder'
11
11
 
12
12
  require 'scim/kit/dynamic_attributes'
13
+ require 'scim/kit/http'
13
14
  require 'scim/kit/templatable'
14
15
  require 'scim/kit/template'
15
16
  require 'scim/kit/v2'
data/scim-kit.gemspec CHANGED
@@ -27,17 +27,15 @@ Gem::Specification.new do |spec|
27
27
  File.basename(file)
28
28
  end
29
29
  spec.require_paths = ['lib']
30
- spec.required_ruby_version = '>= 2.5.0'
30
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
31
31
  spec.metadata['yard.run'] = 'yri'
32
32
 
33
- spec.add_dependency 'activemodel', '>= 5.2.0'
34
- spec.add_dependency 'net-hippie', '~> 0.2'
35
- spec.add_dependency 'parslet', '~> 1.8'
33
+ spec.add_dependency 'activemodel', '>= 6.1', '< 8.0'
34
+ spec.add_dependency 'net-hippie', '~> 1.0'
35
+ spec.add_dependency 'parslet', '~> 2.0'
36
36
  spec.add_dependency 'tilt', '~> 2.0'
37
37
  spec.add_dependency 'tilt-jbuilder', '~> 0.7'
38
- spec.add_development_dependency 'bundler', '~> 1.17'
39
38
  spec.add_development_dependency 'bundler-audit', '~> 0.6'
40
- spec.add_development_dependency 'byebug'
41
39
  spec.add_development_dependency 'ffaker', '~> 2.7'
42
40
  spec.add_development_dependency 'rake', '~> 13.0'
43
41
  spec.add_development_dependency 'rspec', '~> 3.0'
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.5.0
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-21 00:00:00.000000000 Z
11
+ date: 2022-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -16,42 +16,48 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.0
19
+ version: '6.1'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '8.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: 5.2.0
29
+ version: '6.1'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '8.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: net-hippie
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '0.2'
39
+ version: '1.0'
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
44
  - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: '0.2'
46
+ version: '1.0'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: parslet
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '1.8'
53
+ version: '2.0'
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '1.8'
60
+ version: '2.0'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: tilt
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -80,20 +86,6 @@ dependencies:
80
86
  - - "~>"
81
87
  - !ruby/object:Gem::Version
82
88
  version: '0.7'
83
- - !ruby/object:Gem::Dependency
84
- name: bundler
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '1.17'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '1.17'
97
89
  - !ruby/object:Gem::Dependency
98
90
  name: bundler-audit
99
91
  requirement: !ruby/object:Gem::Requirement
@@ -108,20 +100,6 @@ dependencies:
108
100
  - - "~>"
109
101
  - !ruby/object:Gem::Version
110
102
  version: '0.6'
111
- - !ruby/object:Gem::Dependency
112
- name: byebug
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
103
  - !ruby/object:Gem::Dependency
126
104
  name: ffaker
127
105
  requirement: !ruby/object:Gem::Requirement
@@ -214,26 +192,28 @@ executables:
214
192
  extensions: []
215
193
  extra_rdoc_files: []
216
194
  files:
195
+ - ".github/dependabot.yml"
196
+ - ".github/workflows/ci.yml"
217
197
  - ".gitignore"
218
- - ".gitlab-ci.yml"
219
198
  - ".rspec"
220
199
  - ".rubocop.yml"
221
- - ".travis.yml"
222
200
  - CHANGELOG.md
223
201
  - Gemfile
224
202
  - Gemfile.lock
225
203
  - LICENSE.txt
226
204
  - README.md
227
205
  - Rakefile
228
- - bin/cibuild
206
+ - bin/audit
229
207
  - bin/console
230
- - bin/lint
231
208
  - bin/setup
209
+ - bin/shipit
210
+ - bin/style
232
211
  - bin/test
233
212
  - exe/scim-kit
234
213
  - lib/scim-kit.rb
235
214
  - lib/scim/kit.rb
236
215
  - lib/scim/kit/dynamic_attributes.rb
216
+ - lib/scim/kit/http.rb
237
217
  - lib/scim/kit/templatable.rb
238
218
  - lib/scim/kit/template.rb
239
219
  - lib/scim/kit/v2.rb
@@ -276,7 +256,7 @@ licenses:
276
256
  - MIT
277
257
  metadata:
278
258
  yard.run: yri
279
- post_install_message:
259
+ post_install_message:
280
260
  rdoc_options: []
281
261
  require_paths:
282
262
  - lib
@@ -291,8 +271,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
291
271
  - !ruby/object:Gem::Version
292
272
  version: '0'
293
273
  requirements: []
294
- rubygems_version: 3.1.2
295
- signing_key:
274
+ rubygems_version: 3.3.13
275
+ signing_key:
296
276
  specification_version: 4
297
277
  summary: A simple toolkit for working with SCIM 2.0
298
278
  test_files: []
data/.gitlab-ci.yml DELETED
@@ -1,11 +0,0 @@
1
- image: ruby:2.6
2
-
3
- before_script:
4
- - apt-get update && apt-get install -y locales
5
- - echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
6
- - locale-gen
7
- - export LC_ALL=en_US.UTF-8
8
-
9
- rspec:
10
- script:
11
- - bin/cibuild
data/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.5.7
7
- - 2.6.5
8
- - 2.7.0
9
- before_install: gem install bundler -v 1.17.1
data/bin/cibuild DELETED
@@ -1,22 +0,0 @@
1
- #!/bin/sh
2
-
3
- # script/cibuild: Setup environment for CI to run tests. This is primarily
4
- # designed to run on the continuous integration server.
5
-
6
- set -e
7
-
8
- cd "$(dirname "$0")/.."
9
-
10
- echo ["$(date "+%H:%M:%S")"] "==> Started at…"
11
-
12
- # GC customizations
13
- export RUBY_GC_MALLOC_LIMIT=79000000
14
- export RUBY_GC_HEAP_INIT_SLOTS=800000
15
- export RUBY_HEAP_FREE_MIN=100000
16
- export RUBY_HEAP_SLOTS_INCREMENT=400000
17
- export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
18
-
19
- ruby -v
20
- gem install bundler --conservative
21
- bin/test
22
- bin/lint
data/bin/lint DELETED
@@ -1,11 +0,0 @@
1
- #!/bin/sh
2
-
3
- set -e
4
-
5
- [ -z "$DEBUG" ] || set -x
6
-
7
- echo [$(date "+%H:%M:%S")] "==> Running setup…"
8
- bin/setup
9
-
10
- echo [$(date "+%H:%M:%S")] "==> Running linters…"
11
- bundle exec rake lint