Commit 2bcb798
Changed files (3)
lib
scim
lib/scim/kit/v2/attributable.rb
@@ -36,10 +36,7 @@ module Scim
if value.is_a?(Hash)
attribute_for(name)&.assign_attributes(value)
else
- attribute = attribute_for(name)
- raise Scim::Kit::UnknownAttributeError, name unless attribute
-
- attribute._value = value
+ attribute_for(name)._value = value
end
end
@@ -52,7 +49,7 @@ module Scim
private
def attribute_for(name)
- dynamic_attributes[name.to_s.underscore]
+ dynamic_attributes[name.to_s.underscore] || UnknownAttribute.new(name)
end
def create_module_for(type)
lib/scim/kit/v2/attribute.rb
@@ -78,7 +78,7 @@ module Scim
if _type.multi_valued
each_value do |hash|
hash.each do |key, value|
- attribute = attribute_for(key) || UnknownAttribute.new(key)
+ attribute = attribute_for(key)
attribute._assign(value)
errors.copy!(attribute.errors) unless attribute.valid?
end
lib/scim/kit/v2/unknown_attribute.rb
@@ -16,6 +16,10 @@ module Scim
valid?
end
+ def _value=(*args)
+ raise Scim::Kit::UnknownAttributeError, name
+ end
+
def unknown
errors.add(name, I18n.t('errors.messages.invalid'))
end