Sha256: 93b3fa35db691d041f254711597dea04edcb34eaf83800ded72237974f4fad40
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
# frozen_string_literal: true module LedgerSync module Adaptors module QuickBooksOnline module Customer module Operations class Update < Operation::Update class Contract < LedgerSync::Adaptors::Contract params do required(:ledger_id).filled(:string) required(:email).maybe(:string) required(:name).filled(:string) required(:phone_number).maybe(:string) end end private def operate ledger_resource_data = adaptor.find( resource: 'customer', id: resource.ledger_id ) response = adaptor.post( resource: 'customer', 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.name, "PrimaryPhone" => { "FreeFormNumber" => resource.phone_number }, "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/customer/operations/update.rb |