Class: LedgerSync::Adaptors::QuickBooksOnline::Department::LedgerSerializer

Inherits:
LedgerSerializer show all
Defined in:
lib/ledger_sync/adaptors/quickbooks_online/department/ledger_serializer.rb

Instance Attribute Summary

Attributes inherited from LedgerSerializer

#resource

Instance Method Summary collapse

Methods inherited from LedgerSerializer

#deserialize, id, ledger_serializer_for, #merge_resources_for_full_update, quickbooks_online_resource_type

Methods inherited from LedgerSerializer

attribute, #attribute_value_from_ledger, attributes, #deserialize, id, #initialize, references_many, references_one

Methods included from Mixins::InferResourceClassMixin

included

Constructor Details

This class inherits a constructor from LedgerSync::Adaptors::LedgerSerializer

Instance Method Details

#to_ledger_hash(deep_merge_unmapped_values: {}, only_changes: false) ⇒ Object

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



24
25
26
27
28
29
30
31
32
33
# File 'lib/ledger_sync/adaptors/quickbooks_online/department/ledger_serializer.rb', line 24

def to_ledger_hash(deep_merge_unmapped_values: {}, only_changes: false)
  ret = super(only_changes: only_changes)
  ret = ret.except('ParentRef') unless resource.parent_changed?
  return ret unless deep_merge_unmapped_values.any?

  deep_merge_if_not_mapped(
    current_hash: ret,
    hash_to_search: deep_merge_unmapped_values
  )
end