Class: Exa::Responses::ResultWithContent
- Inherits:
-
T::Struct
- Object
- T::Struct
- Exa::Responses::ResultWithContent
- Includes:
- ResultProps
- Defined in:
- lib/exa/responses/result.rb
Class Method Summary collapse
Methods included from ResultProps
Class Method Details
.from_hash(hash) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/exa/responses/result.rb', line 45 def self.from_hash(hash) sym = Helpers.symbolize_keys(hash) base = Result.from_hash(sym) attrs = base.serialize.transform_keys { _1.to_sym } attrs = attrs.merge( text: sym[:text], highlights: sym[:highlights], highlight_scores: sym[:highlightScores]&.map(&:to_f), summary: sym[:summary], subpages: sym[:subpages]&.map { ResultWithContent.from_hash(_1) }, extras: sym[:extras] ) new(**attrs) end |