Sha256: f0f350fc1cdd79f8cf69b2f86b7f4864135111f8aab7a0610bb87f65356efdc0
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
module LedgerSync module Adaptors module Test module Transfer module Operations class Create < Operation::Create class Contract < LedgerSync::Adaptors::Contract schema do required(:ledger_id).value(:nil) 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 response = adaptor.post( resource: 'transfer', payload: local_resource_data ) resource.ledger_id = response.dig('id') 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/create.rb |