Class: HookSniff::MessageAttempt

Inherits:
Object
  • Object
show all
Defined in:
lib/hooksniff/api/message_attempt.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ MessageAttempt

Returns a new instance of MessageAttempt.



7
8
9
# File 'lib/hooksniff/api/message_attempt.rb', line 7

def initialize(client)
  @client = client
end

Instance Method Details

#get(attempt_id) ⇒ Object



25
26
27
28
# File 'lib/hooksniff/api/message_attempt.rb', line 25

def get(attempt_id)
  res = @client.execute_request("GET", "/v1/webhooks/attempts/#{attempt_id}")
  MessageAttemptOut.deserialize(res)
end

#list_by_msg(message_id, options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/hooksniff/api/message_attempt.rb', line 11

def list_by_msg(message_id, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "GET",
    "/v1/webhooks/#{message_id}/attempts",
    query_params: {
      "limit" => options["limit"],
      "offset" => options["offset"],
      "status" => options["status"]
    }
  )
  ListResponseMessageAttemptOut.deserialize(res)
end

#resend(message_id, endpoint_id) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/hooksniff/api/message_attempt.rb', line 30

def resend(message_id, endpoint_id)
  res = @client.execute_request(
    "POST",
    "/v1/webhooks/#{message_id}/attempts/#{endpoint_id}/resend"
  )
  nil
end