Sha256: 822521e9382ba2b28fac4b05d6871dfb154c60f495318c367e9c54adadb0624e

Contents?: true

Size: 932 Bytes

Versions: 5

Compression:

Stored size: 932 Bytes

Contents

module LedgerSync
  module Adaptors
    module Test
      module Customer
        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: 'customer',
                  query: "name LIKE '#{query}%'"
                )
                .map do |c|
                  LedgerSync::Customer.new(
                    ledger_id: c.fetch('id'),
                    name: c.dig('name'),
                    # active: c.dig('active')
                  )
                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.0.10 lib/ledger_sync/adaptors/test/customer/searcher.rb
ledger_sync-1.0.9 lib/ledger_sync/adaptors/test/customer/searcher.rb
ledger_sync-1.0.3 lib/ledger_sync/adaptors/test/customer/searcher.rb
ledger_sync-1.0.2 lib/ledger_sync/adaptors/test/customer/searcher.rb
ledger_sync-1.0.0 lib/ledger_sync/adaptors/test/customer/searcher.rb