Commit d665835
Changed files (1)
lib
scim
kit
lib/scim/kit/v2/attributable.rb
@@ -38,7 +38,9 @@ module Scim
# @param name [String] the name of the attribute to return
# @return [Scim::Kit::V2::Attribute] the attribute or {Scim::Kit::V2::UnknownAttribute}
def attribute_for(name)
- dynamic_attributes[name.to_s.underscore] || UnknownAttribute.new(name)
+ dynamic_attributes[name.to_s.underscore] ||
+ dynamic_attributes[name] ||
+ UnknownAttribute.new(name)
end
# Returns the value associated with the attribute name
@@ -86,11 +88,19 @@ module Scim
end
def attribute(type, resource)
- dynamic_attributes[type.name] = Attribute.new(
- type: type,
- resource: resource
- )
- extend(create_module_for(type))
+ if dynamic_attributes.key?(type.name)
+ key = "#{type.schema&.id}##{type.name}"
+ dynamic_attributes[key] = Attribute.new(
+ type: type,
+ resource: resource
+ )
+ else
+ dynamic_attributes[type.name] = Attribute.new(
+ type: type,
+ resource: resource
+ )
+ extend(create_module_for(type))
+ end
end
end
end