Module: Fortnox::API::Repository::Savers

Included in:
Base
Defined in:
lib/fortnox/api/repositories/base/savers.rb

Instance Method Summary collapse

Instance Method Details

#save(entity) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/fortnox/api/repositories/base/savers.rb', line 6

def save( entity )
  return true if entity.saved?

  hash = entity_to_hash( entity )

  return save_new( hash ) if entity.new?
  update_existing( hash )
end