class ChgkRating::Models::Team

Public Instance Methods

at_tournament(tournament_or_id) click to toggle source

Returns TournamentTeam for the current Team at a given tournament

@raise [ChgkRating::Error::NotFound] Error raised when the requested Tournament cannot be found. @return [ChgkRating::Models::TournamentTeam] The requested TournamentTeam. @param tournament_or_id [String, Integer or Tournament] Tournament to load the team for

# File lib/chgk_rating/models/team.rb, line 18
def at_tournament(tournament_or_id)
  ChgkRating::Models::TournamentTeam.new self, tournament: tournament_or_id, lazy: true
end
rating(release_id) click to toggle source

Returns Rating for the current Team in a given release

@return [ChgkRating::Models::Rating] The requested Rating. @param release_id [String or Integer] Release to load rating for.

# File lib/chgk_rating/models/team.rb, line 26
def rating(release_id)
  ChgkRating::Models::Rating.new release_id, team: self
end
ratings() click to toggle source

Returns an array-like Ratings collection for the current team.

@return [ChgkRating::Collection::Ratings] The collection of ratings.

# File lib/chgk_rating/models/team.rb, line 33
def ratings
  ChgkRating::Collections::Ratings.new team: self
end
recap(season_id) click to toggle source

Returns a single Recap for the current Team at a given season

@raise [ChgkRating::Error::BadRequest] Error raised when the requested season is invalid @return [ChgkRating::Models::Recap] The requested Recap. @param season_id [String or Integer] Season to load recap for.

# File lib/chgk_rating/models/team.rb, line 9
def recap(season_id)
  ChgkRating::Models::Recap.new season_id, team: self
end
recaps() click to toggle source

Returns an hash-like Recaps collection for the current team, grouped by seasons. Seasons act as keys, whereas Recap models - as values.

@return [ChgkRating::Collection::Recaps] The collection of recaps.

# File lib/chgk_rating/models/team.rb, line 41
def recaps
  ChgkRating::Collections::Recaps.new team: self
end
tournaments(season_id: nil, params: {}) click to toggle source

Returns a collection of Tournaments that the current team participated at based on the given criteria

@raise [ChgkRating::Error::NotFound] Error raised when nothing can be found based on the given criteria. @return [ChgkRating::Collection::Tournaments] The collection of tournaments. @param season_id [String or Integer] Season to load tournaments for @option params [String or Integer] :page The requested page. Default is 1

# File lib/chgk_rating/models/team.rb, line 51
def tournaments(season_id: nil, params: {})
  ChgkRating::Collections::Tournaments.new params.merge team: self, season_id: season_id, lazy: true
end

Private Instance Methods

api_path() click to toggle source
# File lib/chgk_rating/models/team.rb, line 57
def api_path
  'teams'
end