Class: Databasedotcom::Chatter::FeedItem

Inherits:
Record
  • Object
show all
Defined in:
lib/databasedotcom/chatter/feed_item.rb

Overview

An item in a Feed.

Instance Attribute Summary

Attributes inherited from Record

#client, #id, #name, #raw_hash, #type, #url

Instance Method Summary collapse

Methods inherited from Record

all, delete, #delete, find, #initialize, #parent, #reload, resource_name, search, #user

Constructor Details

This class inherits a constructor from Databasedotcom::Chatter::Record

Instance Method Details

#comment(text) ⇒ Object

Post a Comment on this FeedItem with content text.



28
29
30
31
# File 'lib/databasedotcom/chatter/feed_item.rb', line 28

def comment(text)
  result = self.client.http_post("/services/data/v#{self.client.version}/chatter/feed-items/#{self.id}/comments", nil, :text => text)
  Comment.new(self.client, result.body)
end

#commentsObject

Returns a Collection of comments that were posted on this FeedItem instance.



10
11
12
13
# File 'lib/databasedotcom/chatter/feed_item.rb', line 10

def comments
  collection = Databasedotcom::Collection.new(self.client, self.raw_hash["comments"]["total"], self.raw_hash["comments"]["nextPageUrl"], nil, self.raw_hash["comments"]["currentPageUrl"])
  collection.concat(self.raw_hash["comments"]["comments"])
end

#likeObject

Like this FeedItem.



22
23
24
25
# File 'lib/databasedotcom/chatter/feed_item.rb', line 22

def like
  result = self.client.http_post("/services/data/v#{self.client.version}/chatter/feed-items/#{self.id}/likes")
  Like.new(self.client, result.body)
end

#likesObject

Returns a Collection of likes for this FeedItem instance.



16
17
18
19
# File 'lib/databasedotcom/chatter/feed_item.rb', line 16

def likes
  collection = Databasedotcom::Collection.new(self.client, self.raw_hash["likes"]["total"], self.raw_hash["likes"]["nextPageUrl"], self.raw_hash["likes"]["previousPageUrl"], self.raw_hash["likes"]["currentPageUrl"])
  collection.concat(self.raw_hash["likes"]["likes"])
end