class CrewCheck::TeamList

Public Class Methods

fetch(token) click to toggle source
# 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
new(github_teams = []) click to toggle source
# 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

Protected Class Methods

with_octo_auto_pagination(&block) click to toggle source
# File lib/crew_check/team_list.rb, line 39
def self.with_octo_auto_pagination(&block)
  old_val = Octokit.auto_paginate
  Octokit.auto_paginate = true
  block.call.tap do
    Octokit.auto_paginate = old_val
  end
end

Public Instance Methods

each(&block) click to toggle source
# File lib/crew_check/team_list.rb, line 30
def each(&block)
  @teams.each(&block)
end
empty?() click to toggle source
# File lib/crew_check/team_list.rb, line 34
def empty?
  @teams.size == 0
end
shorthand_names() click to toggle source
# File lib/crew_check/team_list.rb, line 15
def shorthand_names
  @teams.map do |team|
    team.shorthand_name
  end
end