Class: ChgkRating::Models::Player

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

Constant Summary

Constants included from Connection

Connection::BASE_URL

Instance Attribute Summary

Attributes inherited from Base

#lazy

Instance Method Summary collapse

Methods inherited from Base

attribute_mapping, #eager_load!, inherited, #initialize, 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

This class inherits a constructor from ChgkRating::Models::Base

Instance Method Details

#rating(release_id) ⇒ ChgkRating::Models::PlayerRating

Returns rating for the current Player in a given release

Parameters:

  • release_id (String or Integer)

    Release to load rating for.

Returns:



10
11
12
# File 'lib/chgk_rating/models/player.rb', line 10

def rating(release_id)
  ChgkRating::Models::PlayerRating.new release_id, player: self
end

#ratingsChgkRating::Collection::PlayerRatings

Returns an array-like ratings collection for the current Player.

Returns:

  • (ChgkRating::Collection::PlayerRatings)

    The collection of ratings.



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

def ratings
  ChgkRating::Collections::PlayerRatings.new player: self
end

#tournaments(season_id = nil) ⇒ ChgkRating::Collection::PlayerTournaments

Returns a collection of Tournaments that the current player participated at based on the given criteria

Parameters:

  • season_id (String or Integer) (defaults to: nil)

    Season to load tournaments for

  • params (Hash)

    a customizable set of options

Returns:

  • (ChgkRating::Collection::PlayerTournaments)

    The collection of tournaments.

Raises:



27
28
29
# File 'lib/chgk_rating/models/player.rb', line 27

def tournaments(season_id = nil)
  ChgkRating::Collections::PlayerTournaments.new player: self, season_id: season_id
end