Class: Conquiro::SearchAPI::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/conquiro/search_api/adapter.rb

Instance Method Summary collapse

Instance Method Details

#clientObject



14
15
16
# File 'lib/conquiro/search_api/adapter.rb', line 14

def client
  @client ||= SearchAPI::Client.new
end

#query(criteria) ⇒ Object



7
8
9
10
11
12
# File 'lib/conquiro/search_api/adapter.rb', line 7

def query(criteria)
  raise 'Criteria is not valid.' unless criteria.valid?
  response = client.query(criteria.params)
  results = response[:results]
  Conquiro::SearchAPI::ResultCollection.from_json(results)
end