Sha256: fff4cc1e47faa6c484a8147669b936639ca1b5839ea273625656c9feed1c2f08
Contents?: true
Size: 1.17 KB
Versions: 3
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true module LedgerSync module Adaptors class Searcher include SimplySerializable::Mixin attr_reader :adaptor, :query, :pagination, :resources serialize only: %i[ adaptor query pagination resources ] def initialize(adaptor:, query:, pagination: {}) @adaptor = adaptor @query = query @pagination = pagination end def next_searcher raise NotImplementedError end def previous_searcher raise NotImplementedError end def resources raise NotImplementedError end def search @search ||= success end private def paginate(**keywords) self.class.new( adaptor: adaptor, query: query, pagination: keywords ) end def success SearchResult.Success( searcher: self ) end def failure(searcher: nil, **keywords) SearchResult.Failure( searcher: searcher || self, **keywords ) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ledger_sync-1.1.3 | lib/ledger_sync/adaptors/searcher.rb |
ledger_sync-1.1.2 | lib/ledger_sync/adaptors/searcher.rb |
ledger_sync-1.1.1 | lib/ledger_sync/adaptors/searcher.rb |