Module: YammerApi::Api::Messages

Includes:
Helper
Included in:
Client
Defined in:
lib/yammer_api/api/messages.rb

Instance Method Summary collapse

Methods included from Helper

#params

Instance Method Details

#delete_message(id, options = {}) ⇒ Object

Deletes a specified message from the authenticating user

Parameters:

  • id (Integer)

    The ID of your message.

See Also:



50
51
52
53
# File 'lib/yammer_api/api/messages.rb', line 50

def delete_message(id, options={})
  path = "/messages/#{id}"
  delete(path, options)
end

#send_direct_message(message, user_id, options = {}) ⇒ YammerApi::Post

Creates a new direct message from the authenticating user to selected user

Parameters:

  • body (String)

    The text of your message.

  • user_id (String)

    The id of message recipient.

Returns:

See Also:



37
38
39
40
41
# File 'lib/yammer_api/api/messages.rb', line 37

def send_direct_message(message, user_id, options={})
  path = "/messages.json"
  response = post(path, {:body => message, :direct_to_id => user_id}.merge(options).to_json)
  parse_post(response)
end

#update(message, options = {}) ⇒ YammerApi::Post

Note:

A status update with text identical to the authenticating user’s current status will be ignored to prevent duplicates.

Creates a new message from the authenticating user

Parameters:

  • body (String)

    The text of your message.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :group_id (Integer)

    The ID of the group in which this message belongs.

  • :replied_to_id (Integer)

    The message ID this message is in reply to, if applicable.

  • :direct_to_id (Integer)

    the ID of the user to which this message will be sent as a private message.

  • :broadcast (String)

    If ‘true` this message should be broadcasted to all users. *Must be an admin*

  • :topic*n* (Integer)

    Topics to apply to the message. Can use topic1 through topic20.

Returns:

See Also:



21
22
23
24
25
# File 'lib/yammer_api/api/messages.rb', line 21

def update(message, options={})
  path = "/messages.json"
  response = post(path, {:body => message}.merge(options).to_json)
  parse_post(response)
end