Sha256: d80d2cfde3761157191ca99f3aef802ee189b4b34ee2c347b22fb06c15905e31

Contents?: true

Size: 871 Bytes

Versions: 4

Compression:

Stored size: 871 Bytes

Contents

# frozen_string_literal: true

module LedgerSync
  module Adaptors
    module Test
      module Operation
        class Update < Adaptors::Operation::Update
          private

          def operate
            resource_type = resource.class.resource_type

            ledger_resource_data = adaptor.find(
              resource: resource_type,
              id: resource.ledger_id
            )

            find_serializer = Test::LedgerSerializer.new(resource: resource).deserialize(hash: ledger_resource_data)

            response = adaptor.post(
              resource: resource_type,
              payload: find_serializer.to_h
            )

            success(
              resource: Test::LedgerSerializer.new(resource: resource).deserialize(hash: response),
              response: response
            )
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ledger_sync-1.3.2 lib/ledger_sync/adaptors/test/operation/update.rb
ledger_sync-1.3.1 lib/ledger_sync/adaptors/test/operation/update.rb
ledger_sync-1.1.3 lib/ledger_sync/adaptors/test/operation/update.rb
ledger_sync-1.1.2 lib/ledger_sync/adaptors/test/operation/update.rb