Module: LitmosApiClient::Teams

Included in:
API
Defined in:
lib/litmos_api_client/teams.rb

Instance Method Summary collapse

Instance Method Details

#add_user_to_team(options = {}) ⇒ Object

Raises:



19
20
21
22
23
24
25
26
27
28
# File 'lib/litmos_api_client/teams.rb', line 19

def add_user_to_team(options={})
  raise ArgumentError.new(":team_id is required") if options[:team_id].blank?
  raise ArgumentError.new(":user_id is required") if options[:user_id].blank?

  params = {
    'Id' => options[:user_id]
  }

  post("teams/#{options[:team_id]}/users", [params])
end

#find_team_by_id(id) ⇒ Object



7
8
9
10
11
# File 'lib/litmos_api_client/teams.rb', line 7

def find_team_by_id(id)
  get("teams/#{id}")
rescue NotFound
  nil
end

#find_users_by_team_id(id) ⇒ Object



13
14
15
16
17
# File 'lib/litmos_api_client/teams.rb', line 13

def find_users_by_team_id(id)
  get("teams/#{id}/users")
rescue NotFound
  nil
end

#remove_user_from_team(options = {}) ⇒ Object

Raises:



30
31
32
33
34
35
# File 'lib/litmos_api_client/teams.rb', line 30

def remove_user_from_team(options={})
  raise ArgumentError.new(":team_id is required") if options[:team_id].blank?
  raise ArgumentError.new(":user_id is required") if options[:user_id].blank?

  delete("teams/#{options[:team_id]}/users/#{options[:user_id]}")
end

#teams(options = {}) ⇒ Object



3
4
5
# File 'lib/litmos_api_client/teams.rb', line 3

def teams(options={})
  get :teams, options
end