Sha256: 6e4d8b559429509105d386fb6da82c53b37a2473d3c98ca967f6e0aaeff0ae7e

Contents?: true

Size: 951 Bytes

Versions: 5

Compression:

Stored size: 951 Bytes

Contents

module LedgerSync
  module Adaptors
    module Test
      module Account
        class Searcher < LedgerSync::Adaptors::Searcher
          def next_searcher
            paginate(cursor: 'asdf')
          end

          def previous_searcher
            paginate(cursor: 'asdf')
          end

          def resources
            @resources ||= begin
              adaptor
                .query(
                  resource: 'account',
                  query: "name LIKE '#{query}%'"
                )
                .map do |a|
                  LedgerSync::Account.new(
                    ledger_id: a.fetch('id'),
                    name: a.fetch('name', ''),
                    account_type: a.fetch('account_type', '')
                  )
                end
            end
          end

          def search
            super
          rescue OAuth2::Error => e
            failure(e)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ledger_sync-1.3.2 lib/ledger_sync/adaptors/test/account/searcher.rb
ledger_sync-1.3.1 lib/ledger_sync/adaptors/test/account/searcher.rb
ledger_sync-1.1.3 lib/ledger_sync/adaptors/test/account/searcher.rb
ledger_sync-1.1.2 lib/ledger_sync/adaptors/test/account/searcher.rb
ledger_sync-1.1.1 lib/ledger_sync/adaptors/test/account/searcher.rb