Class: ChgkRating::Models::TournamentTeam

Inherits:
Base show all
Defined in:
lib/chgk_rating/models/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

#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.


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

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


6
7
8
# File 'lib/chgk_rating/models/tournament_team.rb', line 6

def team
  @team
end

#tournamentObject (readonly)

Returns the value of attribute tournament


6
7
8
# File 'lib/chgk_rating/models/tournament_team.rb', line 6

def tournament
  @tournament
end

Instance Method Details

#playersChgkRating::Collection::TournamentPlayers

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

Returns:

  • (ChgkRating::Collection::TournamentPlayers)

    The collection of results.


17
18
19
# File 'lib/chgk_rating/models/tournament_team.rb', line 17

def players
  ChgkRating::Collections::TournamentPlayers.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.


24
25
26
# File 'lib/chgk_rating/models/tournament_team.rb', line 24

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