Class: Exa::Responses::CostBreakdownDetail

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

Overview

Detailed breakdown of costs by operation type within a single request iteration

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/cost.rb', line 13

def self.from_hash(hash)
  return nil unless hash
  sym = Helpers.symbolize_keys(hash)
  new(
    neural_search: sym[:neuralSearch]&.to_f,
    deep_search: sym[:deepSearch]&.to_f,
    content_text: sym[:contentText]&.to_f,
    content_highlight: sym[:contentHighlight]&.to_f,
    content_summary: sym[:contentSummary]&.to_f
  )
end