Comparing changes
v0.5.1
→
v0.5.2
65 commits
20 files changed
Commits
a662f4d
Merge pull request #35 from xlgmokha/dependabot/bundler/activemodel-6.1.4.3
2021-12-15 20:11:00
d59f065
Merge pull request #34 from xlgmokha/dependabot/bundler/activemodel-6.1.4.2
2021-12-15 17:16:23
10b85b2
Merge pull request #32 from xlgmokha/dependabot/bundler/bundler-audit-0.9.0.1
2021-08-31 20:13:01
b3fb389
Merge pull request #31 from xlgmokha/dependabot/bundler/activemodel-6.1.4.1
2021-08-19 21:08:24
dea6140
Merge pull request #28 from xlgmokha/dependabot/bundler/addressable-2.8.0
2021-07-13 15:16:25
e3f5a42
Merge pull request #24 from xlgmokha/dependabot/bundler/activemodel-6.1.4
2021-06-25 22:11:57
9419529
Merge pull request #22 from xlgmokha/dependabot/bundler/activemodel-6.1.3.2
2021-05-06 17:48:31
3040dbd
Merge pull request #18 from xlgmokha/dependabot/bundler/activemodel-6.1.3.1
2021-03-29 19:51:28
040b063
Merge pull request #17 from xlgmokha/dependabot/bundler/bundler-audit-0.8.0
2021-03-11 07:04:13
1a340ef
Merge pull request #11 from xlgmokha/dependabot/bundler/activemodel-6.1.3
2021-02-18 14:33:16
fbd81d2
Merge pull request #10 from xlgmokha/dependabot/bundler/activemodel-6.1.2.1
2021-02-11 17:19:45
ba65d72
Merge pull request #9 from xlgmokha/dependabot/bundler/activemodel-6.1.2
2021-02-10 21:38:52
Changed files (20)
.github
workflows
lib
scim
spec
scim
kit
.github/workflows/ci.yml
@@ -1,36 +1,41 @@
name: ci
-on: [push]
+on:
+ push:
+ branches: [main]
+ pull_request:
+ branches: [main]
jobs:
- build:
+ test:
runs-on: ubuntu-latest
strategy:
matrix:
- ruby: [ '2.5', '2.6', '2.7' ]
- name: RSpec Ruby ${{ matrix.ruby }}
+ ruby-version: ['2.5', '2.6', '2.7', '3.0']
steps:
- uses: actions/checkout@v2
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
with:
- lfs: true
- submodules: recursive
- - uses: actions/setup-ruby@v1
- with:
- ruby-version: ${{ matrix.ruby }}
- - name: setup
- run: ./bin/setup
- - name: test
- run: ./bin/test
- lint:
+ ruby-version: ${{ matrix.ruby-version }}
+ - run: sh bin/setup
+ - name: Running tests…
+ run: sh bin/test
+ style:
runs-on: ubuntu-latest
- name: Lint
steps:
- uses: actions/checkout@v2
+ - uses: ruby/setup-ruby@v1
with:
- lfs: true
- submodules: recursive
- - uses: actions/setup-ruby@v1
+ ruby-version: '3.0'
+ bundler-cache: true
+ - name: Running style checks…
+ run: sh bin/style
+ audit:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: ruby/setup-ruby@v1
with:
- ruby-version: 2.7
- - name: setup
- run: ./bin/setup
- - name: lint
- run: ./bin/lint
+ ruby-version: '3.0'
+ bundler-cache: true
+ - name: Running audit…
+ run: sh bin/audit
.github/dependabot.yml
@@ -0,0 +1,9 @@
+---
+version: 2
+updates:
+ - package-ecosystem: "bundler"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ assignees:
+ - "xlgmokha"
bin/lint → bin/audit
@@ -4,6 +4,4 @@ set -e
cd "$(dirname "$0")/.."
-export RUBYOPT='-W0'
-
-bundle exec rake lint
+bundle exec rake bundle:audit
bin/cibuild
@@ -1,21 +0,0 @@
-#!/bin/sh
-
-set -e
-
-[ -z "$DEBUG" ] || set -x
-
-cd "$(dirname "$0")/.."
-export RUBY_GC_MALLOC_LIMIT=79000000
-export RUBY_GC_HEAP_INIT_SLOTS=800000
-export RUBY_HEAP_FREE_MIN=100000
-export RUBY_HEAP_SLOTS_INCREMENT=400000
-export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
-
-echo ["$(date "+%H:%M:%S")"] "==> Running setup…"
-bin/setup
-
-echo ["$(date "+%H:%M:%S")"] "==> Running tests…"
-bin/test
-
-echo ["$(date "+%H:%M:%S")"] "==> Running linters…"
-bin/lint
bin/setup
@@ -1,7 +1,9 @@
-#!/usr/bin/env bash
-set -euo pipefail
-IFS=$'\n\t'
+#!/bin/sh
-ruby -v
-gem install bundler --conservative -v '~> 2.0'
-bundle check || bundle install --jobs "$(sysctl -n hw.ncpu || nproc)"
+set -e
+
+cd "$(dirname "$0")/.."
+
+gem update --system
+gem install bundler
+bundle install
bin/shipit
@@ -4,5 +4,4 @@ set -e
cd "$(dirname "$0")/.."
-bin/cibuild
bundle exec rake release
bin/style
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+set -e
+
+cd "$(dirname "$0")/.."
+
+bundle exec rubocop "$@"
lib/scim/kit/v2/resource_type.rb
@@ -26,8 +26,8 @@ module Scim
end
class << self
- def build(*args)
- item = new(*args)
+ def build(**args)
+ item = new(**args)
yield item
item
end
lib/scim/kit/v2/schema.rb
@@ -31,8 +31,8 @@ module Scim
end
class << self
- def build(*args)
- item = new(*args)
+ def build(**args)
+ item = new(**args)
yield item
item
end
@@ -45,7 +45,7 @@ module Scim
) do |x|
x.meta = Meta.from(hash[:meta])
hash[:attributes].each do |y|
- x.attributes << AttributeType.from(y)
+ x.attributes << parse_attribute_type(y)
end
end
end
@@ -53,6 +53,16 @@ module Scim
def parse(json)
from(JSON.parse(json, symbolize_names: true))
end
+
+ private
+
+ def parse_attribute_type(hash)
+ attribute_type = AttributeType.from(hash)
+ hash[:subAttributes]&.each do |sub_attr_hash|
+ attribute_type.attributes << parse_attribute_type(sub_attr_hash)
+ end
+ attribute_type
+ end
end
end
end
lib/scim/kit/http.rb
@@ -21,12 +21,13 @@ module Scim
end
def self.default_driver
- @default_driver ||= Net::Hippie::Client.new(headers: headers).tap do |http|
- http.logger = Scim::Kit.logger
- http.open_timeout = 1
- http.read_timeout = 5
- http.follow_redirects = 3
- end
+ @default_driver ||= Net::Hippie::Client.new(
+ follow_redirects: 3,
+ headers: headers,
+ logger: Scim::Kit.logger,
+ open_timeout: 1,
+ read_timeout: 5
+ )
end
def self.headers
lib/scim/kit/version.rb
@@ -2,6 +2,6 @@
module Scim
module Kit
- VERSION = '0.5.1'
+ VERSION = '0.5.2'
end
end
spec/scim/kit/v2/schema_spec.rb
@@ -126,28 +126,54 @@ RSpec.describe Scim::Kit::V2::Schema do
describe '.parse' do
let(:result) { described_class.parse(subject.to_json) }
- before do
- subject.add_attribute(name: :display_name) do |x|
- x.multi_valued = true
- x.required = true
- x.case_exact = true
- x.mutability = :read_only
- x.returned = :never
- x.uniqueness = :server
- x.canonical_values = ['honerva']
- x.reference_types = %w[User Group]
+ context 'with reference attribute type' do
+ before do
+ subject.add_attribute(name: :display_name) do |x|
+ x.multi_valued = true
+ x.required = true
+ x.case_exact = true
+ x.mutability = :read_only
+ x.returned = :never
+ x.uniqueness = :server
+ x.canonical_values = ['honerva']
+ x.reference_types = %w[User Group]
+ end
end
+
+ specify { expect(result.id).to eql(subject.id) }
+ specify { expect(result.name).to eql(subject.name) }
+ specify { expect(result.description).to eql(subject.description) }
+ specify { expect(result.meta.created).to eql(subject.meta.created) }
+ specify { expect(result.meta.last_modified).to eql(subject.meta.last_modified) }
+ specify { expect(result.meta.version).to eql(subject.meta.version) }
+ specify { expect(result.meta.location).to eql(subject.meta.location) }
+ specify { expect(result.meta.resource_type).to eql(subject.meta.resource_type) }
+ specify { expect(result.attributes.size).to be(1) }
+ specify { expect(result.attributes.first.to_h).to eql(subject.attributes.first.to_h) }
+ specify { expect(result.to_json).to eql(subject.to_json) }
+ specify { expect(result.to_h).to eql(subject.to_h) }
end
- specify { expect(result.id).to eql(subject.id) }
- specify { expect(result.name).to eql(subject.name) }
- specify { expect(result.description).to eql(subject.description) }
- specify { expect(result.meta.created).to eql(subject.meta.created) }
- specify { expect(result.meta.last_modified).to eql(subject.meta.last_modified) }
- specify { expect(result.meta.version).to eql(subject.meta.version) }
- specify { expect(result.meta.location).to eql(subject.meta.location) }
- specify { expect(result.meta.resource_type).to eql(subject.meta.resource_type) }
- specify { expect(result.to_json).to eql(subject.to_json) }
- specify { expect(result.to_h).to eql(subject.to_h) }
+ context 'with complex attribute type' do
+ before do
+ subject.add_attribute(name: :name) do |x|
+ x.add_attribute(name: :family_name)
+ x.add_attribute(name: :given_name)
+ end
+ end
+
+ specify { expect(result.id).to eql(subject.id) }
+ specify { expect(result.name).to eql(subject.name) }
+ specify { expect(result.description).to eql(subject.description) }
+ specify { expect(result.meta.created).to eql(subject.meta.created) }
+ specify { expect(result.meta.last_modified).to eql(subject.meta.last_modified) }
+ specify { expect(result.meta.version).to eql(subject.meta.version) }
+ specify { expect(result.meta.location).to eql(subject.meta.location) }
+ specify { expect(result.meta.resource_type).to eql(subject.meta.resource_type) }
+ specify { expect(result.attributes.size).to be(1) }
+ specify { expect(result.attributes.first.to_h).to eql(subject.attributes.first.to_h) }
+ specify { expect(result.to_json).to eql(subject.to_json) }
+ specify { expect(result.to_h).to eql(subject.to_h) }
+ end
end
end
spec/spec_helper.rb
@@ -4,7 +4,6 @@ require 'bundler/setup'
require 'scim/kit'
require 'ffaker'
require 'json'
-require 'byebug'
require 'parslet/convenience'
require 'parslet/rig/rspec'
require 'webmock/rspec'
.gitlab-ci.yml
@@ -1,11 +0,0 @@
-image: ruby:2.6
-
-before_script:
- - apt-get update && apt-get install -y locales
- - echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
- - locale-gen
- - export LC_ALL=en_US.UTF-8
-
-rspec:
- script:
- - bin/cibuild
.rubocop.yml
@@ -43,6 +43,10 @@ Lint/RaiseException:
Lint/StructNewOverride:
Enabled: true
+Metrics/AbcSize:
+ Exclude:
+ - 'lib/scim/kit/v2/service_provider_configuration.rb'
+
Metrics/BlockLength:
Exclude:
- '*.gemspec'
@@ -72,6 +76,10 @@ Style/HashTransformKeys:
Style/HashTransformValues:
Enabled: true
+Style/IfUnlessModifier:
+ Exclude:
+ - 'lib/scim/kit/v2/attribute.rb'
+
Style/StringLiterals:
EnforcedStyle: 'single_quotes'
@@ -84,6 +92,9 @@ Style/TrailingCommaInHashLiteral:
RSpec/FilePath:
Enabled: false
+RSpec/MultipleMemoizedHelpers:
+ Enabled: false
+
RSpec/NamedSubject:
Enabled: false
CHANGELOG.md
@@ -1,4 +1,4 @@
-Version 0.5.1
+Version 0.5.2
# Changelog
All notable changes to this project will be documented in this file.
@@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+## [0.5.2] - 2020-05-20
+### Fixed
+
+- fix: Parse sub attributes from schema https://github.com/xlgmokha/scim-kit/pull/38
+
## [0.5.1] - 2020-05-20
### Fixed
- Specify `Accept: application/scim+json` header when discovering a SCIM API.
@@ -53,7 +58,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- \_assign does not coerce values by default.
- errors are merged together instead of overwritten during attribute validation.
-[Unreleased]: https://github.com/mokhan/scim-kit/compare/v0.5.1...HEAD
+[Unreleased]: https://github.com/mokhan/scim-kit/compare/v0.5.2...HEAD
+[0.5.2]: https://github.com/mokhan/scim-kit/compare/v0.5.1...v0.5.2
[0.5.1]: https://github.com/mokhan/scim-kit/compare/v0.5.0...v0.5.1
[0.5.0]: https://github.com/mokhan/scim-kit/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/mokhan/scim-kit/compare/v0.3.2...v0.4.0
Gemfile.lock
@@ -1,97 +1,124 @@
PATH
remote: .
specs:
- scim-kit (0.5.1)
- activemodel (>= 5.2.0)
- net-hippie (~> 0.3)
- parslet (~> 1.8)
+ scim-kit (0.5.2)
+ activemodel (~> 6.1)
+ net-hippie (~> 1.0)
+ parslet (~> 2.0)
tilt (~> 2.0)
tilt-jbuilder (~> 0.7)
GEM
remote: https://rubygems.org/
specs:
- activemodel (6.0.3.1)
- activesupport (= 6.0.3.1)
- activesupport (6.0.3.1)
+ actionview (6.1.4.4)
+ activesupport (= 6.1.4.4)
+ builder (~> 3.1)
+ erubi (~> 1.4)
+ rails-dom-testing (~> 2.0)
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
+ activemodel (6.1.4.4)
+ activesupport (= 6.1.4.4)
+ activesupport (6.1.4.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
- i18n (>= 0.7, < 2)
- minitest (~> 5.1)
- tzinfo (~> 1.1)
- zeitwerk (~> 2.2, >= 2.2.2)
- addressable (2.7.0)
+ i18n (>= 1.6, < 2)
+ minitest (>= 5.1)
+ tzinfo (~> 2.0)
+ zeitwerk (~> 2.3)
+ addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
- ast (2.4.0)
- bundler-audit (0.6.1)
+ ast (2.4.2)
+ builder (3.2.4)
+ bundler-audit (0.9.0.1)
bundler (>= 1.2.0, < 3)
- thor (~> 0.18)
- byebug (11.1.3)
- concurrent-ruby (1.1.6)
- crack (0.4.3)
- safe_yaml (~> 1.0.0)
- diff-lcs (1.3)
- ffaker (2.14.0)
+ thor (~> 1.0)
+ concurrent-ruby (1.1.9)
+ crack (0.4.5)
+ rexml
+ crass (1.0.6)
+ diff-lcs (1.5.0)
+ erubi (1.10.0)
+ ffaker (2.20.0)
hashdiff (1.0.1)
- i18n (1.8.2)
+ i18n (1.8.11)
concurrent-ruby (~> 1.0)
- jbuilder (2.10.0)
+ jbuilder (2.11.5)
+ actionview (>= 5.0.0)
activesupport (>= 5.0.0)
- minitest (5.14.1)
- net-hippie (0.3.2)
- parallel (1.19.1)
- parser (2.7.1.2)
- ast (~> 2.4.0)
- parslet (1.8.2)
- public_suffix (4.0.5)
- rainbow (3.0.0)
- rake (13.0.1)
- rexml (3.2.4)
- rspec (3.9.0)
- rspec-core (~> 3.9.0)
- rspec-expectations (~> 3.9.0)
- rspec-mocks (~> 3.9.0)
- rspec-core (3.9.2)
- rspec-support (~> 3.9.3)
- rspec-expectations (3.9.2)
+ loofah (2.13.0)
+ crass (~> 1.0.2)
+ nokogiri (>= 1.5.9)
+ mini_portile2 (2.6.1)
+ minitest (5.15.0)
+ net-hippie (1.1.1)
+ nokogiri (1.12.5)
+ mini_portile2 (~> 2.6.1)
+ racc (~> 1.4)
+ nokogiri (1.12.5-x86_64-linux)
+ racc (~> 1.4)
+ parallel (1.21.0)
+ parser (3.1.0.0)
+ ast (~> 2.4.1)
+ parslet (2.0.0)
+ public_suffix (4.0.6)
+ racc (1.6.0)
+ rails-dom-testing (2.0.3)
+ activesupport (>= 4.2.0)
+ nokogiri (>= 1.6)
+ rails-html-sanitizer (1.4.2)
+ loofah (~> 2.3)
+ rainbow (3.1.1)
+ rake (13.0.6)
+ regexp_parser (2.2.0)
+ rexml (3.2.5)
+ rspec (3.10.0)
+ rspec-core (~> 3.10.0)
+ rspec-expectations (~> 3.10.0)
+ rspec-mocks (~> 3.10.0)
+ rspec-core (3.10.1)
+ rspec-support (~> 3.10.0)
+ rspec-expectations (3.10.2)
diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.9.0)
- rspec-mocks (3.9.1)
+ rspec-support (~> 3.10.0)
+ rspec-mocks (3.10.2)
diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.9.0)
- rspec-support (3.9.3)
- rubocop (0.83.0)
+ rspec-support (~> 3.10.0)
+ rspec-support (3.10.3)
+ rubocop (0.93.1)
parallel (~> 1.10)
- parser (>= 2.7.0.1)
+ parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
+ regexp_parser (>= 1.8)
rexml
+ rubocop-ast (>= 0.6.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
- rubocop-rspec (1.39.0)
- rubocop (>= 0.68.1)
- ruby-progressbar (1.10.1)
- safe_yaml (1.0.5)
- thor (0.20.3)
- thread_safe (0.3.6)
+ rubocop-ast (1.15.1)
+ parser (>= 3.0.1.1)
+ rubocop-rspec (1.44.1)
+ rubocop (~> 0.87)
+ rubocop-ast (>= 0.7.1)
+ ruby-progressbar (1.11.0)
+ thor (1.2.1)
tilt (2.0.10)
tilt-jbuilder (0.7.1)
jbuilder
tilt (>= 1.3.0, < 3)
- tzinfo (1.2.7)
- thread_safe (~> 0.1)
- unicode-display_width (1.7.0)
- webmock (3.8.3)
- addressable (>= 2.3.6)
+ tzinfo (2.0.4)
+ concurrent-ruby (~> 1.0)
+ unicode-display_width (1.8.0)
+ webmock (3.14.0)
+ addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
- zeitwerk (2.3.0)
+ zeitwerk (2.5.3)
PLATFORMS
ruby
+ x86_64-linux
DEPENDENCIES
- bundler (~> 2.0)
bundler-audit (~> 0.6)
- byebug
ffaker (~> 2.7)
rake (~> 13.0)
rspec (~> 3.0)
@@ -101,4 +128,4 @@ DEPENDENCIES
webmock (~> 3.5)
BUNDLED WITH
- 2.1.4
+ 2.3.6
Rakefile
@@ -9,5 +9,4 @@ RSpec::Core::RakeTask.new(:spec)
RuboCop::RakeTask.new(:rubocop)
Bundler::Audit::Task.new
-task lint: [:rubocop, 'bundle:audit']
task default: :spec
README.md
@@ -1,7 +1,6 @@
# Scim::Kit
-[](https://github.com/mokhan/scim-kit/actions)
-[](https://codeclimate.com/github/mokhan/scim-kit)
+[](https://github.com/xlgmokha/scim-kit/actions)
[](https://rubygems.org/gems/scim-kit)
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
## Contributing
-Bug reports and pull requests are welcome on GitHub at https://github.com/mokhan/scim-kit.
+Bug reports and pull requests are welcome on GitHub at https://github.com/xlgmokha/scim-kit.
## License
scim-kit.gemspec
@@ -30,14 +30,12 @@ Gem::Specification.new do |spec|
spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
spec.metadata['yard.run'] = 'yri'
- spec.add_dependency 'activemodel', '>= 5.2.0'
- spec.add_dependency 'net-hippie', '~> 0.3'
- spec.add_dependency 'parslet', '~> 1.8'
+ spec.add_dependency 'activemodel', '~> 6.1'
+ spec.add_dependency 'net-hippie', '~> 1.0'
+ spec.add_dependency 'parslet', '~> 2.0'
spec.add_dependency 'tilt', '~> 2.0'
spec.add_dependency 'tilt-jbuilder', '~> 0.7'
- spec.add_development_dependency 'bundler', '~> 2.0'
spec.add_development_dependency 'bundler-audit', '~> 0.6'
- spec.add_development_dependency 'byebug'
spec.add_development_dependency 'ffaker', '~> 2.7'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rspec', '~> 3.0'