Sha256: 79c33cbad867c186b36f8a50b7bc66f90eb389c35d317525a4909b48b985a052
Contents?: true
Size: 1.39 KB
Versions: 2
Compression:
Stored size: 1.39 KB
Contents
# frozen_string_literal: true module LedgerSync module Adaptors class Searcher include SimplySerializable::Mixin include Mixins::InferResourceClassMixin include Mixins::InferLedgerSerializerMixin attr_reader :adaptor, :query, :pagination, :request serialize only: %i[ adaptor query pagination resources ] def initialize(adaptor:, query:, pagination: {}) @adaptor = adaptor @query = query @pagination = pagination end def ledger_deserializer_class @ledger_deserializer_class ||= self.class.inferred_ledger_deserializer_class 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ledger_sync-1.3.5 | lib/ledger_sync/adaptors/searcher.rb |
ledger_sync-1.3.4 | lib/ledger_sync/adaptors/searcher.rb |