Sha256: bf01b67b2e4894c585161f87737a840d8c3aa320f90fd5f9416866f44283dc0f
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
module LedgerSync module Adaptors module Test module Account module Operations class Create < Operation::Create class Contract < LedgerSync::Adaptors::Contract schema do required(:ledger_id).value(:nil) required(:name).filled(:string) required(:classification).filled(:string) required(:account_type).filled(:string) required(:account_sub_type).filled(:string) required(:number).maybe(:integer) required(:currency).maybe(:string) required(:description).maybe(:string) required(:active).maybe(:bool) end end private def id SecureRandom.uuid end def local_resource_data { 'name' => resource.name, 'classification' => resource.classification, 'account_type' => resource.account_type, 'account_sub_type' => resource.account_sub_type } end def operate response = adaptor.post( resource: 'account', payload: local_resource_data.merge( 'id' => id ) ) resource.ledger_id = response.dig('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/test/account/operations/create.rb |