Class: ChgkRating::Models::TournamentTeam

Inherits:
Base show all
Defined in:
lib/chgk_rating/models/tournament/tournament_team.rb

Constant Summary

Constants included from Connection

Connection::BASE_URL

Instance Attribute Summary collapse

Attributes inherited from Base

#lazy

Instance Method Summary collapse

Methods inherited from Base

attribute_mapping, #eager_load!, inherited, no_eager_loading!, no_lazy_support!, #to_h

Methods included from Request

#get

Methods included from Connection

#connection

Methods inherited from ChgkObject

#build_model, #extract_id_from

Constructor Details

#initialize(team_or_hash, params = {}) ⇒ TournamentTeam

Returns a new instance of TournamentTeam.



10
11
12
13
14
# File 'lib/chgk_rating/models/tournament/tournament_team.rb', line 10

def initialize(team_or_hash, params = {})
  @team = build_model team_or_hash
  @tournament = build_model params[:tournament], ChgkRating::Models::Tournament
  super extract_id_from(team_or_hash), params
end

Instance Attribute Details

#teamObject (readonly)

Returns the value of attribute team.



8
9
10
# File 'lib/chgk_rating/models/tournament/tournament_team.rb', line 8

def team
  @team
end

#tournamentObject (readonly)

Returns the value of attribute tournament.



8
9
10
# File 'lib/chgk_rating/models/tournament/tournament_team.rb', line 8

def tournament
  @tournament
end

Instance Method Details

#playersChgkRating::Collection::TournamentTeamPlayers

Returns an array-like TournamentTeamPlayers collection containing roster for the current TournamentTeam

Returns:

  • (ChgkRating::Collection::TournamentTeamPlayers)

    The collection of results.



19
20
21
# File 'lib/chgk_rating/models/tournament/tournament_team.rb', line 19

def players
  ChgkRating::Collections::TournamentTeamPlayers.new tournament: @tournament, team: @team
end

#resultsChgkRating::Collection::TournamentTeamResults

Returns an array-like TournamentTeamResults collection containing results for the current TournamentTeam

Returns:

  • (ChgkRating::Collection::TournamentTeamResults)

    The collection of results.



26
27
28
# File 'lib/chgk_rating/models/tournament/tournament_team.rb', line 26

def results
  ChgkRating::Collections::TournamentTeamResults.new tournament: @tournament, team: @team
end