Sha256: f7adbc191d153e4fffd6bec186a07ce1bc05fb53f82f8ab397555d05fe5b65ef

Contents?: true

Size: 1005 Bytes

Versions: 1

Compression:

Stored size: 1005 Bytes

Contents

module LedgerSync
  module Adaptors
    module QuickBooksOnline
      module Transfer
        module Operations
          class Find < Operation::Find
            class Contract < LedgerSync::Adaptors::Contract
              schema do
                required(:ledger_id).filled(:string)
                required(:from_account).hash(Types::Reference)
                required(:to_account).hash(Types::Reference)
                required(:amount).maybe(:integer)
                required(:currency).maybe(:string)
                required(:memo).maybe(:string)
                required(:transaction_date).maybe(:date?)
              end
            end

            private

            def operate
              return failure(nil) if resource.ledger_id.nil?

              response = adaptor.find(
                resource: 'transfer',
                id: resource.ledger_id
              )

              success(response: response)
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ledger_sync-1.1.1 lib/ledger_sync/adaptors/quickbooks_online/transfer/operations/find.rb