Class: CrewCheck::TeamList

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/crew_check/team_list.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(github_teams = []) ⇒ TeamList

Returns a new instance of TeamList.



9
10
11
12
13
# File 'lib/crew_check/team_list.rb', line 9

def initialize(github_teams = [])
  @teams = github_teams.map do |gh_team|
    CrewCheck::Team.new(gh_team)
  end
end

Class Method Details

.fetch(token) ⇒ Object



22
23
24
25
26
27
# File 'lib/crew_check/team_list.rb', line 22

def fetch(token)
  with_octo_auto_pagination do
    client = Octokit::Client.new(access_token: token)
    new(client.user_teams)
  end
end

Instance Method Details

#each(&block) ⇒ Object



30
31
32
# File 'lib/crew_check/team_list.rb', line 30

def each(&block)
  @teams.each(&block)
end

#empty?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/crew_check/team_list.rb', line 34

def empty?
  @teams.size == 0
end

#shorthand_namesObject



15
16
17
18
19
# File 'lib/crew_check/team_list.rb', line 15

def shorthand_names
  @teams.map do |team|
    team.shorthand_name
  end
end