class Fortnox::API::Mapper::Base

Public Instance Methods

diff(entity_hash, parent_hash) click to toggle source
# File lib/fortnox/api/mappers/base.rb, line 15
def diff(entity_hash, parent_hash)
  hash_diff(entity_hash[self.class::JSON_ENTITY_WRAPPER],
            parent_hash[self.class::JSON_ENTITY_WRAPPER])
end

Private Instance Methods

hash_diff(hash1, hash2) click to toggle source
# File lib/fortnox/api/mappers/base.rb, line 22
def hash_diff(hash1, hash2)
  hash1.dup
       .delete_if { |k, v| hash2[k] == v }
       .merge!(hash2.dup.delete_if { |k, _| hash1.key?(k) })
end