Method: YACCL::Model::Type#update

Defined in:
lib/yaccl/model/type.rb

#update(changed_property_defs) ⇒ Object



64
65
66
67
68
69
70
71
72
73
# File 'lib/yaccl/model/type.rb', line 64

def update(changed_property_defs)
  hash = to_hash
  new_defs = changed_property_defs.map(&:to_hash).inject({}) do |result, element|
    result[element[:id]] = element
    result
  end
  hash[:propertyDefinitions] = new_defs

  Type.create(repository_id, Services.update_type(repository_id, hash))
end