scim-kit 0.1.0
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 +7 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/.rubocop.yml +26 -0
- data/.travis.yml +7 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +90 -0
- data/Rakefile +13 -0
- data/bin/cibuild +22 -0
- data/bin/console +15 -0
- data/bin/lint +11 -0
- data/bin/setup +6 -0
- data/bin/test +17 -0
- data/exe/scim-kit +4 -0
- data/lib/scim/kit/templatable.rb +24 -0
- data/lib/scim/kit/template.rb +34 -0
- data/lib/scim/kit/v2/attribute_type.rb +91 -0
- data/lib/scim/kit/v2/mutability.rb +25 -0
- data/lib/scim/kit/v2/resource_type.rb +29 -0
- data/lib/scim/kit/v2/returned.rb +25 -0
- data/lib/scim/kit/v2/schema.rb +38 -0
- data/lib/scim/kit/v2/templates/attribute_type.json.jbuilder +19 -0
- data/lib/scim/kit/v2/templates/resource_type.json.jbuilder +14 -0
- data/lib/scim/kit/v2/templates/schema.json.jbuilder +13 -0
- data/lib/scim/kit/v2/uniqueness.rb +23 -0
- data/lib/scim/kit/version.rb +7 -0
- data/lib/scim/kit.rb +21 -0
- data/lib/scim-kit.rb +3 -0
- data/scim-kit.gemspec +41 -0
- metadata +213 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 92ae59a0de47e12347ebde89275f9a5e4b545d3ff38aec73d2a918c637dddb91
|
4
|
+
data.tar.gz: 8b0abab5faf3a77f318ff3848b5b94500b6387d39de551ef412b40bf1c91c93c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1c332a7ca79a8ec07e1a844c41a53f7f9d7dc08c9e08fdc85b21b85bdc8e80a6bcb2c390db9104792fd7253b90555508bf9df007d5b901eb563b6c7c9eee1398
|
7
|
+
data.tar.gz: 3519cd8596b17182f4cbe8e3fa01af6eeea69fc4a12531e46b96877200ba477768b508ad470a272b8782816f7c7dce34ca4141ac3643133bdaa4157ac462bd35
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop/cop/internal_affairs
|
3
|
+
- rubocop-rspec
|
4
|
+
AllCops:
|
5
|
+
Exclude:
|
6
|
+
- 'coverage/**/*'
|
7
|
+
- 'pkg/**/*'
|
8
|
+
- 'tmp/**/*'
|
9
|
+
- 'vendor/**/*'
|
10
|
+
TargetRubyVersion: 2.5
|
11
|
+
|
12
|
+
Metrics/BlockLength:
|
13
|
+
Exclude:
|
14
|
+
- '*.gemspec'
|
15
|
+
- 'spec/**/*.rb'
|
16
|
+
|
17
|
+
Metrics/LineLength:
|
18
|
+
Exclude:
|
19
|
+
- 'spec/**/*.rb'
|
20
|
+
|
21
|
+
Naming/FileName:
|
22
|
+
Exclude:
|
23
|
+
- 'lib/scim-kit.rb'
|
24
|
+
|
25
|
+
RSpec/NamedSubject:
|
26
|
+
Enabled: false
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 mo
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# Scim::Kit
|
2
|
+
|
3
|
+
Scim::Kit is a library with the purpose of simplifying the generation
|
4
|
+
and consumption of SCIM Schema. https://tools.ietf.org/html/rfc7643#section-2
|
5
|
+
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'scim-kit'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install scim-kit
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
def user_schema
|
27
|
+
Scim::Kit::V2::Schema.build(
|
28
|
+
id: Scim::Kit::V2::Schema::USER,
|
29
|
+
name: "User",
|
30
|
+
location: scim_v2_schema_url(id: Scim::Kit::V2::Schema::USER)
|
31
|
+
) do |schema|
|
32
|
+
schema.description = "User Account"
|
33
|
+
schema.add_attribute(name: 'userName') do |x|
|
34
|
+
x.description = "Unique identifier for the User"
|
35
|
+
x.required = true
|
36
|
+
x.uniqueness = :server
|
37
|
+
end
|
38
|
+
schema.add_attribute(name: 'password') do |x|
|
39
|
+
x.description = "The User's cleartext password."
|
40
|
+
x.mutability = :write_only
|
41
|
+
x.required = false
|
42
|
+
x.returned = :never
|
43
|
+
end
|
44
|
+
schema.add_attribute(name: 'emails') do |x|
|
45
|
+
x.multi_valued = true
|
46
|
+
x.description = "Email addresses for the user."
|
47
|
+
x.add_attribute(name: 'value') do |y|
|
48
|
+
y.description = "Email addresses for the user."
|
49
|
+
end
|
50
|
+
x.add_attribute(name: 'primary', type: :boolean) do |y|
|
51
|
+
y.description = "A Boolean value indicating the preferred email"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
schema.add_attribute(name: 'groups') do |x|
|
55
|
+
x.multi_valued = true
|
56
|
+
x.description = "A list of groups to which the user belongs."
|
57
|
+
x.mutability = :read_only
|
58
|
+
x.add_attribute(name: 'value') do |y|
|
59
|
+
y.description = "The identifier of the User's group."
|
60
|
+
y.mutability = :read_only
|
61
|
+
end
|
62
|
+
x.add_attribute(name: '$ref', type: :reference) do |y|
|
63
|
+
y.reference_types = ['User', 'Group']
|
64
|
+
y.description = "The URI of the corresponding 'Group' resource."
|
65
|
+
y.mutability = :read_only
|
66
|
+
end
|
67
|
+
x.add_attribute(name: 'display') do |y|
|
68
|
+
y.description = "A human-readable name."
|
69
|
+
y.mutability = :read_only
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
puts user_schema.to_json
|
76
|
+
```
|
77
|
+
|
78
|
+
## Development
|
79
|
+
|
80
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
81
|
+
|
82
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
83
|
+
|
84
|
+
## Contributing
|
85
|
+
|
86
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/scim-kit.
|
87
|
+
|
88
|
+
## License
|
89
|
+
|
90
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/audit/task'
|
4
|
+
require 'bundler/gem_tasks'
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
require 'rubocop/rake_task'
|
7
|
+
|
8
|
+
RSpec::Core::RakeTask.new(:spec)
|
9
|
+
RuboCop::RakeTask.new(:rubocop)
|
10
|
+
Bundler::Audit::Task.new
|
11
|
+
|
12
|
+
task lint: [:rubocop, 'bundle:audit']
|
13
|
+
task default: :spec
|
data/bin/cibuild
ADDED
@@ -0,0 +1,22 @@
|
|
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/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'saml/kit'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/lint
ADDED
data/bin/setup
ADDED
data/bin/test
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/bin/sh
|
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
|
+
|
6
|
+
|
7
|
+
set -e
|
8
|
+
|
9
|
+
cd "$(dirname "$0")/.."
|
10
|
+
|
11
|
+
[ -z "$DEBUG" ] || set -x
|
12
|
+
|
13
|
+
echo [$(date "+%H:%M:%S")] "==> Running setup…"
|
14
|
+
bin/setup
|
15
|
+
|
16
|
+
echo [$(date "+%H:%M:%S")] "==> Running tests…"
|
17
|
+
bundle exec rake spec
|
data/exe/scim-kit
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Scim
|
4
|
+
module Kit
|
5
|
+
# Implement methods necessary to generate json from jbuilder templates.
|
6
|
+
module Templatable
|
7
|
+
def to_json(options = {})
|
8
|
+
render(self, options)
|
9
|
+
end
|
10
|
+
|
11
|
+
def as_json(options = nil)
|
12
|
+
to_h
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_h
|
16
|
+
JSON.parse(to_json, symbolize_names: true)
|
17
|
+
end
|
18
|
+
|
19
|
+
def render(model, options)
|
20
|
+
Template.new(model).to_json(options)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Scim
|
4
|
+
module Kit
|
5
|
+
# Represents a Jbuilder template
|
6
|
+
class Template
|
7
|
+
TEMPLATES_DIR = Pathname.new(File.join(__dir__, 'v2/templates/'))
|
8
|
+
|
9
|
+
attr_reader :target
|
10
|
+
|
11
|
+
def initialize(target)
|
12
|
+
@target = target
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_json(options = {})
|
16
|
+
template.render(target, options)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def template_path
|
22
|
+
TEMPLATES_DIR.join(template_name)
|
23
|
+
end
|
24
|
+
|
25
|
+
def template_name
|
26
|
+
"#{target.class.name.split('::').last.underscore}.json.jbuilder"
|
27
|
+
end
|
28
|
+
|
29
|
+
def template
|
30
|
+
@template ||= Tilt.new(template_path.to_s)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Scim
|
4
|
+
module Kit
|
5
|
+
module V2
|
6
|
+
# Represents a scim Attribute type
|
7
|
+
class AttributeType
|
8
|
+
include Templatable
|
9
|
+
DATATYPES = {
|
10
|
+
string: 'string',
|
11
|
+
boolean: 'boolean',
|
12
|
+
decimal: 'decimal',
|
13
|
+
integer: 'integer',
|
14
|
+
datetime: 'dateTime',
|
15
|
+
binary: 'binary',
|
16
|
+
reference: 'reference',
|
17
|
+
complex: 'complex'
|
18
|
+
}.freeze
|
19
|
+
attr_accessor :canonical_values
|
20
|
+
attr_accessor :case_exact
|
21
|
+
attr_accessor :description
|
22
|
+
attr_accessor :multi_valued
|
23
|
+
attr_accessor :required
|
24
|
+
attr_reader :mutability
|
25
|
+
attr_reader :name, :type
|
26
|
+
attr_reader :reference_types
|
27
|
+
attr_reader :returned
|
28
|
+
attr_reader :uniqueness
|
29
|
+
|
30
|
+
def initialize(name:, type: :string)
|
31
|
+
@name = name
|
32
|
+
@type = type
|
33
|
+
@description = ''
|
34
|
+
@multi_valued = false
|
35
|
+
@required = false
|
36
|
+
@case_exact = false
|
37
|
+
@mutability = Mutability::READ_WRITE
|
38
|
+
@returned = Returned::DEFAULT
|
39
|
+
@uniqueness = Uniqueness::NONE
|
40
|
+
raise ArgumentError, :type unless DATATYPES[type.to_sym]
|
41
|
+
end
|
42
|
+
|
43
|
+
def mutability=(value)
|
44
|
+
@mutability = Mutability.find(value)
|
45
|
+
end
|
46
|
+
|
47
|
+
def returned=(value)
|
48
|
+
@returned = Returned.find(value)
|
49
|
+
end
|
50
|
+
|
51
|
+
def uniqueness=(value)
|
52
|
+
@uniqueness = Uniqueness.find(value)
|
53
|
+
end
|
54
|
+
|
55
|
+
def add_attribute(name:, type: :string)
|
56
|
+
@type = :complex
|
57
|
+
attribute = AttributeType.new(name: name, type: type)
|
58
|
+
yield attribute if block_given?
|
59
|
+
attributes << attribute
|
60
|
+
end
|
61
|
+
|
62
|
+
def reference_types=(value)
|
63
|
+
@type = :reference
|
64
|
+
@reference_types = value
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def attributes
|
70
|
+
@attributes ||= []
|
71
|
+
end
|
72
|
+
|
73
|
+
def complex?
|
74
|
+
type_is?(:complex)
|
75
|
+
end
|
76
|
+
|
77
|
+
def string?
|
78
|
+
type_is?(:string)
|
79
|
+
end
|
80
|
+
|
81
|
+
def reference?
|
82
|
+
type_is?(:reference)
|
83
|
+
end
|
84
|
+
|
85
|
+
def type_is?(expected_type)
|
86
|
+
type.to_sym == expected_type
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Scim
|
4
|
+
module Kit
|
5
|
+
module V2
|
6
|
+
# Represents the valid Mutability values
|
7
|
+
class Mutability
|
8
|
+
READ_ONLY = 'readOnly'
|
9
|
+
READ_WRITE = 'readWrite'
|
10
|
+
IMMUTABLE = 'immutable'
|
11
|
+
WRITE_ONLY = 'writeOnly'
|
12
|
+
VALID = {
|
13
|
+
read_only: READ_ONLY,
|
14
|
+
read_write: READ_WRITE,
|
15
|
+
immutable: IMMUTABLE,
|
16
|
+
write_only: WRITE_ONLY
|
17
|
+
}.freeze
|
18
|
+
|
19
|
+
def self.find(value)
|
20
|
+
VALID[value.to_sym] || (raise ArgumentError, :mutability)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Scim
|
4
|
+
module Kit
|
5
|
+
module V2
|
6
|
+
# Represents a ResourceType Schema
|
7
|
+
# https://tools.ietf.org/html/rfc7643#section-6
|
8
|
+
class ResourceType
|
9
|
+
include Templatable
|
10
|
+
attr_accessor :id
|
11
|
+
attr_accessor :name
|
12
|
+
attr_accessor :description
|
13
|
+
attr_accessor :endpoint
|
14
|
+
attr_accessor :schema
|
15
|
+
attr_reader :location
|
16
|
+
|
17
|
+
def initialize(location:)
|
18
|
+
@location = location
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.build(*args)
|
22
|
+
item = new(*args)
|
23
|
+
yield item
|
24
|
+
item
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Scim
|
4
|
+
module Kit
|
5
|
+
module V2
|
6
|
+
# Represents the valid Returned values
|
7
|
+
class Returned
|
8
|
+
ALWAYS = 'always'
|
9
|
+
NEVER = 'never'
|
10
|
+
DEFAULT = 'default'
|
11
|
+
REQUEST = 'request'
|
12
|
+
VALID = {
|
13
|
+
always: ALWAYS,
|
14
|
+
never: NEVER,
|
15
|
+
default: DEFAULT,
|
16
|
+
request: REQUEST
|
17
|
+
}.freeze
|
18
|
+
|
19
|
+
def self.find(value)
|
20
|
+
VALID[value.to_sym] || (raise ArgumentError, :returned)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Scim
|
4
|
+
module Kit
|
5
|
+
module V2
|
6
|
+
# Represents a SCIM Schema
|
7
|
+
class Schema
|
8
|
+
include Templatable
|
9
|
+
ERROR = 'urn:ietf:params:scim:api:messages:2.0:Error'
|
10
|
+
GROUP = 'urn:ietf:params:scim:schemas:core:2.0:Group'
|
11
|
+
RESOURCE_TYPE = 'urn:ietf:params:scim:schemas:core:2.0:ResourceType'
|
12
|
+
USER = 'urn:ietf:params:scim:schemas:core:2.0:User'
|
13
|
+
|
14
|
+
attr_reader :id, :name, :location, :attributes
|
15
|
+
attr_accessor :description
|
16
|
+
|
17
|
+
def initialize(id:, name:, location:)
|
18
|
+
@id = id
|
19
|
+
@name = name
|
20
|
+
@location = location
|
21
|
+
@attributes = []
|
22
|
+
end
|
23
|
+
|
24
|
+
def add_attribute(name:, type: :string)
|
25
|
+
attribute = AttributeType.new(name: name, type: type)
|
26
|
+
yield attribute if block_given?
|
27
|
+
@attributes << attribute
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.build(*args)
|
31
|
+
item = new(*args)
|
32
|
+
yield item
|
33
|
+
item
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
json.key_format! camelize: :lower
|
4
|
+
json.description description
|
5
|
+
json.multi_valued multi_valued
|
6
|
+
json.mutability mutability
|
7
|
+
json.name name
|
8
|
+
json.required required
|
9
|
+
json.returned returned
|
10
|
+
json.type type
|
11
|
+
json.uniqueness uniqueness
|
12
|
+
json.case_exact(case_exact) if string? || reference?
|
13
|
+
json.reference_types(reference_types) if reference?
|
14
|
+
json.canonical_values(canonical_values) if canonical_values
|
15
|
+
if complex?
|
16
|
+
json.sub_attributes attributes do |attribute|
|
17
|
+
render attribute, json: json
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
json.key_format! camelize: :lower
|
4
|
+
json.meta do
|
5
|
+
json.resource_type 'ResourceType'
|
6
|
+
json.location location
|
7
|
+
end
|
8
|
+
json.schemas [Scim::Kit::V2::Schema::RESOURCE_TYPE]
|
9
|
+
json.id id
|
10
|
+
json.name name
|
11
|
+
json.description description
|
12
|
+
json.endpoint endpoint
|
13
|
+
json.schema schema
|
14
|
+
json.schema_extensions []
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
json.key_format! camelize: :lower
|
4
|
+
json.id id
|
5
|
+
json.name name
|
6
|
+
json.description description
|
7
|
+
json.meta do
|
8
|
+
json.resource_type 'Schema'
|
9
|
+
json.location location
|
10
|
+
end
|
11
|
+
json.attributes attributes do |attribute|
|
12
|
+
render attribute, json: json
|
13
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Scim
|
4
|
+
module Kit
|
5
|
+
module V2
|
6
|
+
# Represents the valid Uniqueness values
|
7
|
+
class Uniqueness
|
8
|
+
NONE = 'none'
|
9
|
+
SERVER = 'server'
|
10
|
+
GLOBAL = 'global'
|
11
|
+
VALID = {
|
12
|
+
none: NONE,
|
13
|
+
server: SERVER,
|
14
|
+
global: GLOBAL
|
15
|
+
}.freeze
|
16
|
+
|
17
|
+
def self.find(value)
|
18
|
+
VALID[value.to_sym] || (raise ArgumentError, :uniqueness)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/scim/kit.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'tilt'
|
4
|
+
require 'tilt/jbuilder'
|
5
|
+
|
6
|
+
require 'scim/kit/templatable'
|
7
|
+
require 'scim/kit/template'
|
8
|
+
require 'scim/kit/version'
|
9
|
+
|
10
|
+
require 'scim/kit/v2/attribute_type'
|
11
|
+
require 'scim/kit/v2/mutability'
|
12
|
+
require 'scim/kit/v2/resource_type'
|
13
|
+
require 'scim/kit/v2/returned'
|
14
|
+
require 'scim/kit/v2/schema'
|
15
|
+
require 'scim/kit/v2/uniqueness'
|
16
|
+
|
17
|
+
module Scim
|
18
|
+
module Kit
|
19
|
+
class Error < StandardError; end
|
20
|
+
end
|
21
|
+
end
|
data/lib/scim-kit.rb
ADDED
data/scim-kit.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'scim/kit/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'scim-kit'
|
9
|
+
spec.version = Scim::Kit::VERSION
|
10
|
+
spec.authors = ['mo']
|
11
|
+
spec.email = ['mo@mokhan.ca']
|
12
|
+
|
13
|
+
spec.summary = 'A SCIM library.'
|
14
|
+
spec.description = 'A SCIM library.'
|
15
|
+
spec.homepage = 'https://www.mokhan.ca/'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
# Specify which files should be added to the gem when it is released.
|
19
|
+
# The `git ls-files -z` loads the files that have been added into git.
|
20
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
21
|
+
`git ls-files -z`.split("\x0").reject do |file|
|
22
|
+
file.match(%r{^(test|spec|features)/})
|
23
|
+
end
|
24
|
+
end
|
25
|
+
spec.bindir = 'exe'
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) do |file|
|
27
|
+
File.basename(file)
|
28
|
+
end
|
29
|
+
spec.require_paths = ['lib']
|
30
|
+
|
31
|
+
spec.add_dependency 'tilt', '~> 2.0'
|
32
|
+
spec.add_dependency 'tilt-jbuilder', '~> 0.7'
|
33
|
+
spec.add_development_dependency 'bundler', '~> 1.17'
|
34
|
+
spec.add_development_dependency 'bundler-audit', '~> 0.6'
|
35
|
+
spec.add_development_dependency 'byebug'
|
36
|
+
spec.add_development_dependency 'ffaker', '~> 2.7'
|
37
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
38
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
39
|
+
spec.add_development_dependency 'rubocop', '~> 0.52'
|
40
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.22'
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,213 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: scim-kit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- mo
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-12-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: tilt
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: tilt-jbuilder
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.7'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.17'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.17'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler-audit
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.6'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.6'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: byebug
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: ffaker
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.7'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.7'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '10.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '10.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.52'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.52'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop-rspec
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '1.22'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1.22'
|
153
|
+
description: A SCIM library.
|
154
|
+
email:
|
155
|
+
- mo@mokhan.ca
|
156
|
+
executables:
|
157
|
+
- scim-kit
|
158
|
+
extensions: []
|
159
|
+
extra_rdoc_files: []
|
160
|
+
files:
|
161
|
+
- ".gitignore"
|
162
|
+
- ".rspec"
|
163
|
+
- ".rubocop.yml"
|
164
|
+
- ".travis.yml"
|
165
|
+
- Gemfile
|
166
|
+
- LICENSE.txt
|
167
|
+
- README.md
|
168
|
+
- Rakefile
|
169
|
+
- bin/cibuild
|
170
|
+
- bin/console
|
171
|
+
- bin/lint
|
172
|
+
- bin/setup
|
173
|
+
- bin/test
|
174
|
+
- exe/scim-kit
|
175
|
+
- lib/scim-kit.rb
|
176
|
+
- lib/scim/kit.rb
|
177
|
+
- lib/scim/kit/templatable.rb
|
178
|
+
- lib/scim/kit/template.rb
|
179
|
+
- lib/scim/kit/v2/attribute_type.rb
|
180
|
+
- lib/scim/kit/v2/mutability.rb
|
181
|
+
- lib/scim/kit/v2/resource_type.rb
|
182
|
+
- lib/scim/kit/v2/returned.rb
|
183
|
+
- lib/scim/kit/v2/schema.rb
|
184
|
+
- lib/scim/kit/v2/templates/attribute_type.json.jbuilder
|
185
|
+
- lib/scim/kit/v2/templates/resource_type.json.jbuilder
|
186
|
+
- lib/scim/kit/v2/templates/schema.json.jbuilder
|
187
|
+
- lib/scim/kit/v2/uniqueness.rb
|
188
|
+
- lib/scim/kit/version.rb
|
189
|
+
- scim-kit.gemspec
|
190
|
+
homepage: https://www.mokhan.ca/
|
191
|
+
licenses:
|
192
|
+
- MIT
|
193
|
+
metadata: {}
|
194
|
+
post_install_message:
|
195
|
+
rdoc_options: []
|
196
|
+
require_paths:
|
197
|
+
- lib
|
198
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
199
|
+
requirements:
|
200
|
+
- - ">="
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
version: '0'
|
203
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - ">="
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: '0'
|
208
|
+
requirements: []
|
209
|
+
rubygems_version: 3.0.1
|
210
|
+
signing_key:
|
211
|
+
specification_version: 4
|
212
|
+
summary: A SCIM library.
|
213
|
+
test_files: []
|