Class: RLS::Player

Inherits:
Object
  • Object
show all
Defined in:
lib/rls/objects/player.rb

Overview

A Rocket League player, as tracked by RLS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Player

Returns a new instance of Player



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/rls/objects/player.rb', line 41

def initialize(data)
  @id             = data['uniqueId']
  @display_name   = data['displayName']
  @platform       = Platform.new(data['platform'])
  @avatar         = data['avatar']
  @profile_url    = data['profileUrl']
  @signature_url  = data['signatureUrl']
  @stats          = Stats.new(data['stats'])

  @last_requested = RLS::Utils.time(data['lastRequested'])
  @created_at     = RLS::Utils.time(data['createdAt'])
  @updated_at     = RLS::Utils.time(data['updatedAt'])
  @next_update    = RLS::Utils.time(data['nextUpdateAt'])
end

Instance Attribute Details

#avatarString (readonly)

Returns URL to this player's avatar

Returns:

  • (String)

    URL to this player's avatar



18
19
20
# File 'lib/rls/objects/player.rb', line 18

def avatar
  @avatar
end

#created_atTime (readonly)

Returns:

  • (Time)


33
34
35
# File 'lib/rls/objects/player.rb', line 33

def created_at
  @created_at
end

#display_nameString (readonly)

Returns:

  • (String)


12
13
14
# File 'lib/rls/objects/player.rb', line 12

def display_name
  @display_name
end

#idString (readonly)

Returns Steam 64 ID, or PSN Username, or Xbox GamerTag or XUID

Returns:

  • (String)

    Steam 64 ID, or PSN Username, or Xbox GamerTag or XUID



9
10
11
# File 'lib/rls/objects/player.rb', line 9

def id
  @id
end

#last_requestedTime (readonly)

Returns:

  • (Time)


30
31
32
# File 'lib/rls/objects/player.rb', line 30

def last_requested
  @last_requested
end

#next_updateTime (readonly)

Returns:

  • (Time)


39
40
41
# File 'lib/rls/objects/player.rb', line 39

def next_update
  @next_update
end

#platformPlatform (readonly)

Returns platform on which this player is playing on

Returns:

  • (Platform)

    platform on which this player is playing on



15
16
17
# File 'lib/rls/objects/player.rb', line 15

def platform
  @platform
end

#profile_urlString (readonly)

Returns URL to this player's profile on RLS

Returns:

  • (String)

    URL to this player's profile on RLS



21
22
23
# File 'lib/rls/objects/player.rb', line 21

def profile_url
  @profile_url
end

#signature_urlString (readonly)

Returns URL to this player's signature image on RLS

Returns:

  • (String)

    URL to this player's signature image on RLS



24
25
26
# File 'lib/rls/objects/player.rb', line 24

def signature_url
  @signature_url
end

#statsStats (readonly)

Returns this player's accumulated stats to date

Returns:

  • (Stats)

    this player's accumulated stats to date



27
28
29
# File 'lib/rls/objects/player.rb', line 27

def stats
  @stats
end

#updated_atTime (readonly)

Returns:

  • (Time)


36
37
38
# File 'lib/rls/objects/player.rb', line 36

def updated_at
  @updated_at
end