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

- old
+ new

@@ -61,12 +61,12 @@ # # request_export returns the request ID on success or # the HTTP response object on failure. def request_export(username, document) result = add(@export + "/#{username}", :export_response, document) - - result.find('//apps:property').inject(nil) do |request_id, node| + + result.find('//apps:property').inject(nil) do |request_id, node| node.attributes['name'] == 'requestId' ? node.attributes['value'].to_i : request_id end end @@ -186,27 +186,30 @@ options[:limit] ? limit = options[:limit] : limit = 1000000 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 + # @return def get_members_of(group_id, options = {}) options[:extra] = "/#{group_id}/member" get_all :groups, options end + # TODO: Refactor add tos. + + # 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 @@ -215,10 +218,22 @@ def add_member_to(group_id, document) add(@group + "/#{group_id}/member", nil, document) end + # + # @param [String] group_id The ID for the group being modified + # @param [GoogleApps::Atom::GroupOwner] document The XML document with the owner address + # + # @visibility public + # @return + def add_owner_to(group_id, document) + add(@group + "/#{group_id}/owner", nil, document) + end + + # TODO: Refactor delete froms. + # delete_member_from removes a member from a group in the # domain. It takes a group_id and member_id as arguments. # # delete_member_from 'test_group', 'member@cnm.edu' # @@ -226,10 +241,21 @@ def delete_member_from(group_id, member_id) delete(@group + "/#{group_id}/member", member_id) end + # + # @param [String] group_id Email address of group + # @param [String] owner_id Email address of owner to remove + # + # @visibility public + # @return + def delete_owner_from(group_id, owner_id) + delete(@group + "/#{group_id}/owner", owner_id) + end + + # get_nicknames_for retrieves all the nicknames associated # with the requested user. It takes the username as a string. # # get_nickname_for 'lholcomb2' # @@ -384,14 +410,15 @@ # 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 + # + # @visibility private # @return Array of Documents def return_all @feeds.inject([]) do |results, feed| results | feed.items end \ No newline at end of file