Class: Trycourier::Resources::Messages
- Inherits:
-
Object
- Object
- Trycourier::Resources::Messages
- Defined in:
- lib/trycourier/resources/messages.rb
Instance Method Summary collapse
-
#cancel(message_id, request_options: {}) ⇒ Trycourier::Models::MessageDetails
Cancel a message that is currently in the process of being delivered.
-
#content(message_id, request_options: {}) ⇒ Trycourier::Models::MessageContentResponse
Some parameter documentations has been truncated, see Models::MessageContentParams for more details.
-
#history(message_id, type: nil, request_options: {}) ⇒ Trycourier::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: {}) ⇒ Trycourier::Models::MessageListResponse
Some parameter documentations has been truncated, see Models::MessageListParams for more details.
-
#retrieve(message_id, request_options: {}) ⇒ Trycourier::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.
154 155 156 |
# File 'lib/trycourier/resources/messages.rb', line 154 def initialize(client:) @client = client end |
Instance Method Details
#cancel(message_id, request_options: {}) ⇒ Trycourier::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).
95 96 97 98 99 100 101 102 |
# File 'lib/trycourier/resources/messages.rb', line 95 def cancel(, params = {}) @client.request( method: :post, path: ["messages/%1$s/cancel", ], model: Trycourier::MessageDetails, options: params[:request_options] ) end |
#content(message_id, request_options: {}) ⇒ Trycourier::Models::MessageContentResponse
Some parameter documentations has been truncated, see Models::MessageContentParams for more details.
Get message content
118 119 120 121 122 123 124 125 |
# File 'lib/trycourier/resources/messages.rb', line 118 def content(, params = {}) @client.request( method: :get, path: ["messages/%1$s/output", ], model: Trycourier::Models::MessageContentResponse, options: params[:request_options] ) end |
#history(message_id, type: nil, request_options: {}) ⇒ Trycourier::Models::MessageHistoryResponse
Fetch the array of events of a message you’ve previously sent.
140 141 142 143 144 145 146 147 148 149 |
# File 'lib/trycourier/resources/messages.rb', line 140 def history(, params = {}) parsed, = Trycourier::MessageHistoryParams.dump_request(params) @client.request( method: :get, path: ["messages/%1$s/history", ], query: parsed, model: Trycourier::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: {}) ⇒ Trycourier::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 |
# File 'lib/trycourier/resources/messages.rb', line 69 def list(params = {}) parsed, = Trycourier::MessageListParams.dump_request(params) @client.request( method: :get, path: "messages", query: parsed.transform_keys(message_id: "messageId", trace_id: "traceId"), model: Trycourier::Models::MessageListResponse, options: ) end |
#retrieve(message_id, request_options: {}) ⇒ Trycourier::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/trycourier/resources/messages.rb', line 20 def retrieve(, params = {}) @client.request( method: :get, path: ["messages/%1$s", ], model: Trycourier::Models::MessageRetrieveResponse, options: params[:request_options] ) end |