Class: Exa::Responses::Result

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

Class Method Summary collapse

Methods included from ResultProps

included

Class Method Details

.from_hash(hash) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/exa/responses/result.rb', line 21

def self.from_hash(hash)
  sym = Helpers.symbolize_keys(hash)
  new(
    title: sym[:title],
    url: sym[:url],
    published_date: sym[:publishedDate],
    author: sym[:author],
    score: sym[:score]&.to_f,
    id: sym[:id],
    image: sym[:image],
    favicon: sym[:favicon]
  )
end