Sha256: 7c071fd4b02bc9e60ac47fd5e672eacfaddcdf916dc2bea0f8e6fdeaf134415a
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
require 'json' module Gerry class Client module Groups # Get all groups # # @return [Hash] the groups def groups url = '/groups/' get(url) end # Get all members for a group # # @return [Array] the members def group_members(group_id) url = "/groups/#{group_id}/members/" get(url) end # Create a new group # # @return [Hash] the group details def create_group(name, description, visible, owner_id=nil) url = "/groups/#{name}" body = { description: description, visible_to_all: visible, } body[:owner_id] = owner_id unless owner_id.nil? || owner_id.empty? put(url, body) end # Adds one or more users to a group # # @param [String] group_id the group id # @param [Enumberable] users the list of users identified by email address # @return [Hash] the account info details for each user added def add_to_group(group_id, users) url = "/groups/#{group_id}/members" body = { members: users } post(url, body) end def remove_from_group(group_id, users) url = "/groups/#{group_id}/members.delete" body = { members: users } post(url, body) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gerry-0.0.3 | lib/gerry/client/groups.rb |