Class: RUBG::Participant

Inherits:
Object
  • Object
show all
Defined in:
lib/rubg/participant.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Participant

Returns a new instance of Participant.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/rubg/participant.rb', line 12

def initialize( args )

  if args[:participant_hash]
    @participant_id          = args[:participant_hash]["id"]
    @actor                   = args[:participant_hash]["attributes"]["actor"]
    @shard                   = args[:participant_hash]["attributes"]["shardId"]
    @dbnos                   = args[:participant_hash]["attributes"]["stats"]["DBNOs"]
    @assists                 = args[:participant_hash]["attributes"]["stats"]["assists"]
    @boosts                  = args[:participant_hash]["attributes"]["stats"]["boosts"]
    @damage_dealt            = args[:participant_hash]["attributes"]["stats"]["damageDealt"]
    @death_type              = args[:participant_hash]["attributes"]["stats"]["deathType"]
    @headshot_kills          = args[:participant_hash]["attributes"]["stats"]["headshotKills"]
    @heals                   = args[:participant_hash]["attributes"]["stats"]["heals"]
    @kill_place              = args[:participant_hash]["attributes"]["stats"]["killPlace"]
    @kill_ranking_before     = args[:participant_hash]["attributes"]["stats"]["killPoints"]
    @kill_ranking_gained     = args[:participant_hash]["attributes"]["stats"]["killPointsDelta"].to_i
    @kill_streaks            = args[:participant_hash]["attributes"]["stats"]["killStreaks"]
    @kills                   = args[:participant_hash]["attributes"]["stats"]["kills"]
    @last_kill_points        = args[:participant_hash]["attributes"]["stats"]["lastKillPoints"]
    @last_win_points         = args[:participant_hash]["attributes"]["stats"]["lastWinPoints"]
    @longest_kill            = args[:participant_hash]["attributes"]["stats"]["longestKill"]
    @most_damage             = args[:participant_hash]["attributes"]["stats"]["mostDamage"]
    @name                    = args[:participant_hash]["attributes"]["stats"]["name"]
    @player_id               = args[:participant_hash]["attributes"]["stats"]["playerId"]
    @revives                 = args[:participant_hash]["attributes"]["stats"]["revives"]
    @ride_distance           = args[:participant_hash]["attributes"]["stats"]["rideDistance"]
    @road_kills              = args[:participant_hash]["attributes"]["stats"]["roadKills"]
    @team_kills              = args[:participant_hash]["attributes"]["stats"]["teamKills"]
    @time_survived           = args[:participant_hash]["attributes"]["stats"]["timeSurvived"]
    @vehicle_destroys        = args[:participant_hash]["attributes"]["stats"]["vehicleDestroys"]
    @walk_distance           = args[:participant_hash]["attributes"]["stats"]["walkDistance"]
    @weapons_acquired        = args[:participant_hash]["attributes"]["stats"]["weaponsAcquired"]
    @win_place               = args[:participant_hash]["attributes"]["stats"]["winPlace"]
    @win_ranking_before      = args[:participant_hash]["attributes"]["stats"]["winPoints"]
    @win_ranking_gained      = args[:participant_hash]["attributes"]["stats"]["winPointsDelta"].to_i
    @overall_ranking_gained  = ( 
      args[:participant_hash]["attributes"]["stats"]["winPointsDelta"] + 
      ( args[:participant_hash]["attributes"]["stats"]["killPointsDelta"] * 0.2)
      ).to_i
    @stats                   = args[:participant_hash]["attributes"]["stats"]

  end
end

Instance Attribute Details

#actorObject (readonly)

Returns the value of attribute actor.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def actor
  @actor
end

#assistsObject (readonly)

Returns the value of attribute assists.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def assists
  @assists
end

#boostsObject (readonly)

Returns the value of attribute boosts.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def boosts
  @boosts
end

#damage_dealtObject (readonly)

Returns the value of attribute damage_dealt.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def damage_dealt
  @damage_dealt
end

#dbnosObject (readonly) Also known as: downed

Returns the value of attribute dbnos.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def dbnos
  @dbnos
end

#death_typeObject (readonly)

Returns the value of attribute death_type.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def death_type
  @death_type
end

#headshot_killsObject (readonly)

Returns the value of attribute headshot_kills.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def headshot_kills
  @headshot_kills
end

#healsObject (readonly)

Returns the value of attribute heals.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def heals
  @heals
end

#kill_placeObject (readonly)

Returns the value of attribute kill_place.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def kill_place
  @kill_place
end

#kill_ranking_beforeObject (readonly)

Returns the value of attribute kill_ranking_before.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def kill_ranking_before
  @kill_ranking_before
end

#kill_ranking_gainedObject (readonly)

Returns the value of attribute kill_ranking_gained.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def kill_ranking_gained
  @kill_ranking_gained
end

#kill_streaksObject (readonly)

Returns the value of attribute kill_streaks.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def kill_streaks
  @kill_streaks
end

#killsObject (readonly)

Returns the value of attribute kills.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def kills
  @kills
end

#last_kill_pointsObject (readonly)

Returns the value of attribute last_kill_points.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def last_kill_points
  @last_kill_points
end

#last_win_pointsObject (readonly)

Returns the value of attribute last_win_points.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def last_win_points
  @last_win_points
end

#longest_killObject (readonly)

Returns the value of attribute longest_kill.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def longest_kill
  @longest_kill
end

#most_damageObject (readonly)

Returns the value of attribute most_damage.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def most_damage
  @most_damage
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def name
  @name
end

#overall_ranking_gainedObject (readonly)

Returns the value of attribute overall_ranking_gained.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def overall_ranking_gained
  @overall_ranking_gained
end

#participant_idObject (readonly)

Returns the value of attribute participant_id.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def participant_id
  @participant_id
end

#player_idObject (readonly)

Returns the value of attribute player_id.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def player_id
  @player_id
end

#revivesObject (readonly)

Returns the value of attribute revives.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def revives
  @revives
end

#ride_distanceObject (readonly)

Returns the value of attribute ride_distance.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def ride_distance
  @ride_distance
end

#road_killsObject (readonly)

Returns the value of attribute road_kills.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def road_kills
  @road_kills
end

#shardObject (readonly)

Returns the value of attribute shard.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def shard
  @shard
end

#statsObject (readonly)

Returns the value of attribute stats.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def stats
  @stats
end

#team_killsObject (readonly)

Returns the value of attribute team_kills.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def team_kills
  @team_kills
end

#time_survivedObject (readonly)

Returns the value of attribute time_survived.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def time_survived
  @time_survived
end

#vehicle_destroysObject (readonly)

Returns the value of attribute vehicle_destroys.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def vehicle_destroys
  @vehicle_destroys
end

#walk_distanceObject (readonly)

Returns the value of attribute walk_distance.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def walk_distance
  @walk_distance
end

#weapons_acquiredObject (readonly)

Returns the value of attribute weapons_acquired.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def weapons_acquired
  @weapons_acquired
end

#win_placeObject (readonly)

Returns the value of attribute win_place.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def win_place
  @win_place
end

#win_ranking_beforeObject (readonly)

Returns the value of attribute win_ranking_before.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def win_ranking_before
  @win_ranking_before
end

#win_ranking_gainedObject (readonly)

Returns the value of attribute win_ranking_gained.



3
4
5
# File 'lib/rubg/participant.rb', line 3

def win_ranking_gained
  @win_ranking_gained
end