Sha256: 7d7def747d71495a7761fbd09d3fc0be5924c6504a28ff7b2eb18e6db22d7573
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
module LedgerSync module Adaptors module Test module Transfer module Operations class Update < Operation::Update class Contract < LedgerSync::Adaptors::Contract params do required(:ledger_id).filled(:string) required(:from_account).hash(Types::Reference) required(:to_account).hash(Types::Reference) required(:amount).filled(:integer) required(:currency).filled(:string) required(:memo).filled(:string) required(:transaction_date).filled(:date?) end end private def operate ledger_resource_data = adaptor.find( resource: 'transfer', id: resource.ledger_id ) response = adaptor.post( resource: 'transfer', payload: merge_into(from: local_resource_data, to: ledger_resource_data) ) success(response: response) end def local_resource_data { 'amount' => resource.amount, 'currency' => resource.currency, 'from_account_id' => resource.from_account.ledger_id, 'to_account_id' => resource.to_account.ledger_id, 'date' => resource.transaction_date } 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/test/transfer/operations/update.rb |