Class: PUBG::Player

Inherits:
Object
  • Object
show all
Defined in:
lib/pubg/player.rb,
lib/pubg/player/data.rb,
lib/pubg/player/links.rb,
lib/pubg/player/season.rb,
lib/pubg/player/matches.rb,
lib/pubg/player/data/links.rb,
lib/pubg/player/season/data.rb,
lib/pubg/player/data/attributes.rb,
lib/pubg/player/season/attributes.rb,
lib/pubg/player/season/data/stats.rb,
lib/pubg/player/data/relationships.rb,
lib/pubg/player/season/data/attributes.rb,
lib/pubg/player/season/data/relationships.rb,
lib/pubg/player/season/data/game_mode_stats.rb,
lib/pubg/player/season/data/relationships/player.rb,
lib/pubg/player/season/data/relationships/season.rb,
lib/pubg/player/season/data/relationships/matches.rb

Defined Under Namespace

Classes: Data, Links, Matches, Season

Instance Method Summary collapse

Constructor Details

#initialize(args, s = false) ⇒ Player

Returns a new instance of Player.



8
9
10
11
# File 'lib/pubg/player.rb', line 8

def initialize(args, s=false)
  @s = s
  @args = args
end

Instance Method Details

#dataObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/pubg/player.rb', line 17

def data
  if @s
    data = []
     @args["data"].each do |player|
       data << Data.new(player)
     end
     return data
  else
    Data.new(@args["data"])
  end
end


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

def links
  Links.new(@args["links"])
end

#matchesObject



45
46
47
48
49
50
51
# File 'lib/pubg/player.rb', line 45

def matches
  matches = []
  @args["data"]["relationships"]["matches"]["data"].each do |match|
     matches << Matches.new(match)
   end
   return matches
end

#metaObject



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

def meta
  @args["meta"]
end

#originalObject



13
14
15
# File 'lib/pubg/player.rb', line 13

def original
  @args
end

#playerObject



37
38
39
# File 'lib/pubg/player.rb', line 37

def player
  Data::Attributes.new(@args["data"]["attributes"])
end

#playerIdObject



41
42
43
# File 'lib/pubg/player.rb', line 41

def playerId
  @args["data"]["id"]
end

#season(season_id = nil, platform_region = $platform_region) ⇒ Object



53
54
55
# File 'lib/pubg/player.rb', line 53

def season(season_id=nil, platform_region=$platform_region)
  Season.new(platform_region, @args["data"]["id"], season_id)
end