Sha256: 0e7cd8f8946432d10ab623b20229c84f25293cd1c5d4cbe43557d7460762f863

Contents?: true

Size: 949 Bytes

Versions: 3

Compression:

Stored size: 949 Bytes

Contents

module LedgerSync
  module Adaptors
    module QuickBooksOnline
      module Invoice
        module Operations
          class Find < Operation::Find
            class Contract < LedgerSync::Adaptors::Contract
              params do
                required(:ledger_id).filled(:string)
                required(:currency).maybe(:string)
                required(:customer).maybe(Types::Reference)
                required(:line_items).maybe(:array)
                required(:number).maybe(:integer)
              end
            end

            private

            def operate
              return failure(nil) if resource.ledger_id.nil?

              response = adaptor.find(
                resource: 'invoice',
                id: resource.ledger_id
              )

              success(response: response)
            rescue OAuth2::Error => e
              failure(e)
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ledger_sync-1.0.3 lib/ledger_sync/adaptors/quickbooks_online/invoice/operations/find.rb
ledger_sync-1.0.2 lib/ledger_sync/adaptors/quickbooks_online/invoice/operations/find.rb
ledger_sync-1.0.0 lib/ledger_sync/adaptors/quickbooks_online/invoice/operations/find.rb