Sha256: 4b6fb753cdde88c031f3bc7dc7e2ed09a058dc2adc6063a5b413bb59e5d46e37

Contents?: true

Size: 1018 Bytes

Versions: 5

Compression:

Stored size: 1018 Bytes

Contents

module LedgerSync
  module Adaptors
    module Test
      module Vendor
        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: 'vendor',
                  query: "name LIKE '#{query}%'"
                )
                .map do |v|
                  LedgerSync::Vendor.new(
                    ledger_id: v.fetch('id'),
                    display_name: v.fetch('display_name', ''),
                    first_name: v.fetch('first_name', ''),
                    last_name:  v.fetch('last_name', '')
                  )
                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/vendor/searcher.rb
ledger_sync-1.3.1 lib/ledger_sync/adaptors/test/vendor/searcher.rb
ledger_sync-1.1.3 lib/ledger_sync/adaptors/test/vendor/searcher.rb
ledger_sync-1.1.2 lib/ledger_sync/adaptors/test/vendor/searcher.rb
ledger_sync-1.1.1 lib/ledger_sync/adaptors/test/vendor/searcher.rb