Sha256: acd329ad5a3730e68e5706986423baa3c41315d0cd535c371cf7cba84483685a
Contents?: true
Size: 706 Bytes
Versions: 3
Compression:
Stored size: 706 Bytes
Contents
# frozen_string_literal: true require_relative 'base/canonical_name_sym' require_relative 'base/from_json' require_relative 'base/to_json' module Fortnox module API module Mapper class Base include FromJSON include ToJSON extend CanonicalNameSym def diff(entity_hash, parent_hash) hash_diff(entity_hash[self.class::JSON_ENTITY_WRAPPER], parent_hash[self.class::JSON_ENTITY_WRAPPER]) end private def hash_diff(hash1, hash2) hash1.dup .delete_if { |k, v| hash2[k] == v } .merge!(hash2.dup.delete_if { |k, _| hash1.key?(k) }) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fortnox-api-0.8.2 | lib/fortnox/api/mappers/base.rb |
fortnox-api-0.8.1 | lib/fortnox/api/mappers/base.rb |
fortnox-api-0.9.0 | lib/fortnox/api/mappers/base.rb |