Sha256: 262f8ca320187c28fd426fe951502044f2129ed0feed4825f2b3db63d87c30c4
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
# frozen_string_literal: true module LedgerSync module Adaptors module QuickBooksOnline module Vendor module Operations class Update < Operation::Update class Contract < LedgerSync::Adaptors::Contract params do required(:ledger_id).filled(:string) optional(:display_name).maybe(:string) optional(:first_name).maybe(:string) optional(:last_name).maybe(:string) optional(:email).maybe(:string) end end private def operate ledger_resource_data = adaptor.find( resource: 'vendor', id: resource.ledger_id ) response = adaptor.post( resource: 'vendor', payload: merge_into(from: local_resource_data, to: ledger_resource_data) ) resource.ledger_id = response.dig('Id') success(response: response) end def local_resource_data { 'DisplayName' => resource.display_name, 'GivenName' => resource.first_name, 'FamilyName' => resource.last_name, 'PrimaryEmailAddr' => { 'Address' => resource.email } } 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/vendor/operations/update.rb |