Module: Yammer::Api::OpenGraphObject

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

Instance Method Summary collapse

Instance Method Details

#create_open_graph_object(url, props = {}) ⇒ Yammer::ApiResponse

Yammer.create_open_graph_object('http://www.microsoft.com', { :site_name => 'Microsoft' :image => 'https://microsoft.com/global/images/test.jpg' })

Examples:

Create a new open graph object

Parameters:

  • url (String)

    The URL of the open graph object

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

    The properties of this open graph object

Options Hash (props):

  • :image (String)
  • :description (String)
  • :site_name (String)
  • :title (String)
  • :media_url (String)
  • :media_type (String)
  • :media_width (String)
  • :media_height (String)

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Rest API path:

  • /api/v1/open_graph_objects/

Authentication:

  • Requires user context



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

def create_open_graph_object(url, props={})
  post("/api/v1/open_graph_objects", { :url => url, :properties => props })
end

#follow_open_graph_object(id) ⇒ Yammer::ApiResponse

Subscribes the current user to the open graph object with the request id. => Yammer.follow_open_graph_object(8)

Examples:

Subscribe to open graph object

Parameters:

  • id (Integer)

    The ID of the open graph object

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Rest API path:

  • /api/v1/open_graph_objects/

Authentication:

  • Requires user context



56
57
58
# File 'lib/yammer/api/open_graph_object.rb', line 56

def follow_open_graph_object(id)
  post('/api/v1/subscriptions', :target_id => id, :target_type => 'OpenGraphObject')
end

#get_activity_stream_open_graph_objects(id) ⇒ Yammer::ApiResponse

Returns open graph objects in a user's activity stream

Examples:

Get open graph object in a given user's activity stream


Yammer.get_activity_stream_open_graph_objects?(3)

Parameters:

  • id (Integer)

    The ID of the users whose stream of open graph objects we want to fetch

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Rest API path:

  • /api/v1/streams/activities

Authentication:

  • Requires user context



87
88
89
# File 'lib/yammer/api/open_graph_object.rb', line 87

def get_activity_stream_open_graph_objects(id)
  get("/api/v1/streams/activities", :owner_type => 'open_graph_object', :owner_id => id)
end

#is_following_open_graph_object?(id) ⇒ Yammer::ApiResponse

Determines if the current user follows an open graph object => Yammer.following_open_graph_object?(89)

Examples:

Verify to open graph object

Parameters:

  • id (Integer)

    The ID of the open graph object

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Rest API path:

  • /api/v1/open_graph_objects/

Authentication:

  • Requires user context



71
72
73
# File 'lib/yammer/api/open_graph_object.rb', line 71

def is_following_open_graph_object?(id)
  get("/api/v1/subscriptions/to_open_graph_object/#{id}")
end