Class: Platforms::Yammer::Api::Subscriptions

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

Overview

Yammer’s subscription (following) management

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

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

Unsubscribe from a user or topic. This usually involves setting target_id and target_type in the options hash.

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



45
46
47
# File 'lib/platforms/yammer/api/subscriptions.rb', line 45

def delete options={}, headers={}
  @connection.delete "subscriptions.json", options, headers
end

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

Subscribe to a user or topic. This usually involves setting target_id and target_type in the JSON body.

Parameters:

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

    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



35
36
37
# File 'lib/platforms/yammer/api/subscriptions.rb', line 35

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

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

Check if the current user is subscribed to (following) a topic (hashtag)

Parameters:

  • id (#to_s)

    The ID of the User

  • 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



25
26
27
# File 'lib/platforms/yammer/api/subscriptions.rb', line 25

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

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

Check if the current user is subscribed to (following) another user

Parameters:

  • id (#to_s)

    The ID of the User

  • 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



15
16
17
# File 'lib/platforms/yammer/api/subscriptions.rb', line 15

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