Class: Exa::Responses::CostDollars
- Inherits:
-
T::Struct
- Object
- T::Struct
- Exa::Responses::CostDollars
- Defined in:
- lib/exa/responses/cost.rb
Overview
Complete cost information returned by Exa API responses
Class Method Summary collapse
Class Method Details
.from_hash(hash) ⇒ Object
82 83 84 85 86 87 88 89 90 91 |
# File 'lib/exa/responses/cost.rb', line 82 def self.from_hash(hash) return nil unless hash sym = Helpers.symbolize_keys(hash) new( total: sym[:total]&.to_f, break_down: sym[:breakDown]&.map { CostBreakdown.from_hash(_1) }, per_request_prices: PerRequestPrices.from_hash(sym[:perRequestPrices]), per_page_prices: PerPagePrices.from_hash(sym[:perPagePrices]) ) end |