Class: Courier::Resources::Inbox::Messages

Inherits:
Object
  • Object
show all
Defined in:
lib/courier/resources/inbox/messages.rb,
sig/courier/resources/inbox/messages.rbs

Overview

Manage the messages in a user's in-app inbox.

Instance Method Summary collapse

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.

Parameters:



52
53
54
# File 'lib/courier/resources/inbox/messages.rb', line 52

def initialize(client:)
  @client = client
end

Instance Method Details

#delete(message_id, request_options: {}) ⇒ nil

Delete a user's inbox message. The message is removed from every inbox read (it stops appearing in the recipient's Inbox); it can be restored.

Parameters:

  • message_id (String)

    The message ID of the inbox message to delete.

  • request_options (Courier::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



20
21
22
23
24
25
26
27
# File 'lib/courier/resources/inbox/messages.rb', line 20

def delete(message_id, params = {})
  @client.request(
    method: :delete,
    path: ["inbox/messages/%1$s", message_id],
    model: NilClass,
    options: params[:request_options]
  )
end

#restore(message_id, request_options: {}) ⇒ nil

Restore a previously deleted inbox message.

Parameters:

  • message_id (String)

    The message ID of the inbox message to restore.

  • request_options (Courier::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



40
41
42
43
44
45
46
47
# File 'lib/courier/resources/inbox/messages.rb', line 40

def restore(message_id, params = {})
  @client.request(
    method: :put,
    path: ["inbox/messages/%1$s/restore", message_id],
    model: NilClass,
    options: params[:request_options]
  )
end