Method: Scimitar::Resources::Base#constantize_complex_types

Defined in:
app/models/scimitar/resources/base.rb

#constantize_complex_types(hash) ⇒ Object



157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'app/models/scimitar/resources/base.rb', line 157

def constantize_complex_types(hash)
  hash.with_indifferent_access.each_pair do |attr_name, attr_value|
    scim_attribute = self.class.complex_scim_attributes[attr_name].try(:first)

    if scim_attribute&.complexType
      if scim_attribute.multiValued
        self.send("#{attr_name}=", attr_value&.map {|attr_for_each_item| complex_type_from_hash(scim_attribute, attr_for_each_item)})
      else
        self.send("#{attr_name}=", complex_type_from_hash(scim_attribute, attr_value))
      end
    end
  end
end