Class: Exa::Responses::WebhookAttempt

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



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/exa/responses/webhook_response.rb', line 61

def self.from_hash(hash)
  sym = Helpers.symbolize_keys(hash)
  new(
    id: sym[:id],
    object: sym[:object],
    event_id: sym[:eventId],
    event_type: sym[:eventType],
    webhook_id: sym[:webhookId],
    url: sym[:url],
    successful: sym[:successful],
    response_headers: Helpers.stringify_string_hash(sym[:responseHeaders]),
    response_body: sym[:responseBody],
    response_status_code: sym[:responseStatusCode]&.to_i,
    attempt: sym[:attempt]&.to_i,
    attempted_at: sym[:attemptedAt]
  )
end