Module: Yammer::Client::Feed

Included in:
Yammer::Client
Defined in:
lib/yammer/client/feed.rb

Overview

Defines methods related to feeds (or viewable messages)

Instance Method Summary collapse

Instance Method Details

#about_topic(id, options = {}) ⇒ Hashie::Mash

Note:

Important to note that the XML format returns a different structure than the JSON one. So we only support the JSON format for this method.

Messages that have the topic with given ID. Corresponds to the messages on a topic's page on the website.

Examples:

Return the messages in topic with ID 1234567

Yammer.about_topic(1234567)

Parameters:

  • id (Integer)

    A topic ID

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

    A customizable set of options.

Options Hash (options):

  • :older_than (Integer)

    Returns only messages older than the message ID specified. This is useful for paginating messages.

  • :newer_than (Integer)

    Return only messages newer than the message ID specified. This should always be used when polling for new messages.

  • :threaded (String)

    Accepts true or extended. When true, will only return the first message in each thread. This parameter is intended for applications which display message threads collapsed. threaded=extended will return the thread starter messages in order of most recently active as well as the two most recent messages, as they are viewed in the default view on our website.

  • :limit (Integer)

    Return only the specified number of messages. Works for threaded=true and threaded=extended.

Returns:

  • (Hashie::Mash)

See Also:

Supported formats:

  • :json

Requires Authentication:

  • true

Rate Limited:

  • true



138
139
140
# File 'lib/yammer/client/feed.rb', line 138

def about_topic(id, options={})
  response = get("messages/about_topic/#{id}", options, :json)
end

#direct_messages(options = {}) ⇒ Hashie::Mash

Note:

Important to note that the XML format returns a different structure than the JSON one. So we only support the JSON format for this method.

Private Messages (aka Direct Messages) for the logged-in user. Corresponds to the "Direct Messages" section on the website.

Examples:

Return the 20 most recent private messages

Yammer.direct_messages

Parameters:

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

    A customizable set of options.

Options Hash (options):

  • :older_than (Integer)

    Returns only messages older than the message ID specified. This is useful for paginating messages.

  • :newer_than (Integer)

    Return only messages newer than the message ID specified. This should always be used when polling for new messages.

  • :threaded (String)

    Accepts true or extended. When true, will only return the first message in each thread. This parameter is intended for applications which display message threads collapsed. threaded=extended will return the thread starter messages in order of most recently active as well as the two most recent messages, as they are viewed in the default view on our website.

  • :limit (Integer)

    Return only the specified number of messages. Works for threaded=true and threaded=extended.

Returns:

  • (Hashie::Mash)

See Also:

Supported formats:

  • :json

Requires Authentication:

  • true

Rate Limited:

  • true



79
80
81
# File 'lib/yammer/client/feed.rb', line 79

def direct_messages(options={})
  response = get('messages/private', options, :json)
end

#messages(options = {}) ⇒ Hashie::Mash

Note:

Developers should note that a strict rate limit is applied to all API requests, so clients should never poll for new messages more frequently than every 30 seconds to ensure that the user is still able to use the API for posting messages, etc.

Returns the 20 most recent messages in this network. Corresponds to the "Company Feed" tab on the website.

Examples:

Return the 20 most recent messages in this network.

Yammer.messages

Parameters:

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

    A customizable set of options.

Options Hash (options):

  • :older_than (Integer)

    Returns only messages older than the message ID specified. This is useful for paginating messages.

  • :newer_than (Integer)

    Return only messages newer than the message ID specified. This should always be used when polling for new messages.

  • :threaded (String)

    Accepts true or extended. When true, will only return the first message in each thread. This parameter is intended for applications which display message threads collapsed. threaded=extended will return the thread starter messages in order of most recently active as well as the two most recent messages, as they are viewed in the default view on our website.

  • :limit (Integer)

    Return only the specified number of messages. Works for threaded=true and threaded=extended.

Returns:

  • (Hashie::Mash)

See Also:

Supported formats:

  • :json, :xml

Requires Authentication:

  • true

Rate Limited:

  • true



20
21
22
23
# File 'lib/yammer/client/feed.rb', line 20

def messages(options={})
  response = get('messages', options)
  format.to_s.downcase == 'xml' ? response['response']['messages'] : response
end

#messages_from(id, options = {}) ⇒ Hashie::Mash

Note:

Important to note that the XML format returns a different structure than the JSON one. So we only support the JSON format for this method.

Messages sent by the user with the given ID. Corresponds to the messages on a user profile page on the website.

Examples:

Return the 20 most recent messages from the user

Yammer.messages_from("bruno")

Parameters:

  • id (Integer, String)

    A user ID or screen name.

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

    A customizable set of options.

Options Hash (options):

  • :older_than (Integer)

    Returns only messages older than the message ID specified. This is useful for paginating messages.

  • :newer_than (Integer)

    Return only messages newer than the message ID specified. This should always be used when polling for new messages.

  • :threaded (String)

    Accepts true or extended. When true, will only return the first message in each thread. This parameter is intended for applications which display message threads collapsed. threaded=extended will return the thread starter messages in order of most recently active as well as the two most recent messages, as they are viewed in the default view on our website.

  • :limit (Integer)

    Return only the specified number of messages. Works for threaded=true and threaded=extended.

Returns:

  • (Hashie::Mash)

See Also:

Supported formats:

  • :json

Requires Authentication:

  • true

Rate Limited:

  • true



118
119
120
# File 'lib/yammer/client/feed.rb', line 118

def messages_from(id, options={})
  response = get("messages/from_user/#{id}", options, :json)
end

#messages_received(options = {}) ⇒ Hashie::Mash

Note:

Important to note that the XML format returns a different structure than the JSON one. So we only support the JSON format for this method.

Messages received by the logged-in user. Corresponds to the "Received" tab on the website.

Examples:

Return the 20 most recent received messages

Yammer.messages_received

Parameters:

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

    A customizable set of options.

Options Hash (options):

  • :older_than (Integer)

    Returns only messages older than the message ID specified. This is useful for paginating messages.

  • :newer_than (Integer)

    Return only messages newer than the message ID specified. This should always be used when polling for new messages.

  • :threaded (String)

    Accepts true or extended. When true, will only return the first message in each thread. This parameter is intended for applications which display message threads collapsed. threaded=extended will return the thread starter messages in order of most recently active as well as the two most recent messages, as they are viewed in the default view on our website.

  • :limit (Integer)

    Return only the specified number of messages. Works for threaded=true and threaded=extended.

Returns:

  • (Hashie::Mash)

See Also:

Supported formats:

  • :json

Requires Authentication:

  • true

Rate Limited:

  • true



60
61
62
# File 'lib/yammer/client/feed.rb', line 60

def messages_received(options={})
  response = get('messages/received', options, :json)
end

#messages_sent(options = {}) ⇒ Hashie::Mash

Note:

Important to note that the XML format returns a different structure than the JSON one. So we only support the JSON format for this method.

Returns the 20 sent messages by the current logged in user. Alias for /api/v1/messages/from_user/logged-in_user_id.format. Corresponds to the "Sent" tab on the website.

Examples:

Return the 20 most recent sent messages

Yammer.messages_sent

Parameters:

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

    A customizable set of options.

Options Hash (options):

  • :older_than (Integer)

    Returns only messages older than the message ID specified. This is useful for paginating messages.

  • :newer_than (Integer)

    Return only messages newer than the message ID specified. This should always be used when polling for new messages.

  • :threaded (String)

    Accepts true or extended. When true, will only return the first message in each thread. This parameter is intended for applications which display message threads collapsed. threaded=extended will return the thread starter messages in order of most recently active as well as the two most recent messages, as they are viewed in the default view on our website.

  • :limit (Integer)

    Return only the specified number of messages. Works for threaded=true and threaded=extended.

Returns:

  • (Hashie::Mash)

See Also:

Supported formats:

  • :json

Requires Authentication:

  • true

Rate Limited:

  • true



41
42
43
# File 'lib/yammer/client/feed.rb', line 41

def messages_sent(options={})
  response = get('messages/sent', options, :json)
end

#my_feed(options = {}) ⇒ Hashie::Mash

Note:

Important to note that the XML format returns a different structure than the JSON one. So we only support the JSON format for this method.

Messages followed by the logged-in user. Corresponds to the "My Feed" tab on the website.

Examples:

Return the 20 most recent received messages in my feed

Yammer.my_feed

Parameters:

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

    A customizable set of options.

Options Hash (options):

  • :older_than (Integer)

    Returns only messages older than the message ID specified. This is useful for paginating messages.

  • :newer_than (Integer)

    Return only messages newer than the message ID specified. This should always be used when polling for new messages.

  • :threaded (String)

    Accepts true or extended. When true, will only return the first message in each thread. This parameter is intended for applications which display message threads collapsed. threaded=extended will return the thread starter messages in order of most recently active as well as the two most recent messages, as they are viewed in the default view on our website.

  • :limit (Integer)

    Return only the specified number of messages. Works for threaded=true and threaded=extended.

Returns:

  • (Hashie::Mash)

See Also:

Supported formats:

  • :json

Requires Authentication:

  • true

Rate Limited:

  • true



98
99
100
# File 'lib/yammer/client/feed.rb', line 98

def my_feed(options={})
  response = get('messages/following', options, :json)
end

#thread(id, options = {}) ⇒ Hashie::Mash

Note:

Does not accept the threaded parameter.

Messages in the thread with the given ID. Corresponds to the page you'd see when clicking on "in reply to" on the website.

Examples:

Return the messages in the thread with ID 1234567

Yammer.thread(1234567)

Parameters:

  • id (Integer)

    A thread ID

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

    A customizable set of options.

Options Hash (options):

  • :older_than (Integer)

    Returns only messages older than the message ID specified. This is useful for paginating messages.

  • :newer_than (Integer)

    Return only messages newer than the message ID specified. This should always be used when polling for new messages.

  • :limit (Integer)

    Return only the specified number of messages. Works for threaded=true and threaded=extended.

Returns:

  • (Hashie::Mash)

See Also:

Supported formats:

  • :json

Requires Authentication:

  • true

Rate Limited:

  • true



157
158
159
160
# File 'lib/yammer/client/feed.rb', line 157

def thread(id, options={})
  response = get("messages/in_thread/#{id}", options)
  format.to_s.downcase == 'xml' ? response['response']['messages'] : response
end