class V1::MatchSetSerializer

Serialize a MatchSet with the following attributes:

Public Instance Methods

games() click to toggle source

Serialize the games of the set.

# File app/serializers/v1/match_set_serializer.rb, line 15
def games
  V1::ApplicationArraySerializer.new(object.set_games, each_serializer: V1::SetGameSerializer)
end
winner() click to toggle source

Serialize the Player or Team id of the winner

# File app/serializers/v1/match_set_serializer.rb, line 23
def winner
  if object.team_winner.nil?
    nil
  else
    if object.match.doubles
      object.team_winner.id
    else
      object.team_winner.first_player.id
    end
  end
end