Sha256: 4617c9125f5f96cb0e86aa924d6406c01b51d5f33896198d1aa34de31aa7386c

Contents?: true

Size: 489 Bytes

Versions: 6

Compression:

Stored size: 489 Bytes

Contents

module KB
  module Searchable
    extend ActiveSupport::Concern

    included do
      include Queryable
    end

    module ClassMethods
      def search(filters)
        response = kb_client.request('search', filters: filters).symbolize_keys
        elements = response[:elements].map { |contract| from_api(contract) }
        KB::SearchResult.new(**response.merge(elements: elements))
      rescue Faraday::Error => e
        raise KB::Error.from_faraday(e)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
barkibu-kb-0.27.0 lib/kb/models/concerns/searchable.rb
barkibu-kb-0.26.0 lib/kb/models/concerns/searchable.rb
barkibu-kb-0.25.0 lib/kb/models/concerns/searchable.rb
barkibu-kb-0.24.1 lib/kb/models/concerns/searchable.rb
barkibu-kb-0.24.0 lib/kb/models/concerns/searchable.rb
barkibu-kb-0.23.0 lib/kb/models/concerns/searchable.rb