Sha256: 1860ce703e96950891abafe2becdf37e28e4d45f78faaedff5a5448494e1e2f0

Contents?: true

Size: 885 Bytes

Versions: 5

Compression:

Stored size: 885 Bytes

Contents

module LedgerSync
  module Adaptors
    module Test
      module Payment
        module Operations
          class Find < Operation::Find
            class Contract < LedgerSync::Adaptors::Contract
              schema do
                required(:ledger_id).filled(:string)
                optional(:amount).maybe(:integer)
                optional(:currency).maybe(:string)
                optional(:customer).maybe(Types::Reference)
              end
            end

            private

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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ledger_sync-1.0.10 lib/ledger_sync/adaptors/test/payment/operations/find.rb
ledger_sync-1.0.9 lib/ledger_sync/adaptors/test/payment/operations/find.rb
ledger_sync-1.0.3 lib/ledger_sync/adaptors/test/payment/operations/find.rb
ledger_sync-1.0.2 lib/ledger_sync/adaptors/test/payment/operations/find.rb
ledger_sync-1.0.0 lib/ledger_sync/adaptors/test/payment/operations/find.rb