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



91
92
93
94
95
96
# File 'lib/svix/api/message_attempt.rb', line 91

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, options = {}) ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/svix/api/message_attempt.rb', line 79

def get(app_id, msg_id, attempt_id, options = {})
  options = options.transform_keys(&:to_s)
  res = @client.execute_request(
    "GET",
    "/api/v1/app/#{app_id}/msg/#{msg_id}/attempt/#{attempt_id}",
    query_params: {
      "expanded_statuses" => options["expanded_statuses"]
    }
  )
  MessageAttemptOut.deserialize(res)
end

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



98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/svix/api/message_attempt.rb', line 98

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



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

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"],
      "expanded_statuses" => options["expanded_statuses"],
      "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
33
# 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"],
      "expanded_statuses" => options["expanded_statuses"],
      "event_types" => options["event_types"]
    }
  )
  ListResponseMessageAttemptOut.deserialize(res)
end

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



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

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"],
      "expanded_statuses" => options["expanded_statuses"],
      "event_types" => options["event_types"]
    }
  )
  ListResponseMessageAttemptOut.deserialize(res)
end

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



111
112
113
114
115
116
117
118
119
120
121
# File 'lib/svix/api/message_attempt.rb', line 111

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