Class: PUBG::Match

Inherits:
Object
  • Object
show all
Defined in:
lib/pubg/match.rb,
lib/pubg/match/roster.rb,
lib/pubg/match/telemetry.rb,
lib/pubg/match/participants.rb,
lib/pubg/match/roster/attributes.rb,
lib/pubg/match/roster/relationships.rb,
lib/pubg/match/participants/attributes.rb

Defined Under Namespace

Classes: Participants, Roster, Telemetry

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Match

Returns a new instance of Match.



7
8
9
# File 'lib/pubg/match.rb', line 7

def initialize(args)
  @args = args
end

Instance Method Details

#dataObject



11
12
13
# File 'lib/pubg/match.rb', line 11

def data
  @args["data"]
end

#includedObject



15
16
17
# File 'lib/pubg/match.rb', line 15

def included
  @args["included"]
end


19
20
21
# File 'lib/pubg/match.rb', line 19

def links
  @args["links"]
end

#metaObject



23
24
25
# File 'lib/pubg/match.rb', line 23

def meta
  @args["meta"]
end

#participantsObject



31
32
33
34
35
36
37
38
# File 'lib/pubg/match.rb', line 31

def participants
  items = []
  participants = @args["included"].select {|data| data["type"] == "participant" }
  participants.each do |participant|
    items << Participants.new(participant)
  end
  return items
end

#rosterObject



40
41
42
43
44
45
46
47
# File 'lib/pubg/match.rb', line 40

def roster
  items = []
  rosters = @args["included"].select {|data| data["type"] == "roster" }
  rosters.each do |roster|
    items << Roster.new(roster)
  end
  return items
end

#telemetryObject



27
28
29
# File 'lib/pubg/match.rb', line 27

def telemetry
  Telemetry.new(@args["included"].select {|data| data["type"] == "asset" }.first)
end