Module: Yammer::Api::Message

Included in:
Client
Defined in:
lib/yammer/api/message.rb

Instance Method Summary collapse

Instance Method Details

#all_messages(opts = {}) ⇒ Yammer::ApiResponse

Examples:

Fetch a list of messages from the company feed

msgs = Yammer.all_messages

Parameters:

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

    the options to fetch the messages with

Options Hash (opts):

  • :newer_than (Integer)

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context

Rest API path:

  • /api/v1/messages



64
65
66
# File 'lib/yammer/api/message.rb', line 64

def all_messages(opts={})
  get("/api/v1/messages", opts)
end

#create_message(body, opts = {}) ⇒ Yammer::ApiResponse

Examples:

Create a new message

msg1 = Yammer.create_message('what are you workings on?')

msg2 = Yammer.create_message('building a yammer client', :replied_to_id => msg.id)

Parameters:

  • body (String)

    Message body

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

    the options to create a message with

Options Hash (opts):

  • :cc (Integer)
  • :replied_to_id (Integer)
  • :group_id (Integer)
  • :direct_to_user_ids (Array<Integer>)
  • :pending_attachment_ids (Array<Integer>)

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context

Rest API path:

  • /api/v1/messages



22
23
24
25
# File 'lib/yammer/api/message.rb', line 22

def create_message(body, opts={})
  opts[:body] = body
  post("/api/v1/messages", opts)
end

#delete_message(id) ⇒ Yammer::ApiResponse

Examples:

Delete an existing message

result = Yammer.delete_message(1)

Parameters:

  • id (Integer)

    the thread ID

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context

Rest API path:

  • /api/v1/messages



37
38
39
# File 'lib/yammer/api/message.rb', line 37

def delete_message(id)
  delete("/api/v1/messages/#{id}")
end

#followed_messages(opts = {}) ⇒ Yammer::ApiResponse

Examples:

Fetch a list of messages being followed by authenitcated user

msgs = Yammer.followed_messages

Parameters:

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

    the options to fetch the messages with

Options Hash (opts):

  • :newer_than (Integer)

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context

Rest API path:

  • /api/v1/messages



120
121
122
# File 'lib/yammer/api/message.rb', line 120

def followed_messages(opts={})
  get("/api/v1/messages/following", opts)
end

#get_message(id) ⇒ Yammer::ApiResponse

Examples:

Fetch an existing message

msg = Yammer.get_message(3)

Parameters:

  • id (Integer)

    the ID of the message to be fetched

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context

Rest API path:

  • /api/v1/messages



50
51
52
# File 'lib/yammer/api/message.rb', line 50

def get_message(id)
  get("/api/v1/messages/#{id}")
end

#messages_about_topic(id, opts = {}) ⇒ Yammer::ApiResponse

Examples:

Fetch messages that have been tagged with a given topic

msgs = Yammer.messages_about_topic(1)

Parameters:

  • id (Integer)

    the topic ID

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

    the options to fetch the messages with

Options Hash (opts):

  • :newer_than (Integer)

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context

Rest API path:

  • /api/v1/messages



150
151
152
# File 'lib/yammer/api/message.rb', line 150

def messages_about_topic(id, opts={})
  get("/api/v1/messages/about_topic/#{id}", opts)
end

#messages_for_open_graph_object(id) ⇒ Yammer::ApiResponse

Examples:

Fetch a list of messages in a given thread

msgs = Yammer.messages_for_open_graph_pbject(10)

Parameters:

  • id (Integer)

    the thread ID

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context

Rest API path:

  • /api/v1/messages/open_graph_objects



208
209
210
# File 'lib/yammer/api/message.rb', line 208

def messages_for_open_graph_object(id)
  get("/api/v1/messages/messages/open_graph_objects/#{id}")
end

#messages_from_user(id, opts = {}) ⇒ Yammer::ApiResponse

Examples:

Fetch a list of messages sent by a user in the authenticated user's network

msgs = Yammer.messages_from_user(8)

Parameters:

  • id (Integer)

    the ID of the user whose public messages we want to look at

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

    the options to fetch the messages with

Options Hash (opts):

  • :newer_than (Integer)

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context

Rest API path:

  • /api/v1/messages



135
136
137
# File 'lib/yammer/api/message.rb', line 135

def messages_from_user(id, opts={})
  get("/api/v1/messages/from_user/#{id}", opts)
end

#messages_in_group(id, opts = {}) ⇒ Yammer::ApiResponse

Examples:

Fetch a list of messages in a given group

msgs = Yammer.messages_in_group(38)

Parameters:

  • id (Integer)

    the ID of the group whose messages you wish to fetch

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

    the options to fetch the messages with

Options Hash (opts):

  • :newer_than (Integer)

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context

Rest API path:

  • /api/v1/messages



165
166
167
# File 'lib/yammer/api/message.rb', line 165

def messages_in_group(id, opts={})
  get("/api/v1/messages/in_group/#{id}", opts)
end

#messages_in_thread(id, opts = {}) ⇒ Yammer::ApiResponse

Examples:

Fetch a list of messages in a given thread

msgs = Yammer.messages_in_thread(10)

Parameters:

  • id (Integer)

    the thread ID

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

    the options to fetch the messages with

Options Hash (opts):

  • :newer_than (Integer)

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context

Rest API path:

  • /api/v1/messages



195
196
197
# File 'lib/yammer/api/message.rb', line 195

def messages_in_thread(id, opts={})
  get("/api/v1/messages/in_thread/#{id}", opts)
end

#messages_liked_by(id, opts = {}) ⇒ Yammer::ApiResponse

Examples:

Fetch a list of messages liked by a given user

msgs = Yammer.messages_liked_by(4)

Parameters:

  • id (Integer)

    the ID of the user for whom you wish to get a list of messages they have liked

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

    the options to fetch the messages with

Options Hash (opts):

  • :newer_than (Integer)

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context

Rest API path:

  • /api/v1/messages



180
181
182
# File 'lib/yammer/api/message.rb', line 180

def messages_liked_by(id, opts={})
  get("/api/v1/messages/liked_by/#{id}", opts)
end

#messages_received(opts = {}) ⇒ Yammer::ApiResponse

Examples:

Fetch list of messages sent to authenitcated user

msgs = Yammer.messages_received

Parameters:

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

    the options to fetch the messages with

Options Hash (opts):

  • :newer_than (Integer)

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context

Rest API path:

  • /api/v1/messages



92
93
94
# File 'lib/yammer/api/message.rb', line 92

def messages_received(opts={})
  get("/api/v1/messages/received", opts)
end

#messages_sent(opts = {}) ⇒ Yammer::ApiResponse

Examples:

Fetch list messages sent by authenticated user

msgs = Yammer.messages_sent

Parameters:

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

    the options to fetch the messages with

Options Hash (opts):

  • :newer_than (Integer)

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context

Rest API path:

  • /api/v1/messages



78
79
80
# File 'lib/yammer/api/message.rb', line 78

def messages_sent(opts={})
  get("/api/v1/messages/sent", opts)
end

#private_messages(opts = {}) ⇒ Yammer::ApiResponse

Examples:

Fetch a list of private messages sent to authenitcated user

msgs = Yammer.private_messages

Parameters:

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

    the options to fetch the messages with

Options Hash (opts):

  • :newer_than (Integer)

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context

Rest API path:

  • /api/v1/messages



106
107
108
# File 'lib/yammer/api/message.rb', line 106

def private_messages(opts={})
  get("/api/v1/messages/private", opts)
end