Class: Courier::Resources::Messages
- Inherits:
-
Object
- Object
- Courier::Resources::Messages
- Defined in:
- lib/courier/resources/messages.rb,
sig/courier/resources/messages.rbs
Instance Method Summary collapse
-
#cancel(message_id, request_options: {}) ⇒ Courier::Models::MessageDetails
Cancel a message that is currently in the process of being delivered.
-
#content(message_id, request_options: {}) ⇒ Courier::Models::MessageContentResponse
Some parameter documentations has been truncated, see Models::MessageContentParams for more details.
-
#history(message_id, type: nil, request_options: {}) ⇒ Courier::Models::MessageHistoryResponse
Fetch the array of events of a message you've previously sent.
-
#initialize(client:) ⇒ Messages
constructor
private
A new instance of Messages.
-
#list(archived: nil, cursor: nil, enqueued_after: nil, event: nil, list: nil, message_id: nil, notification: nil, provider: nil, recipient: nil, status: nil, tag: nil, tags: nil, tenant_id: nil, trace_id: nil, request_options: {}) ⇒ Courier::Models::MessageListResponse
Some parameter documentations has been truncated, see Models::MessageListParams for more details.
-
#retrieve(message_id, request_options: {}) ⇒ Courier::Models::MessageRetrieveResponse
Some parameter documentations has been truncated, see Models::MessageRetrieveParams for more details.
Constructor Details
#initialize(client:) ⇒ Messages
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Messages.
156 157 158 |
# File 'lib/courier/resources/messages.rb', line 156 def initialize(client:) @client = client end |
Instance Method Details
#cancel(message_id, request_options: {}) ⇒ Courier::Models::MessageDetails
Cancel a message that is currently in the process of being delivered. A
well-formatted API call to the cancel message API will return either 200
status code for a successful cancellation or 409 status code for an
unsuccessful cancellation. Both cases will include the actual message record in
the response body (see details below).
96 97 98 99 100 101 102 103 |
# File 'lib/courier/resources/messages.rb', line 96 def cancel(, params = {}) @client.request( method: :post, path: ["messages/%1$s/cancel", ], model: Courier::MessageDetails, options: params[:request_options] ) end |
#content(message_id, request_options: {}) ⇒ Courier::Models::MessageContentResponse
Some parameter documentations has been truncated, see Models::MessageContentParams for more details.
Get message content
119 120 121 122 123 124 125 126 |
# File 'lib/courier/resources/messages.rb', line 119 def content(, params = {}) @client.request( method: :get, path: ["messages/%1$s/output", ], model: Courier::Models::MessageContentResponse, options: params[:request_options] ) end |
#history(message_id, type: nil, request_options: {}) ⇒ Courier::Models::MessageHistoryResponse
Fetch the array of events of a message you've previously sent.
141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/courier/resources/messages.rb', line 141 def history(, params = {}) parsed, = Courier::MessageHistoryParams.dump_request(params) query = Courier::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["messages/%1$s/history", ], query: query, model: Courier::Models::MessageHistoryResponse, options: ) end |
#list(archived: nil, cursor: nil, enqueued_after: nil, event: nil, list: nil, message_id: nil, notification: nil, provider: nil, recipient: nil, status: nil, tag: nil, tags: nil, tenant_id: nil, trace_id: nil, request_options: {}) ⇒ Courier::Models::MessageListResponse
Some parameter documentations has been truncated, see Models::MessageListParams for more details.
Fetch the statuses of messages you've previously sent.
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/courier/resources/messages.rb', line 69 def list(params = {}) parsed, = Courier::MessageListParams.dump_request(params) query = Courier::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "messages", query: query.transform_keys(message_id: "messageId", trace_id: "traceId"), model: Courier::Models::MessageListResponse, options: ) end |
#retrieve(message_id, request_options: {}) ⇒ Courier::Models::MessageRetrieveResponse
Some parameter documentations has been truncated, see Models::MessageRetrieveParams for more details.
Fetch the status of a message you've previously sent.
20 21 22 23 24 25 26 27 |
# File 'lib/courier/resources/messages.rb', line 20 def retrieve(, params = {}) @client.request( method: :get, path: ["messages/%1$s", ], model: Courier::Models::MessageRetrieveResponse, options: params[:request_options] ) end |