Class: Platforms::Yammer::Api::Messages

Inherits:
Base
  • Object
show all
Defined in:
lib/platforms/yammer/api/messages.rb

Overview

Messaging endpoints for the Yammer API

Author:

  • Benjamin Elias

Since:

  • 0.1.0

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Platforms::Yammer::Api::Base

Instance Method Details

#about_topic(topic_id, options = {}, headers = {}) ⇒ Faraday::Response

Messages about a topic

Parameters:

  • topic_id (#to_s)

    The topic to filter by

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



108
109
110
# File 'lib/platforms/yammer/api/messages.rb', line 108

def about_topic topic_id, options={}, headers={}
  @connection.get "messages/about_topic/#{topic_id}.json", options, headers
end

#algo(options = {}, headers = {}) ⇒ Faraday::Response

Get Messages through the algorithmic feed

Parameters:

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



23
24
25
# File 'lib/platforms/yammer/api/messages.rb', line 23

def algo options={}, headers={}
  @connection.get "messages/algo.json", options, headers
end

#delete(message_id, options = nil, headers = {}) ⇒ Faraday::Response

Delete a message

Parameters:

  • message_id (#to_s)

    The ID of the message to delete

  • options (Hash) (defaults to: nil)

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



157
158
159
# File 'lib/platforms/yammer/api/messages.rb', line 157

def delete message_id, options=nil, headers={}
  @connection.delete "messages/#{message_id}.json", options, headers
end

#email(message_id, body = nil, headers = {}) ⇒ Faraday::Response

E-mail a copy of the message to the current user

Parameters:

  • message_id (#to_s)

    The ID of the message to delete

  • body (#to_s) (defaults to: nil)

    Body of the request (should not need to be used)

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



127
128
129
# File 'lib/platforms/yammer/api/messages.rb', line 127

def email message_id, body=nil, headers={}
  @connection.post "messages/email.json?message_id=#{message_id}", body, headers
end

#following(options = {}, headers = {}) ⇒ Faraday::Response

Get messages in ‘following’ feed

Parameters:

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



41
42
43
# File 'lib/platforms/yammer/api/messages.rb', line 41

def following options={}, headers={}
  @connection.get "messages/following.json", options, headers
end

#get(options = {}, headers = {}) ⇒ Faraday::Response

Get all messages

Parameters:

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



32
33
34
# File 'lib/platforms/yammer/api/messages.rb', line 32

def get options={}, headers={}
  @connection.get "messages.json", options, headers
end

#in_group(group_id, options = {}, headers = {}) ⇒ Faraday::Response

Messages in a group

Parameters:

  • group_id (#to_s)

    The group ID

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



88
89
90
# File 'lib/platforms/yammer/api/messages.rb', line 88

def in_group group_id, options={}, headers={}
  @connection.get "messages/in_group/#{group_id}.json", options, headers
end

#in_thread(thread_id, options = {}, headers = {}) ⇒ Faraday::Response

Messages in a thread

Parameters:

  • thread_id (#to_s)

    The thread ID

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



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

def in_thread thread_id, options={}, headers={}
  @connection.get "messages/in_thread/#{thread_id}.json", options, headers
end

#like(message_id, body = nil, headers = {}) ⇒ Faraday::Response

Like a message

Parameters:

  • message_id (#to_s)

    The ID of the message to delete

  • body (#to_s) (defaults to: nil)

    Body of the request (should not need to be used)

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



137
138
139
# File 'lib/platforms/yammer/api/messages.rb', line 137

def like message_id, body=nil, headers={}
  @connection.post "messages/liked_by/current.json?message_id=#{message_id}", body, headers
end

#my_feed(options = {}, headers = {}) ⇒ Faraday::Response

Get Messages from my feed

Parameters:

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



14
15
16
# File 'lib/platforms/yammer/api/messages.rb', line 14

def my_feed options={}, headers={}
  @connection.get "messages/my_feed.json", options, headers
end

#open_graph_objects(id, options = {}, headers = {}) ⇒ Faraday::Response

Messages about an Open Graph object

Parameters:

  • id (#to_s)

    The Open Graph ID to filter by

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



98
99
100
# File 'lib/platforms/yammer/api/messages.rb', line 98

def open_graph_objects id, options={}, headers={}
  @connection.get "messages/open_graph_objects/#{id}.json", options, headers
end

#post(body, headers = {}) ⇒ Faraday::Response

Post a new message

Parameters:

  • body (#to_s)

    Body of the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



117
118
119
# File 'lib/platforms/yammer/api/messages.rb', line 117

def post body, headers={}
  @connection.post "messages.json", body, headers
end

#private(options = {}, headers = {}) ⇒ Faraday::Response

Private messages

Parameters:

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



59
60
61
# File 'lib/platforms/yammer/api/messages.rb', line 59

def private options={}, headers={}
  @connection.get "messages/private.json", options, headers
end

#received(options = {}, headers = {}) ⇒ Faraday::Response

Received messages

Parameters:

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



68
69
70
# File 'lib/platforms/yammer/api/messages.rb', line 68

def received options={}, headers={}
  @connection.get "messages/received.json", options, headers
end

#sent(options = {}, headers = {}) ⇒ Faraday::Response

Sent messages

Parameters:

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

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



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

def sent options={}, headers={}
  @connection.get "messages/sent.json", options, headers
end

#unlike(message_id, options = nil, headers = {}) ⇒ Faraday::Response

Unlike a message

Parameters:

  • message_id (#to_s)

    The ID of the message to delete

  • options (Hash) (defaults to: nil)

    Options for the request

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

    Additional headers to send with the request

Returns:

  • (Faraday::Response)

    the API response

See Also:

Since:

  • 0.1.0



147
148
149
# File 'lib/platforms/yammer/api/messages.rb', line 147

def unlike message_id, options=nil, headers={}
  @connection.delete "messages/liked_by/current.json?message_id=#{message_id}", options, headers
end