Sha256: 077f614d74fa5ae72339dd2f0101663c009551d8c17270d1c3c65d639bff1bb5
Contents?: true
Size: 1.32 KB
Versions: 2
Compression:
Stored size: 1.32 KB
Contents
module LedgerSync module Adaptors module Test module Customer module Operations class Create < Operation::Create class Contract < LedgerSync::Adaptors::Contract schema do required(:external_id).maybe(:string) required(:ledger_id).value(:nil) required(:email).maybe(:string) required(:name).filled(:string) required(:phone_number).maybe(:string) required(:subsidiary).maybe(:hash, Types::Reference) end end private def id SecureRandom.uuid end def local_resource_data { 'name' => resource.name, 'phone_number' => resource.phone_number, 'email' => resource.email } end def operate response = adaptor.post( resource: 'customer', payload: local_resource_data.merge( 'id' => id ) ) resource.ledger_id = response.dig('id') success( response: response, resource: resource ) end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ledger_sync-1.3.2 | lib/ledger_sync/adaptors/test/customer/operations/create.rb |
ledger_sync-1.3.1 | lib/ledger_sync/adaptors/test/customer/operations/create.rb |