Class: Player

Inherits:
Object
  • Object
show all
Defined in:
lib/api/utils/player.rb

Overview

This class is used to get the data from the player

Instance Attribute Summary collapse

Instance Method Summary collapse

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_castsObject (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_agentObject (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_cardObject (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

#assistsObject (readonly)

Returns the value of attribute assists.



5
6
7
# File 'lib/api/utils/player.rb', line 5

def assists
  @assists
end

#behaviorObject (readonly)

Returns the value of attribute behavior.



5
6
7
# File 'lib/api/utils/player.rb', line 5

def behavior
  @behavior
end

#bodyshotsObject (readonly)

Returns the value of attribute bodyshots.



5
6
7
# File 'lib/api/utils/player.rb', line 5

def bodyshots
  @bodyshots
end

#characterObject (readonly)

Returns the value of attribute character.



5
6
7
# File 'lib/api/utils/player.rb', line 5

def character
  @character
end

#currenttierObject (readonly)

Returns the value of attribute currenttier.



5
6
7
# File 'lib/api/utils/player.rb', line 5

def currenttier
  @currenttier
end

#currenttier_patchedObject (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_madeObject (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_receivedObject (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

#deathsObject (readonly)

Returns the value of attribute deaths.



5
6
7
# File 'lib/api/utils/player.rb', line 5

def deaths
  @deaths
end

#headshotsObject (readonly)

Returns the value of attribute headshots.



5
6
7
# File 'lib/api/utils/player.rb', line 5

def headshots
  @headshots
end

#killsObject (readonly)

Returns the value of attribute kills.



5
6
7
# File 'lib/api/utils/player.rb', line 5

def kills
  @kills
end

#legshotsObject (readonly)

Returns the value of attribute legshots.



5
6
7
# File 'lib/api/utils/player.rb', line 5

def legshots
  @legshots
end

#levelObject (readonly)

Returns the value of attribute level.



5
6
7
# File 'lib/api/utils/player.rb', line 5

def level
  @level
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/api/utils/player.rb', line 5

def name
  @name
end

#party_idObject (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_cardObject (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_titleObject (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

#puuidObject (readonly)

Returns the value of attribute puuid.



5
6
7
# File 'lib/api/utils/player.rb', line 5

def puuid
  @puuid
end

#scoreObject (readonly)

Returns the value of attribute score.



5
6
7
# File 'lib/api/utils/player.rb', line 5

def score
  @score
end

#session_playtimeObject (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_averageObject (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_overallObject (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

#tagObject (readonly)

Returns the value of attribute tag.



5
6
7
# File 'lib/api/utils/player.rb', line 5

def tag
  @tag
end

#teamObject (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

#accuracyObject



29
30
31
# File 'lib/api/utils/player.rb', line 29

def accuracy
  [@headshots, @bodyshots, @legshots]
end

#kdObject



25
26
27
# File 'lib/api/utils/player.rb', line 25

def kd
  (@kills.to_f / @deaths).round(2)
end

#name_tagObject



21
22
23
# File 'lib/api/utils/player.rb', line 21

def name_tag
  "#{@name} ##{@tag}"
end