Class: ChgkRating::Models::Team
- Inherits:
-
Base
- Object
- ChgkObject
- Base
- ChgkRating::Models::Team
- Defined in:
- lib/chgk_rating/models/team.rb
Constant Summary
Constants included from Connection
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#at_tournament(tournament_or_id) ⇒ ChgkRating::Models::TournamentTeam
Returns TournamentTeam for the current Team at a given tournament.
-
#rating(release_id) ⇒ ChgkRating::Models::TeamRating
Returns rating for the current Team in a given release.
-
#ratings ⇒ ChgkRating::Collection::TeamRatings
Returns an array-like ratings collection for the current Team.
-
#recap(season_id) ⇒ ChgkRating::Models::Recap
Returns a single Recap for the current Team at a given season.
-
#recaps ⇒ ChgkRating::Collection::Recaps
Returns an hash-like Recaps collection for the current team, grouped by seasons.
-
#tournaments(season_id: nil, params: {}) ⇒ ChgkRating::Collection::Tournaments
Returns a collection of Tournaments that the current team participated at based on the given criteria.
Methods inherited from Base
attribute_mapping, #eager_load!, inherited, #initialize, no_eager_loading!, no_lazy_support!, #to_h
Methods included from Request
Methods included from Connection
Methods inherited from ChgkObject
#build_model, #extract_id_from
Constructor Details
This class inherits a constructor from ChgkRating::Models::Base
Instance Method Details
#at_tournament(tournament_or_id) ⇒ ChgkRating::Models::TournamentTeam
Returns TournamentTeam for the current Team at a given tournament
20 21 22 |
# File 'lib/chgk_rating/models/team.rb', line 20 def at_tournament(tournament_or_id) ChgkRating::Models::TournamentTeam.new self, tournament: tournament_or_id, lazy: true end |
#rating(release_id) ⇒ ChgkRating::Models::TeamRating
Returns rating for the current Team in a given release
28 29 30 |
# File 'lib/chgk_rating/models/team.rb', line 28 def (release_id) ChgkRating::Models::TeamRating.new release_id, team: self end |
#ratings ⇒ ChgkRating::Collection::TeamRatings
Returns an array-like ratings collection for the current Team.
35 36 37 |
# File 'lib/chgk_rating/models/team.rb', line 35 def ChgkRating::Collections::TeamRatings.new team: self end |
#recap(season_id) ⇒ ChgkRating::Models::Recap
Returns a single Recap for the current Team at a given season
11 12 13 |
# File 'lib/chgk_rating/models/team.rb', line 11 def recap(season_id) ChgkRating::Models::Recap.new season_id, team: self end |
#recaps ⇒ ChgkRating::Collection::Recaps
Returns an hash-like Recaps collection for the current team, grouped by seasons. Seasons act as keys, whereas Recap models - as values.
43 44 45 |
# File 'lib/chgk_rating/models/team.rb', line 43 def recaps ChgkRating::Collections::Recaps.new team: self end |
#tournaments(season_id: nil, params: {}) ⇒ ChgkRating::Collection::Tournaments
Returns a collection of Tournaments that the current team participated at based on the given criteria
53 54 55 |
# File 'lib/chgk_rating/models/team.rb', line 53 def tournaments(season_id: nil, params: {}) ChgkRating::Collections::Tournaments.new params.merge team: self, season_id: season_id, lazy: true end |