Class: OpenSocial::FetchGroupsRequest

Inherits:
Request
  • Object
show all
Defined in:
lib/opensocial/group.rb

Constant Summary collapse

SERVICE =

Defines the service fragment for use in constructing the request URL or JSON

'groups'

Instance Method Summary collapse

Constructor Details

#initialize(connection = nil, guid = '@me') ⇒ FetchGroupsRequest

Initializes a request to fetch groups for the specified user, or the default (@me). A valid Connection is not necessary if the request is to be used as part of an RpcRequest.



65
66
67
# File 'lib/opensocial/group.rb', line 65

def initialize(connection = nil, guid = '@me')
  super
end

Instance Method Details

#sendObject

Sends the request, passing in the appropriate SERVICE and specified instance variables.



71
72
73
74
75
76
77
78
79
80
81
# File 'lib/opensocial/group.rb', line 71

def send
  json = send_request(SERVICE, @guid)
  
  groups = Collection.new
  for entry in json['entry']
    group = Group.new(entry)
    groups[group.id] = group
  end
  
  return groups
end