Class: Lita::Handlers::GithubOrg
- Inherits:
-
Handler
- Object
- Handler
- Lita::Handlers::GithubOrg
- Includes:
- LitaGithub::Config, LitaGithub::Octo, LitaGithub::Org
- Defined in:
- lib/lita/handlers/github_org.rb
Overview
GitHub Lita Handler
Instance Method Summary collapse
-
#org_teams_list(response) ⇒ Object
rubocop:enable Metrics/LineLength.
Methods included from LitaGithub::Org
Methods included from LitaGithub::Octo
#access_token, #octo, #setup_octo
Methods included from LitaGithub::Config
Instance Method Details
#org_teams_list(response) ⇒ Object
rubocop:enable Metrics/LineLength
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/lita/handlers/github_org.rb', line 45 def org_teams_list(response) md = response.match_data org = md[:org].nil? ? config.default_org : organization(md[:org].strip) begin teams = octo.organization_teams(org) rescue Octokit::NotFound return response.reply(t('org_not_found', org: org)) end tl = teams.length o = teams.shift reply = t('org_teams_list.header', org: org, num_teams: tl) reply << t('org_teams_list.team', o.to_h) sort_by_name(teams).each { |team| reply << t('org_teams_list.team', team.to_h) } response.reply(reply) end |