Class: Exa::Responses::SearchResponse

Inherits:
T::Struct
  • Object
show all
Defined in:
lib/exa/responses/search_response.rb

Class Method Summary collapse

Class Method Details

.from_hash(hash) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/exa/responses/search_response.rb', line 13

def self.from_hash(hash)
  sym = Helpers.symbolize_keys(hash)
  new(
    request_id: sym[:requestId],
    resolved_search_type: sym[:resolvedSearchType],
    search_type: sym[:searchType],
    results: Array(sym[:results]).map { ResultWithContent.from_hash(_1) },
    context: sym[:context],
    cost_dollars: CostDollars.from_hash(sym[:costDollars])
  )
end