Class: Exa::Responses::Webhook

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

Class Method Summary collapse

Class Method Details

.from_hash(hash) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/exa/responses/webhook_response.rb', line 16

def self.from_hash(hash)
  sym = Helpers.symbolize_keys(hash)
  new(
    id: sym[:id],
    object: sym[:object],
    status: sym[:status],
    events: Array(sym[:events]).map(&:to_s),
    url: sym[:url],
    secret: sym[:secret],
    metadata: Helpers.stringify_string_hash(sym[:metadata]),
    created_at: sym[:createdAt],
    updated_at: sym[:updatedAt]
  )
end