Class: Exa::Responses::AnswerResponse

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

Class Method Summary collapse

Class Method Details

.from_hash(hash) ⇒ Object



35
36
37
38
39
40
41
42
# File 'lib/exa/responses/answer_response.rb', line 35

def self.from_hash(hash)
  sym = Helpers.symbolize_keys(hash)
  new(
    answer: sym[:answer],
    citations: Array(sym[:citations]).map { AnswerCitation.from_hash(_1) },
    cost_dollars: CostDollars.from_hash(sym[:costDollars])
  )
end