Class: Svix::MessageAttempt

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ MessageAttempt

Returns a new instance of MessageAttempt.



8
9
10
# File 'lib/svix/api/message_attempt.rb', line 8

def initialize(client)
  @client = client
end

Instance Method Details

#expunge_content(app_id, msg_id, attempt_id) ⇒ Object



84
85
86
87
88
89
# File 'lib/svix/api/message_attempt.rb', line 84

def expunge_content(app_id, msg_id, attempt_id)
  @client.execute_request(
    "DELETE",
    "/api/v1/app/#{app_id}/msg/#{msg_id}/attempt/#{attempt_id}/content"
  )
end

#get(app_id, msg_id, attempt_id) ⇒ Object



76
77
78
79
80
81
82
# File 'lib/svix/api/message_attempt.rb', line 76

def get(app_id, msg_id, attempt_id)
  res = @client.execute_request(
    "GET",
    "/api/v1/app/#{app_id}/msg/#{msg_id}/attempt/#{attempt_id}"
  )
  MessageAttemptOut.deserialize(res)
end

#list_attempted_destinations(app_id, msg_id, options = {}) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/svix/api/message_attempt.rb', line 91

def list_attempted_destinations(app_id, msg_id, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "GET",
    "/api/v1/app/#{app_id}/msg/#{msg_id}/endpoint",
    query_params: {
      "limit" => options["limit"],
      "iterator" => options["iterator"]
    }
  )
  ListResponseMessageEndpointOut.deserialize(res)
end

#list_attempted_messages(app_id, endpoint_id, options = {}) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/svix/api/message_attempt.rb', line 56

def list_attempted_messages(app_id, endpoint_id, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "GET",
    "/api/v1/app/#{app_id}/endpoint/#{endpoint_id}/msg",
    query_params: {
      "limit" => options["limit"],
      "iterator" => options["iterator"],
      "channel" => options["channel"],
      "tag" => options["tag"],
      "status" => options["status"],
      "before" => options["before"],
      "after" => options["after"],
      "with_content" => options["with_content"],
      "event_types" => options["event_types"]
    }
  )
  ListResponseEndpointMessageOut.deserialize(res)
end

#list_by_endpoint(app_id, endpoint_id, options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/svix/api/message_attempt.rb', line 12

def list_by_endpoint(app_id, endpoint_id, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "GET",
    "/api/v1/app/#{app_id}/attempt/endpoint/#{endpoint_id}",
    query_params: {
      "limit" => options["limit"],
      "iterator" => options["iterator"],
      "status" => options["status"],
      "status_code_class" => options["status_code_class"],
      "channel" => options["channel"],
      "tag" => options["tag"],
      "before" => options["before"],
      "after" => options["after"],
      "with_content" => options["with_content"],
      "with_msg" => options["with_msg"],
      "event_types" => options["event_types"]
    }
  )
  ListResponseMessageAttemptOut.deserialize(res)
end

#list_by_msg(app_id, msg_id, options = {}) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/svix/api/message_attempt.rb', line 34

def list_by_msg(app_id, msg_id, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "GET",
    "/api/v1/app/#{app_id}/attempt/msg/#{msg_id}",
    query_params: {
      "limit" => options["limit"],
      "iterator" => options["iterator"],
      "status" => options["status"],
      "status_code_class" => options["status_code_class"],
      "channel" => options["channel"],
      "tag" => options["tag"],
      "endpoint_id" => options["endpoint_id"],
      "before" => options["before"],
      "after" => options["after"],
      "with_content" => options["with_content"],
      "event_types" => options["event_types"]
    }
  )
  ListResponseMessageAttemptOut.deserialize(res)
end

#resend(app_id, msg_id, endpoint_id, options = {}) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
# File 'lib/svix/api/message_attempt.rb', line 104

def resend(app_id, msg_id, endpoint_id, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "POST",
    "/api/v1/app/#{app_id}/msg/#{msg_id}/endpoint/#{endpoint_id}/resend",
    headers: {
      "idempotency-key" => options["idempotency-key"]
    }
  )
  EmptyResponse.deserialize(res)
end