Class: ChgkRating::Client
- Inherits:
-
Object
- Object
- ChgkRating::Client
- Defined in:
- lib/chgk_rating/client.rb
Instance Method Summary collapse
-
#player(id, lazy = false) ⇒ ChgkRating::Models::Player
Returns a single Player.
-
#player_rating(player_or_id, release_id) ⇒ ChgkRating::Models::PlayerRating
Returns rating for a given Player in a given release.
-
#player_ratings(player_or_id) ⇒ ChgkRating::Collection::Ratings
Returns an array-like Ratings collection for a given Player.
-
#player_tournaments(player_or_id, season_id = nil) ⇒ ChgkRating::Collection::PlayerTournaments
Returns a collection of Tournaments that the Player has participated in.
-
#players(params = {}) ⇒ ChgkRating::Collection::Players
Returns an array-like Players collection that contains Player models.
-
#recap(team_or_id, season_id) ⇒ ChgkRating::Models::Recap
Returns a single Recap for a given Team.
-
#recaps(team_or_id) ⇒ ChgkRating::Collection::Recaps
Returns an hash-like Recaps collection for a given team, grouped by seasons.
-
#search_players(params) ⇒ ChgkRating::Collection::Players::Search
Returns a Players collection based on the search criteria.
-
#search_teams(params) ⇒ ChgkRating::Collection::Teams::Search
Returns a Teams collection based on the search criteria.
-
#team(id, lazy = false) ⇒ ChgkRating::Models::Team
Returns a single Team.
-
#team_at_tournament(tournament_or_id, team_or_id) ⇒ ChgkRating::Models::TournamentTeam
Returns a single TournamentTeam.
-
#team_players_at_tournament(tournament_or_id, team_or_id) ⇒ ChgkRating::Collection::TournamentTeamPlayers
Returns an array-like TournamentTeamPlayers collection containing roster for a given team at a given tournament.
-
#team_rating(team_or_id, release_id) ⇒ ChgkRating::Models::TeamRating
Returns rating for a given Team in a given release.
-
#team_ratings(team_or_id) ⇒ ChgkRating::Collection::Ratings
Returns an array-like Ratings collection for a given Team.
-
#team_results_at_tournament(tournament_or_id, team_or_id) ⇒ ChgkRating::Collection::TournamentTeamResults
Returns an array-like TournamentTeamResults collection with results for a given team in a given tournament.
-
#teams(params = {}) ⇒ ChgkRating::Collection::Teams
Returns an array-like Teams collection that contains Team models.
-
#teams_at_tournament(tournament_or_id) ⇒ ChgkRating::Collection::Ratings
Returns an array-like TournamentTeams collection specifying which teams participated in a given tournament.
-
#tournament(id, lazy = false) ⇒ ChgkRating::Models::Tournament
Returns a single Tournament.
-
#tournaments(team_or_id: nil, season_id: nil, params: {}) ⇒ ChgkRating::Collection::Tournaments
Returns a collection of Tournaments based on the given criteria.
Instance Method Details
#player(id, lazy = false) ⇒ ChgkRating::Models::Player
Returns a single Player
21 22 23 |
# File 'lib/chgk_rating/client.rb', line 21 def player(id, lazy = false) ChgkRating::Models::Player.new id, lazy: lazy end |
#player_rating(player_or_id, release_id) ⇒ ChgkRating::Models::PlayerRating
Returns rating for a given Player in a given release
71 72 73 |
# File 'lib/chgk_rating/client.rb', line 71 def (player_or_id, release_id) player(player_or_id, true).(release_id) end |
#player_ratings(player_or_id) ⇒ ChgkRating::Collection::Ratings
Returns an array-like Ratings collection for a given Player.
171 172 173 |
# File 'lib/chgk_rating/client.rb', line 171 def (player_or_id) player(player_or_id, true). end |
#player_tournaments(player_or_id, season_id = nil) ⇒ ChgkRating::Collection::PlayerTournaments
Returns a collection of Tournaments that the Player has participated in
152 153 154 155 |
# File 'lib/chgk_rating/client.rb', line 152 def player_tournaments(player_or_id, season_id = nil) ChgkRating::Collections::PlayerTournaments.new player: player_or_id, season_id: season_id end |
#players(params = {}) ⇒ ChgkRating::Collection::Players
Returns an array-like Players collection that contains Player models
120 121 122 |
# File 'lib/chgk_rating/client.rb', line 120 def players(params = {}) ChgkRating::Collections::Players.new params end |
#recap(team_or_id, season_id) ⇒ ChgkRating::Models::Recap
Returns a single Recap for a given Team
31 32 33 |
# File 'lib/chgk_rating/client.rb', line 31 def recap(team_or_id, season_id) team(team_or_id, true).recap(season_id) end |
#recaps(team_or_id) ⇒ ChgkRating::Collection::Recaps
Returns an hash-like Recaps collection for a given team, grouped by seasons. Seasons act as keys, whereas Recap models - as values.
130 131 132 |
# File 'lib/chgk_rating/client.rb', line 130 def recaps(team_or_id) team(team_or_id, true).recaps end |
#search_players(params) ⇒ ChgkRating::Collection::Players::Search
Returns a Players collection based on the search criteria.
84 85 86 |
# File 'lib/chgk_rating/client.rb', line 84 def search_players(params) ChgkRating::Collections::Players.search request: params end |
#search_teams(params) ⇒ ChgkRating::Collection::Teams::Search
Returns a Teams collection based on the search criteria.
94 95 96 |
# File 'lib/chgk_rating/client.rb', line 94 def search_teams(params) ChgkRating::Collections::Teams.search request: params end |
#team(id, lazy = false) ⇒ ChgkRating::Models::Team
Returns a single Team
11 12 13 |
# File 'lib/chgk_rating/client.rb', line 11 def team(id, lazy = false) ChgkRating::Models::Team.new id, lazy: lazy end |
#team_at_tournament(tournament_or_id, team_or_id) ⇒ ChgkRating::Models::TournamentTeam
Returns a single TournamentTeam
51 52 53 |
# File 'lib/chgk_rating/client.rb', line 51 def team_at_tournament(tournament_or_id, team_or_id) tournament(tournament_or_id, true).team_by(team_or_id) end |
#team_players_at_tournament(tournament_or_id, team_or_id) ⇒ ChgkRating::Collection::TournamentTeamPlayers
Returns an array-like TournamentTeamPlayers collection containing roster for a given team at a given tournament.
202 203 204 |
# File 'lib/chgk_rating/client.rb', line 202 def team_players_at_tournament(tournament_or_id, team_or_id) team_at_tournament(tournament_or_id, team_or_id).players end |
#team_rating(team_or_id, release_id) ⇒ ChgkRating::Models::TeamRating
Returns rating for a given Team in a given release
61 62 63 |
# File 'lib/chgk_rating/client.rb', line 61 def (team_or_id, release_id) team(team_or_id, true).(release_id) end |
#team_ratings(team_or_id) ⇒ ChgkRating::Collection::Ratings
Returns an array-like Ratings collection for a given Team.
162 163 164 |
# File 'lib/chgk_rating/client.rb', line 162 def (team_or_id) team(team_or_id, true). end |
#team_results_at_tournament(tournament_or_id, team_or_id) ⇒ ChgkRating::Collection::TournamentTeamResults
Returns an array-like TournamentTeamResults collection with results for a given team in a given tournament
191 192 193 |
# File 'lib/chgk_rating/client.rb', line 191 def team_results_at_tournament(tournament_or_id, team_or_id) team_at_tournament(tournament_or_id, team_or_id).results end |
#teams(params = {}) ⇒ ChgkRating::Collection::Teams
Returns an array-like Teams collection that contains Team models
108 109 110 |
# File 'lib/chgk_rating/client.rb', line 108 def teams(params = {}) ChgkRating::Collections::Teams.new params end |
#teams_at_tournament(tournament_or_id) ⇒ ChgkRating::Collection::Ratings
Returns an array-like TournamentTeams collection specifying which teams participated in a given tournament
180 181 182 |
# File 'lib/chgk_rating/client.rb', line 180 def teams_at_tournament(tournament_or_id) tournament(tournament_or_id, true).team_list end |
#tournament(id, lazy = false) ⇒ ChgkRating::Models::Tournament
Returns a single Tournament
41 42 43 |
# File 'lib/chgk_rating/client.rb', line 41 def tournament(id, lazy = false) ChgkRating::Models::Tournament.new id, lazy: lazy end |
#tournaments(team_or_id: nil, season_id: nil, params: {}) ⇒ ChgkRating::Collection::Tournaments
Returns a collection of Tournaments based on the given criteria
141 142 143 144 145 |
# File 'lib/chgk_rating/client.rb', line 141 def tournaments(team_or_id: nil, season_id: nil, params: {}) ChgkRating::Collections::Tournaments.new params.merge( team: team_or_id, season_id: season_id ) end |