module Yammer module Api module Group # @see https://developer.yammer.com/restapi/#rest-groups # @rate_limited Yes # @authentication Requires user context # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid. # @return [Yammer::ApiResponse] # @param [Hash] opts the opts to fetch a thread with # @option opts [Integer] :page # @option opts [String] :sort_by sort groups by created_on, creator, name default order is by number of messages # @option opts [String] :letter groups starting with letter # @example Fetch all groups for authenticated user's network # Yammer.all_groups def all_groups(opts={}) get("/api/v1/groups", opts) end # @see https://developer.yammer.com/restapi/#rest-groups # @rate_limited Yes # @authentication Requires user context # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid. # @return [Yammer::ApiResponse] # @param id [Integer] the group ID # @example Fetch data for the thread # Yammer.get_group(74) def get_group(id) get("/api/v1/groups/#{id}") end # @see https://developer.yammer.com/restapi/#rest-groups # @rate_limited Yes # @authentication Requires user context # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid. # @return [Yammer::ApiResponse] # @param [Hash] opts the opts to fetch a thread with # @option opts [String] :name # @option opts [String] :description # @option opts [Boolean] :private # @option opts [Boolean] :show_in_directory # @example Fetch data for the thread # Yammer.create_group(74) def create_group(opts={}) post("/api/v1/groups", opts) end # @see https://developer.yammer.com/restapi/#rest-groups # @rate_limited Yes # @authentication Requires user context # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid. # @return [Yammer::ApiResponse] # @param id [Integer] the group ID # @param [Hash] opts # @option opts [String] :name # @option opts [String] :description # @option opts [Boolean] :private # @option opts [Boolean] :show_in_directory # @example Fetch data for the thread # Yammer.update_group(74, :name => "new group name") def update_group(id, opts={}) post("/api/v1/groups/#{id}", opts) end # @see https://developer.yammer.com/restapi/#rest-groups # @rate_limited Yes # @authentication Requires user context # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid. # @return [Yammer::ApiResponse] # @param id [Integer] the group ID # @example Fetch data for the thread # Yammer.groups_for_user(74) def groups_for_user(id) get("/api/v1/groups/for_user/#{id}") end end end end