Method: Databasedotcom::Chatter::User.groups

Defined in:
lib/databasedotcom/chatter/user.rb

.groups(client, subject_id = "me") ⇒ Object

Returns a Collection of Group objects that represent all the groups that the User identified by subject_id is a part of.



35
36
37
38
39
40
41
42
43
44
# File 'lib/databasedotcom/chatter/user.rb', line 35

def self.groups(client, subject_id="me")
  url = "/services/data/v#{client.version}/chatter/users/#{subject_id}/groups"
  result = client.http_get(url)
  response = JSON.parse(result.body)
  collection = Databasedotcom::Collection.new(client, response["total"], response["nextPageUrl"], response["previousPageUrl"], response["currentPageUrl"])
  response["groups"].each do |group|
    collection << Group.new(client, group)
  end
  collection
end