Class: Exa::Responses::CostBreakdown

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
43
# File 'lib/exa/responses/answer_response.rb', line 35

def self.from_hash(hash)
  return nil unless hash
  sym = Helpers.symbolize_keys(hash)
  new(
    search: sym[:search]&.to_f,
    contents: sym[:contents]&.to_f,
    breakdown: sym[:breakdown]&.transform_keys(&:to_sym)
  )
end