lib/google_apps/transport.rb in google_apps-0.4.9.2 vs lib/google_apps/transport.rb in google_apps-0.4.9.9

- old
+ new

@@ -182,18 +182,31 @@ def get_all(type, options = {}) @feeds, page = [], 0 type = normalize_type type options[:limit] ? limit = options[:limit] : limit = 1000000 - options[:start] ? get(instance_variable_get("@#{type}") + "?#{start_query(type)}=#{options[:start]}", :feed) : get(instance_variable_get("@#{type}"), :feed) + options[:start] ? get(instance_variable_get("@#{type}") + "#{options[:extra]}" + "?#{start_query(type)}=#{options[:start]}", :feed) : get(instance_variable_get("@#{type}") + "#{options[:extra]}", :feed) fetch_feed(page, limit, :feed) - @response + #@response + return_all end + # Retrieves the members of the requested group. + # + # @param [String] group_id the Group ID in the Google Apps Environment + # + # @visibility public + # @return + def get_members_of(group_id, options = {}) + options[:extra] = "/#{group_id}/member" + get_all :groups, options + end + + # add_member_to adds a member to a group in the domain. # It takes a group_id and a GoogleApps::Atom::GroupMember # document as arguments. # # add_member_to 'test', document @@ -369,9 +382,21 @@ # error_response? checks to see if Google Responded with a success # code. def success_response? SUCCESS_CODES.include?(@response.code.to_i) + end + + + # + # Takes all the items in each feed and puts them into one array. + # + # @visibility private + # @return Array of Documents + def return_all + @feeds.inject([]) do |results, feed| + results | feed.items + end end # Grab the auth token from the response body def set_auth_token \ No newline at end of file