Sha256: 81756f6f67afc991c6605a75be971982d3057103a78cc4c6989746af998dcb47

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require_relative '../operation'

module LedgerSync
  module Ledgers
    module QuickBooksOnline
      class Operation
        class FullUpdate
          include QuickBooksOnline::Operation::Mixin

          private

          def find_resource
            client.find(
              path: ledger_resource_path
            )
          end

          def operate
            find_result_hash = find_resource.body.dig(
              quickbooks_online_resource_type.to_s.classify
            )
            merged_resource = deserializer.deserialize(
              hash: find_result_hash,
              merge_for_full_update: true,
              resource: resource
            )
            merged_serializer = serializer.class.new
            response_to_operation_result(
              response: client.post(
                path: ledger_resource_type_for_path,
                payload: merged_serializer.serialize(
                  deep_merge_unmapped_values: find_result_hash,
                  resource: merged_resource
                )
              )
            )
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ledger_sync-1.4.4 lib/ledger_sync/ledgers/quickbooks_online/operation/full_update.rb
ledger_sync-1.4.2 lib/ledger_sync/ledgers/quickbooks_online/operation/full_update.rb
ledger_sync-1.4.1 lib/ledger_sync/ledgers/quickbooks_online/operation/full_update.rb
ledger_sync-1.4.0 lib/ledger_sync/ledgers/quickbooks_online/operation/full_update.rb