class RHC::Commands::Team

Public Instance Methods

create(name) click to toggle source
# File lib/rhc/commands/team.rb, line 36
def create(name)
  say "Creating team '#{name}' ... "
  rest_client.add_team(name)
  success "done"

  info "You may now add team members using the 'rhc add-member' command"

  0
end
delete(_) click to toggle source
# File lib/rhc/commands/team.rb, line 79
def delete(_)
  team = find_team(:owned => true)

  say "Deleting team '#{team.name}' ... "
  team.destroy
  success "deleted"

  0
end
leave(_) click to toggle source
# File lib/rhc/commands/team.rb, line 92
def leave(_)
  team = find_team

  say "Leaving team ... "
  result = team.leave
  success "done"
  result.messages.each{ |s| paragraph{ say s } }

  0
end
list() click to toggle source
# File lib/rhc/commands/team.rb, line 60
def list
  teams = rest_client.send(options.mine ? :owned_teams : :teams, {:include => "members"})

  teams.each do |t|
    display_team(t, true)
  end

  if options.mine
    success "You have #{pluralize(teams.length, 'team')}."
  else
    success "You are a member of #{pluralize(teams.length, 'team')}."
  end

  0
end
show(_) click to toggle source
# File lib/rhc/commands/team.rb, line 49
def show(_)
  team = find_team

  display_team(team, true)

  0
end