Class: LedgerSync::QuickBooksOnline::Department::Serializer

Inherits:
Serializer
  • Object
show all
Defined in:
lib/ledger_sync/quickbooks_online/department/serializer.rb

Instance Method Summary collapse

Methods inherited from Serializer

amount, date, id

Instance Method Details

#serialize(args = {}) ⇒ Object

Sending “ParentRef”: null results in QBO API crash This patches serialized hash to exclude it unless we don’t set value



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ledger_sync/quickbooks_online/department/serializer.rb', line 22

def serialize(args = {})
  deep_merge_unmapped_values = args.fetch(:deep_merge_unmapped_values, {})
  only_changes = args.fetch(:only_changes, false)
  resource = args.fetch(:resource)

  ret = super(only_changes: only_changes, resource: resource)

  return ret unless deep_merge_unmapped_values.any?

  deep_merge_if_not_mapped(
    current_hash: ret,
    hash_to_search: deep_merge_unmapped_values
  )
end