Commit 9abbd67
Changed files (3)
lib
scim
kit
lib/scim/kit/v2/attribute.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+module Scim
+ module Kit
+ module V2
+ # Represents a SCIM Schema
+ class Attribute
+ attr_reader :type
+ attr_accessor :value
+
+ def initialize(type:, value: nil)
+ @type = type
+ @value = value
+ end
+ end
+ end
+ end
+end
lib/scim/kit/v2/resource.rb
@@ -13,7 +13,7 @@ module Scim
def initialize(schema:, location:)
@meta = Meta.new(schema.id, location)
@dynamic_attributes = Hash[
- schema.attributes.map { |x| [x.name.underscore, nil] }
+ schema.attributes.map { |x| [x.name.underscore, Attribute.new(type: x)] }
].with_indifferent_access
end
@@ -22,9 +22,9 @@ module Scim
target = method.to_s.delete('=')
return super unless respond_to_missing?(target)
- @dynamic_attributes[target] = args[0]
+ @dynamic_attributes[target].value = args[0]
else
- @dynamic_attributes[method]
+ @dynamic_attributes[method].value
end
end
lib/scim/kit.rb
@@ -9,6 +9,7 @@ require 'scim/kit/templatable'
require 'scim/kit/template'
require 'scim/kit/version'
+require 'scim/kit/v2/attribute'
require 'scim/kit/v2/attribute_type'
require 'scim/kit/v2/authentication_scheme'
require 'scim/kit/v2/messages'