Sha256: 47cb00e3918d09912a997233192b5d2a19cba2d5cfb63fecef64e4fa2700c7f6

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

require_relative '../operation'

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

          private

          def find_resource
            adaptor.find(
              path: ledger_resource_path
            )
          end

          def operate
            find_result_hash = find_resource.body.dig(
              quickbooks_online_resource_type.to_s.classify
            )
            merged_resource = ledger_serializer.deserialize(
              hash: find_result_hash,
              merge_for_full_update: true
            )
            merged_serializer = ledger_serializer.class.new(
              resource: merged_resource
            )

            result(
              response: adaptor.post(
                path: ledger_resource_type_for_path,
                payload: merged_serializer.to_ledger_hash(
                  deep_merge_unmapped_values: find_result_hash
                )
              )
            )
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ledger_sync-1.3.2 lib/ledger_sync/adaptors/quickbooks_online/operation/full_update.rb
ledger_sync-1.3.1 lib/ledger_sync/adaptors/quickbooks_online/operation/full_update.rb