Class: Player
- Inherits:
-
Object
- Object
- Player
- Defined in:
- lib/api/utils/player.rb
Overview
This class is used to get the data from the player
Instance Attribute Summary collapse
-
#ability_casts ⇒ Object
readonly
Returns the value of attribute ability_casts.
-
#assets_agent ⇒ Object
readonly
Returns the value of attribute assets_agent.
-
#assets_card ⇒ Object
readonly
Returns the value of attribute assets_card.
-
#assists ⇒ Object
readonly
Returns the value of attribute assists.
-
#behavior ⇒ Object
readonly
Returns the value of attribute behavior.
-
#bodyshots ⇒ Object
readonly
Returns the value of attribute bodyshots.
-
#character ⇒ Object
readonly
Returns the value of attribute character.
-
#currenttier ⇒ Object
readonly
Returns the value of attribute currenttier.
-
#currenttier_patched ⇒ Object
readonly
Returns the value of attribute currenttier_patched.
-
#damage_made ⇒ Object
readonly
Returns the value of attribute damage_made.
-
#damage_received ⇒ Object
readonly
Returns the value of attribute damage_received.
-
#deaths ⇒ Object
readonly
Returns the value of attribute deaths.
-
#headshots ⇒ Object
readonly
Returns the value of attribute headshots.
-
#kills ⇒ Object
readonly
Returns the value of attribute kills.
-
#legshots ⇒ Object
readonly
Returns the value of attribute legshots.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#party_id ⇒ Object
readonly
Returns the value of attribute party_id.
-
#player_card ⇒ Object
readonly
Returns the value of attribute player_card.
-
#player_title ⇒ Object
readonly
Returns the value of attribute player_title.
-
#puuid ⇒ Object
readonly
Returns the value of attribute puuid.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
-
#session_playtime ⇒ Object
readonly
Returns the value of attribute session_playtime.
-
#spent_average ⇒ Object
readonly
Returns the value of attribute spent_average.
-
#spent_overall ⇒ Object
readonly
Returns the value of attribute spent_overall.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
-
#team ⇒ Object
readonly
Returns the value of attribute team.
Instance Method Summary collapse
- #accuracy ⇒ Object
-
#initialize(data) ⇒ Player
constructor
A new instance of Player.
- #kd ⇒ Object
- #name_tag ⇒ Object
Constructor Details
#initialize(data) ⇒ Player
Returns a new instance of Player.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/api/utils/player.rb', line 10 def initialize(data) @data = data fetch_general_data fetch_aesthetics_data fetch_session_data fetch_performance_data fetch_economy_data fetch_damage_data end |
Instance Attribute Details
#ability_casts ⇒ Object (readonly)
Returns the value of attribute ability_casts.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def ability_casts @ability_casts end |
#assets_agent ⇒ Object (readonly)
Returns the value of attribute assets_agent.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def assets_agent @assets_agent end |
#assets_card ⇒ Object (readonly)
Returns the value of attribute assets_card.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def assets_card @assets_card end |
#assists ⇒ Object (readonly)
Returns the value of attribute assists.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def assists @assists end |
#behavior ⇒ Object (readonly)
Returns the value of attribute behavior.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def behavior @behavior end |
#bodyshots ⇒ Object (readonly)
Returns the value of attribute bodyshots.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def bodyshots @bodyshots end |
#character ⇒ Object (readonly)
Returns the value of attribute character.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def character @character end |
#currenttier ⇒ Object (readonly)
Returns the value of attribute currenttier.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def currenttier @currenttier end |
#currenttier_patched ⇒ Object (readonly)
Returns the value of attribute currenttier_patched.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def currenttier_patched @currenttier_patched end |
#damage_made ⇒ Object (readonly)
Returns the value of attribute damage_made.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def damage_made @damage_made end |
#damage_received ⇒ Object (readonly)
Returns the value of attribute damage_received.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def damage_received @damage_received end |
#deaths ⇒ Object (readonly)
Returns the value of attribute deaths.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def deaths @deaths end |
#headshots ⇒ Object (readonly)
Returns the value of attribute headshots.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def headshots @headshots end |
#kills ⇒ Object (readonly)
Returns the value of attribute kills.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def kills @kills end |
#legshots ⇒ Object (readonly)
Returns the value of attribute legshots.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def legshots @legshots end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def level @level end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def name @name end |
#party_id ⇒ Object (readonly)
Returns the value of attribute party_id.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def party_id @party_id end |
#player_card ⇒ Object (readonly)
Returns the value of attribute player_card.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def player_card @player_card end |
#player_title ⇒ Object (readonly)
Returns the value of attribute player_title.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def player_title @player_title end |
#puuid ⇒ Object (readonly)
Returns the value of attribute puuid.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def puuid @puuid end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def score @score end |
#session_playtime ⇒ Object (readonly)
Returns the value of attribute session_playtime.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def session_playtime @session_playtime end |
#spent_average ⇒ Object (readonly)
Returns the value of attribute spent_average.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def spent_average @spent_average end |
#spent_overall ⇒ Object (readonly)
Returns the value of attribute spent_overall.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def spent_overall @spent_overall end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def tag @tag end |
#team ⇒ Object (readonly)
Returns the value of attribute team.
5 6 7 |
# File 'lib/api/utils/player.rb', line 5 def team @team end |
Instance Method Details
#accuracy ⇒ Object
29 30 31 |
# File 'lib/api/utils/player.rb', line 29 def accuracy [@headshots, @bodyshots, @legshots] end |
#kd ⇒ Object
25 26 27 |
# File 'lib/api/utils/player.rb', line 25 def kd (@kills.to_f / @deaths).round(2) end |
#name_tag ⇒ Object
21 22 23 |
# File 'lib/api/utils/player.rb', line 21 def name_tag "#{@name} ##{@tag}" end |