Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added team_name to spaceship client #12457

Merged
merged 6 commits into from
May 21, 2018
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions spaceship/lib/spaceship/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,22 @@ def team_id=(team_id)
@current_team_id = team_id
end

# @return (String) The currently selected Team Name
def team_name
available_teams = teams.collect do |team|
{
team_id: (team["contentProvider"] || {})["contentProviderId"],
team_name: (team["contentProvider"] || {})["name"]
}
end

result = available_teams.find do |available_team|
team_id.to_s == available_team[:team_id].to_s
end

result[:team_name]
end

# @return (Hash) Fetches all information of the currently used team
def team_information
teams.find do |t|
Expand Down