scim-kit 0.2.4 → 0.2.5

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: 447d2e7c6cbe153832ea1cf72515e52f5dc32a2a13766d94a84b1d98ef0e165d
4
- data.tar.gz: 32572a17304ddf61f8dce47b37352a9b065c9d77d8c7a7d886d622d77e5444d4
3
+ metadata.gz: eb9c8492dd28c50cc3c4b652e1d88fc695d4bb506a10d1a1b9a662143e940b4a
4
+ data.tar.gz: 8fcec2bcbc56bdeed67008e1b1f0e47f70fb1f116bec4aa77819df540180f850
5
5
  SHA512:
6
- metadata.gz: bc9f30de0b59f80d59938c8a4854e663d9e2d62498c065c436f4263579ca853e8e50f6a85e6969974325afee144c1faabcefa57dc448ff00e72caf12f9bbed59
7
- data.tar.gz: 68c022cd064d112f39a5224bb1b1c8bc428282aa4b2340cb31e5ad7a496d0d5a723e59b5b716b88933471cef65bdf9b264b91523e9eaf9f66b5068f58ad767ad
6
+ metadata.gz: bd05043f0484fc9c09f76e3027b331dc3e697188b6427d6eefb15e5e0c422b87525d76b2559002cfe5720c89d9cdee15921f461ff427fa04193792f4f2bece5f
7
+ data.tar.gz: 24fa994119eda5a1bb258bf486d27c69f15288678550c4b8103cd54af1943286307b77ca7bf7186cca7bfac5316cf5eeb491d617ed3f652de5d74704c560341e
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Scim
4
+ module Kit
5
+ module V2
6
+ # Represents an application SCIM configuration.
7
+ class Configuration
8
+ # @private
9
+ class Builder
10
+ def initialize
11
+ @resource_types = {}
12
+ @schemas = {}
13
+ end
14
+
15
+ def service_provider_configuration(location:)
16
+ @sp_config = ServiceProviderConfiguration.new(location: location)
17
+ yield @sp_config
18
+ end
19
+
20
+ def resource_type(id:, location:)
21
+ @resource_types[id] ||= ResourceType.new(location: location)
22
+ @resource_types[id].id = id
23
+ yield @resource_types[id]
24
+ end
25
+
26
+ def schema(id:, name:, location:)
27
+ @schemas[id] ||= Schema.new(id: id, name: name, location: location)
28
+ yield @schemas[id]
29
+ end
30
+
31
+ def apply_to(configuration)
32
+ configuration.service_provider_configuration = @sp_config
33
+ configuration.resource_types = @resource_types
34
+ configuration.schemas = @schemas
35
+ end
36
+ end
37
+
38
+ attr_accessor :service_provider_configuration
39
+ attr_accessor :resource_types
40
+ attr_accessor :schemas
41
+
42
+ def initialize
43
+ builder = Builder.new
44
+ yield builder if block_given?
45
+ builder.apply_to(self)
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -7,13 +7,14 @@ module Scim
7
7
  class Schema
8
8
  include Templatable
9
9
 
10
- attr_reader :id, :name, :location, :attributes
10
+ attr_reader :id, :name, :attributes, :meta
11
11
  attr_accessor :description
12
12
 
13
13
  def initialize(id:, name:, location:)
14
14
  @id = id
15
15
  @name = name
16
- @location = location
16
+ @meta = Meta.new('Schema', location)
17
+ @meta.created = @meta.last_modified = @meta.version = nil
17
18
  @attributes = []
18
19
  end
19
20
 
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  json.key_format! camelize: :lower
4
- json.schemas schemas.map(&:id)
5
- json.id id
6
- json.external_id external_id
7
4
  json.meta do
8
5
  render meta, json: json
9
6
  end
7
+ json.schemas schemas.map(&:id)
8
+ json.id id
9
+ json.external_id external_id
10
10
  schemas.each do |schema|
11
11
  if schema.core?
12
12
  schema.attributes.each do |type|
@@ -1,13 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  json.key_format! camelize: :lower
4
+ json.meta do
5
+ render meta, json: json
6
+ end
4
7
  json.id id
5
8
  json.name name
6
9
  json.description description
7
- json.meta do
8
- json.resource_type 'Schema'
9
- json.location location
10
- end
11
10
  json.attributes attributes do |attribute|
12
11
  render attribute, json: json
13
12
  end
@@ -1,6 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  json.key_format! camelize: :lower
4
+ json.meta do
5
+ render meta, json: json
6
+ end
4
7
  json.schemas [Scim::Kit::V2::Schemas::SERVICE_PROVIDER_CONFIGURATION]
5
8
  json.documentation_uri documentation_uri
6
9
  json.patch do
@@ -24,6 +27,3 @@ end
24
27
  json.authentication_schemes authentication_schemes do |authentication_scheme|
25
28
  render authentication_scheme, json: json
26
29
  end
27
- json.meta do
28
- render meta, json: json
29
- end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'scim/kit/v2/attributable'
4
+ require 'scim/kit/v2/attribute'
5
+ require 'scim/kit/v2/attribute_type'
6
+ require 'scim/kit/v2/authentication_scheme'
7
+ require 'scim/kit/v2/configuration'
8
+ require 'scim/kit/v2/messages'
9
+ require 'scim/kit/v2/meta'
10
+ require 'scim/kit/v2/mutability'
11
+ require 'scim/kit/v2/resource'
12
+ require 'scim/kit/v2/resource_type'
13
+ require 'scim/kit/v2/returned'
14
+ require 'scim/kit/v2/schema'
15
+ require 'scim/kit/v2/schemas'
16
+ require 'scim/kit/v2/service_provider_configuration'
17
+ require 'scim/kit/v2/supportable'
18
+ require 'scim/kit/v2/uniqueness'
19
+
20
+ module Scim
21
+ module Kit
22
+ # Version 2 of the SCIM RFC https://tools.ietf.org/html/rfc7644
23
+ module V2
24
+ class << self
25
+ def configuration
26
+ @configuration ||= ::Scim::Kit::V2::Configuration.new
27
+ end
28
+
29
+ def configure
30
+ builder = ::Scim::Kit::V2::Configuration::Builder.new
31
+ yield builder
32
+ builder.apply_to(configuration)
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Scim
4
4
  module Kit
5
- VERSION = '0.2.4'
5
+ VERSION = '0.2.5'
6
6
  end
7
7
  end
data/lib/scim/kit.rb CHANGED
@@ -7,24 +7,9 @@ require 'active_support/core_ext/hash/indifferent_access'
7
7
  require 'scim/kit/dynamic_attributes'
8
8
  require 'scim/kit/templatable'
9
9
  require 'scim/kit/template'
10
+ require 'scim/kit/v2'
10
11
  require 'scim/kit/version'
11
12
 
12
- require 'scim/kit/v2/attributable'
13
- require 'scim/kit/v2/attribute'
14
- require 'scim/kit/v2/attribute_type'
15
- require 'scim/kit/v2/authentication_scheme'
16
- require 'scim/kit/v2/messages'
17
- require 'scim/kit/v2/meta'
18
- require 'scim/kit/v2/mutability'
19
- require 'scim/kit/v2/resource'
20
- require 'scim/kit/v2/resource_type'
21
- require 'scim/kit/v2/returned'
22
- require 'scim/kit/v2/schema'
23
- require 'scim/kit/v2/schemas'
24
- require 'scim/kit/v2/service_provider_configuration'
25
- require 'scim/kit/v2/supportable'
26
- require 'scim/kit/v2/uniqueness'
27
-
28
13
  module Scim
29
14
  module Kit
30
15
  class Error < StandardError; end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scim-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo
@@ -178,10 +178,12 @@ files:
178
178
  - lib/scim/kit/dynamic_attributes.rb
179
179
  - lib/scim/kit/templatable.rb
180
180
  - lib/scim/kit/template.rb
181
+ - lib/scim/kit/v2.rb
181
182
  - lib/scim/kit/v2/attributable.rb
182
183
  - lib/scim/kit/v2/attribute.rb
183
184
  - lib/scim/kit/v2/attribute_type.rb
184
185
  - lib/scim/kit/v2/authentication_scheme.rb
186
+ - lib/scim/kit/v2/configuration.rb
185
187
  - lib/scim/kit/v2/messages.rb
186
188
  - lib/scim/kit/v2/meta.rb
187
189
  - lib/scim/kit/v2/mutability.rb