scim-kit 0.2.13 → 0.2.14

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: 5cd1a84727f27f1044be51ade6de69ff5ff77907d6bb93f3a523838107672ba3
4
- data.tar.gz: 9d0e8a6b8a2f254283771f7ee73bc46b32ed5755ac0ae6f5a893ae9b6a8f579e
3
+ metadata.gz: dbc81233afe702bcd1a1288da763ff6427ecd3f43960d7f929b608434f617a1f
4
+ data.tar.gz: 7973302adf611f0bde1ecbb4a47f7d9214763f6c7ee15e6c23af697fc27dfe02
5
5
  SHA512:
6
- metadata.gz: 361acda38071926afc31f12eec8a11cf319898e43dffec6f16a3ffa2ce937d6524d116783ffa8d5bb138a05c45fa57c60d27d6efbb9ee31bebbacc17fd4ce1ee
7
- data.tar.gz: 910f10496c0409ee027f557d8737a2b12abaf72355947348c6fb450e4ccb566329b7244a56fedd7451db22d2e34031d115c4ce75d8cabba67aab4f5a168de6df
6
+ metadata.gz: 72fd293f278e2d2c8ffbcdb63f871d27d47e919df333abab4db973ce8a350c7cfb600f505cfb25a56185485406ad11b605e5e53dc80b53eed49b26b754a7b5eb
7
+ data.tar.gz: 16c34302e8ff58c54d4fc22043bad37aea6f8f050d75f1c2c7ac7165f8f51bd84aa89472c4e55cded70a4beebebaf239661b8e1e87c3f3799d0b8808b3a9b069
@@ -19,6 +19,10 @@ module Scim
19
19
  def render(model, options)
20
20
  Template.new(model).to_json(options)
21
21
  end
22
+
23
+ def template_name
24
+ "#{self.class.name.split('::').last.underscore}.json.jbuilder"
25
+ end
22
26
  end
23
27
  end
24
28
  end
@@ -19,11 +19,7 @@ module Scim
19
19
  private
20
20
 
21
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"
22
+ TEMPLATES_DIR.join(target.template_name)
27
23
  end
28
24
 
29
25
  def template
data/lib/scim/kit/v2.rb CHANGED
@@ -9,6 +9,7 @@ require 'scim/kit/v2/messages'
9
9
  require 'scim/kit/v2/meta'
10
10
  require 'scim/kit/v2/mutability'
11
11
  require 'scim/kit/v2/resource'
12
+ require 'scim/kit/v2/error'
12
13
  require 'scim/kit/v2/resource_type'
13
14
  require 'scim/kit/v2/returned'
14
15
  require 'scim/kit/v2/schema'
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Scim
4
+ module Kit
5
+ module V2
6
+ # Represents a SCIM Error
7
+ class Error < Resource
8
+ SCIM_TYPES = %w[
9
+ invalidPath
10
+ invalidSyntax
11
+ invalidSyntax
12
+ invalidValue
13
+ invalidVers
14
+ mutability
15
+ noTarget
16
+ sensitive
17
+ tooMany
18
+ uniqueness
19
+ ].freeze
20
+
21
+ def initialize(schemas: [self.class.default_schema])
22
+ super(schemas: schemas)
23
+ end
24
+
25
+ def template_name
26
+ 'resource.json.jbuilder'
27
+ end
28
+
29
+ def self.default_schema
30
+ Schema.new(id: Messages::ERROR, name: 'Error', location: nil) do |x|
31
+ x.add_attribute(name: :scim_type) do |attribute|
32
+ attribute.canonical_values = SCIM_TYPES
33
+ end
34
+ x.add_attribute(name: :detail)
35
+ x.add_attribute(name: :status, type: :integer)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -12,6 +12,7 @@ module Scim
12
12
  attr_accessor :id, :external_id
13
13
  attr_reader :meta
14
14
  attr_reader :schemas
15
+ attr_reader :raw_attributes
15
16
 
16
17
  validate :schema_validations
17
18
 
@@ -19,6 +20,7 @@ module Scim
19
20
  @meta = Meta.new(schemas[0].name, location)
20
21
  @meta.disable_timestamps
21
22
  @schemas = schemas
23
+ @raw_attributes = attributes
22
24
  schemas.each do |schema|
23
25
  define_attributes_for(self, schema.attributes)
24
26
  end
@@ -17,6 +17,7 @@ module Scim
17
17
  @meta = Meta.new('Schema', location)
18
18
  @meta.created = @meta.last_modified = @meta.version = nil
19
19
  @attributes = []
20
+ yield self if block_given?
20
21
  end
21
22
 
22
23
  def add_attribute(name:, type: :string)
@@ -26,7 +27,7 @@ module Scim
26
27
  end
27
28
 
28
29
  def core?
29
- id.include?(Schemas::CORE)
30
+ id.include?(Schemas::CORE) || id.include?(Messages::CORE)
30
31
  end
31
32
 
32
33
  def self.build(*args)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Scim
4
4
  module Kit
5
- VERSION = '0.2.13'
5
+ VERSION = '0.2.14'
6
6
  end
7
7
  end
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.2.13
4
+ version: 0.2.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-16 00:00:00.000000000 Z
11
+ date: 2019-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -198,6 +198,7 @@ files:
198
198
  - lib/scim/kit/v2/attribute_type.rb
199
199
  - lib/scim/kit/v2/authentication_scheme.rb
200
200
  - lib/scim/kit/v2/configuration.rb
201
+ - lib/scim/kit/v2/error.rb
201
202
  - lib/scim/kit/v2/messages.rb
202
203
  - lib/scim/kit/v2/meta.rb
203
204
  - lib/scim/kit/v2/mutability.rb