Class: ChgkRating::Collections::PlayerTournaments
- Inherits:
-
Base
- Object
- ChgkRating::ChgkObject
- Base
- ChgkRating::Collections::PlayerTournaments
- Defined in:
- lib/chgk_rating/collections/tournaments/player_tournaments.rb
Constant Summary
Constants included from ChgkRating::Connection
ChgkRating::Connection::BASE_URL
Instance Attribute Summary collapse
-
#player ⇒ Object
readonly
Returns the value of attribute player.
-
#season_id ⇒ Object
readonly
Returns the value of attribute season_id.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ PlayerTournaments
constructor
A new instance of PlayerTournaments.
- #revert_to_hash(key, values) ⇒ Object
Methods inherited from Base
#[], #convertable?, #each, #respond_to?, #to_a, #to_h
Methods included from Request
Methods included from ChgkRating::Connection
Methods inherited from ChgkRating::ChgkObject
#build_model, #extract_id_from
Constructor Details
#initialize(params = {}) ⇒ PlayerTournaments
Returns a new instance of PlayerTournaments.
8 9 10 11 12 13 |
# File 'lib/chgk_rating/collections/tournaments/player_tournaments.rb', line 8 def initialize(params = {}) @player = build_model params[:player], ChgkRating::Models::Player @season_id = params[:season_id] super end |
Instance Attribute Details
#player ⇒ Object (readonly)
Returns the value of attribute player.
6 7 8 |
# File 'lib/chgk_rating/collections/tournaments/player_tournaments.rb', line 6 def player @player end |
#season_id ⇒ Object (readonly)
Returns the value of attribute season_id.
6 7 8 |
# File 'lib/chgk_rating/collections/tournaments/player_tournaments.rb', line 6 def season_id @season_id end |
Instance Method Details
#revert_to_hash(key, values) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/chgk_rating/collections/tournaments/player_tournaments.rb', line 15 def revert_to_hash(key, values) [ key, { 'idplayer' => @player.id.to_s, 'idseason' => key, 'tournaments' => values.map(&:to_h) } ] end |