Module: Remind101::Client::Messages

Extended by:
Rescuable
Included in:
Remind101::Client
Defined in:
lib/remind101/client/messages.rb

Instance Method Summary collapse

Methods included from Rescuable

def_rescued

Instance Method Details

#create_message!(hash) ⇒ Object Also known as: send_message!

Public: Creates a new message.

Also aliased as ‘#send_message!`.

Examples

remind101.create_message! body: 'Hello World!', group_ids: [1234]
# => { :id => 4321, :body => "Hello World!", :group_ids => [1234], ... }

Returns the created message.



26
27
28
# File 'lib/remind101/client/messages.rb', line 26

def create_message!(hash)
  api_post('/messages', message: hash).body
end

#destroy_message!(message_id) ⇒ Object Also known as: cancel_message!

Public: Destroy an existing message.

Also aliased as ‘cancel_message!`.

Examples

remind101.destroy_message! 4321
# => { :id => 4321, :body => "Hello World!", :group_ids => [1234], ... }

Returns the destroyed message.



43
44
45
# File 'lib/remind101/client/messages.rb', line 43

def destroy_message!(message_id)
  api_delete("/messages/#{message_id}").body
end

#messagesObject

Public: Returns all messages for the current user.

Examples

remind101.messages
# => [{ ... }]

Returns an Array of all messages.



12
13
14
# File 'lib/remind101/client/messages.rb', line 12

def messages
  api_get('/messages').body
end