Method: Fortnox::API::Model::Base#update
- Defined in:
- lib/fortnox/api/models/base.rb
#update(hash) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fortnox/api/models/base.rb', line 33 def update( hash ) old_attributes = self.to_hash new_attributes = old_attributes.merge( hash ) return self if new_attributes == old_attributes new_hash = new_attributes.delete_if{ |_, value| value.nil? } new_hash[:new] = @new self.class.new( new_hash ) end |