Class: RiotKit::Models::Riot::Player

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/riot_kit/models/riot/player.rb,
lib/riot_kit/models/riot/player/stats.rb,
lib/riot_kit/models/riot/player/combat.rb,
lib/riot_kit/models/riot/player/vision.rb,
lib/riot_kit/models/riot/player/economy.rb,
lib/riot_kit/models/riot/player/equipment.rb,
lib/riot_kit/models/riot/player/objectives.rb

Defined Under Namespace

Classes: Combat, Economy, Equipment, Objectives, Stats, Vision

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**attrs) ⇒ Player

Returns a new instance of Player.



52
53
54
55
56
57
58
59
60
# File 'lib/riot_kit/models/riot/player.rb', line 52

def initialize(**attrs)
  assign_identity(attrs)
  @stats = Player::Stats.new(**attrs)
  @combat = Player::Combat.new(**attrs)
  @economy = Player::Economy.new(**attrs)
  @vision = Player::Vision.new(**attrs)
  @objectives = Player::Objectives.new(**attrs)
  @equipment = Player::Equipment.new(**attrs)
end

Instance Attribute Details

#champ_levelObject (readonly)

Returns the value of attribute champ_level.



18
19
20
# File 'lib/riot_kit/models/riot/player.rb', line 18

def champ_level
  @champ_level
end

#champion_idObject (readonly)

Returns the value of attribute champion_id.



18
19
20
# File 'lib/riot_kit/models/riot/player.rb', line 18

def champion_id
  @champion_id
end

#champion_nameObject (readonly)

Returns the value of attribute champion_name.



18
19
20
# File 'lib/riot_kit/models/riot/player.rb', line 18

def champion_name
  @champion_name
end

#combatObject (readonly)

Returns the value of attribute combat.



18
19
20
# File 'lib/riot_kit/models/riot/player.rb', line 18

def combat
  @combat
end

#current_userObject (readonly)

Returns the value of attribute current_user.



18
19
20
# File 'lib/riot_kit/models/riot/player.rb', line 18

def current_user
  @current_user
end

#economyObject (readonly)

Returns the value of attribute economy.



18
19
20
# File 'lib/riot_kit/models/riot/player.rb', line 18

def economy
  @economy
end

#equipmentObject (readonly)

Returns the value of attribute equipment.



18
19
20
# File 'lib/riot_kit/models/riot/player.rb', line 18

def equipment
  @equipment
end

#laneObject (readonly)

Returns the value of attribute lane.



18
19
20
# File 'lib/riot_kit/models/riot/player.rb', line 18

def lane
  @lane
end

#objectivesObject (readonly)

Returns the value of attribute objectives.



18
19
20
# File 'lib/riot_kit/models/riot/player.rb', line 18

def objectives
  @objectives
end

#riot_id_game_nameObject (readonly)

Returns the value of attribute riot_id_game_name.



18
19
20
# File 'lib/riot_kit/models/riot/player.rb', line 18

def riot_id_game_name
  @riot_id_game_name
end

#riot_id_taglineObject (readonly)

Returns the value of attribute riot_id_tagline.



18
19
20
# File 'lib/riot_kit/models/riot/player.rb', line 18

def riot_id_tagline
  @riot_id_tagline
end

#roleObject (readonly)

Returns the value of attribute role.



18
19
20
# File 'lib/riot_kit/models/riot/player.rb', line 18

def role
  @role
end

#statsObject (readonly)

Returns the value of attribute stats.



18
19
20
# File 'lib/riot_kit/models/riot/player.rb', line 18

def stats
  @stats
end

#summoner_nameObject (readonly)

Returns the value of attribute summoner_name.



18
19
20
# File 'lib/riot_kit/models/riot/player.rb', line 18

def summoner_name
  @summoner_name
end

#team_idObject (readonly)

Returns the value of attribute team_id.



18
19
20
# File 'lib/riot_kit/models/riot/player.rb', line 18

def team_id
  @team_id
end

#team_positionObject (readonly)

Returns the value of attribute team_position.



18
19
20
# File 'lib/riot_kit/models/riot/player.rb', line 18

def team_position
  @team_position
end

#visionObject (readonly)

Returns the value of attribute vision.



18
19
20
# File 'lib/riot_kit/models/riot/player.rb', line 18

def vision
  @vision
end

#winObject (readonly)

Returns the value of attribute win.



18
19
20
# File 'lib/riot_kit/models/riot/player.rb', line 18

def win
  @win
end

Instance Method Details

#display_riot_idObject



62
63
64
65
66
# File 'lib/riot_kit/models/riot/player.rb', line 62

def display_riot_id
  return riot_id_game_name if riot_id_tagline.to_s.strip.empty?

  "#{riot_id_game_name}##{riot_id_tagline}"
end

#to_hObject



68
69
70
71
72
73
74
75
76
# File 'lib/riot_kit/models/riot/player.rb', line 68

def to_h
  identity_to_h
    .merge(stats.to_h)
    .merge(combat.to_h)
    .merge(economy.to_h)
    .merge(vision.to_h)
    .merge(objectives.to_h)
    .merge(equipment.to_h)
end