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



67
68
69
70
71
72
73
74
# File 'lib/exa/responses/answer_response.rb', line 67

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