Class: RiotKit::Models::Riot::MatchEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/riot_kit/models/riot/match_entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(match_id:, queue_id:, game_creation:, champion_id:, win:, kills:, deaths:, assists:, cs_total:, cs_per_minute:, game_duration_seconds:, queue_label:, summoner_spell_ids:, item_ids:, participant_summaries:, champion_name: nil, puuid: nil) ⇒ MatchEntry

Returns a new instance of MatchEntry.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/riot_kit/models/riot/match_entry.rb', line 12

def initialize(match_id:, queue_id:, game_creation:, champion_id:, win:, kills:, deaths:, assists:, cs_total:,
               cs_per_minute:, game_duration_seconds:, queue_label:, summoner_spell_ids:, item_ids:, participant_summaries:, champion_name: nil, puuid: nil)
  @match_id = match_id
  @queue_id = queue_id
  @game_creation = game_creation
  @champion_id = champion_id
  @champion_name = champion_name
  @win = win
  @kills = kills
  @deaths = deaths
  @assists = assists
  @cs_total = cs_total
  @cs_per_minute = cs_per_minute
  @game_duration_seconds = game_duration_seconds
  @queue_label = queue_label
  @summoner_spell_ids = summoner_spell_ids
  @item_ids = item_ids
  @participant_summaries = participant_summaries
  @puuid = puuid
end

Instance Attribute Details

#assistsObject (readonly)

Returns the value of attribute assists.



7
8
9
# File 'lib/riot_kit/models/riot/match_entry.rb', line 7

def assists
  @assists
end

#champion_idObject (readonly)

Returns the value of attribute champion_id.



7
8
9
# File 'lib/riot_kit/models/riot/match_entry.rb', line 7

def champion_id
  @champion_id
end

#champion_nameObject (readonly)

Returns the value of attribute champion_name.



7
8
9
# File 'lib/riot_kit/models/riot/match_entry.rb', line 7

def champion_name
  @champion_name
end

#cs_per_minuteObject (readonly)

Returns the value of attribute cs_per_minute.



7
8
9
# File 'lib/riot_kit/models/riot/match_entry.rb', line 7

def cs_per_minute
  @cs_per_minute
end

#cs_totalObject (readonly)

Returns the value of attribute cs_total.



7
8
9
# File 'lib/riot_kit/models/riot/match_entry.rb', line 7

def cs_total
  @cs_total
end

#deathsObject (readonly)

Returns the value of attribute deaths.



7
8
9
# File 'lib/riot_kit/models/riot/match_entry.rb', line 7

def deaths
  @deaths
end

#game_creationObject (readonly)

Returns the value of attribute game_creation.



7
8
9
# File 'lib/riot_kit/models/riot/match_entry.rb', line 7

def game_creation
  @game_creation
end

#game_duration_secondsObject (readonly)

Returns the value of attribute game_duration_seconds.



7
8
9
# File 'lib/riot_kit/models/riot/match_entry.rb', line 7

def game_duration_seconds
  @game_duration_seconds
end

#item_idsObject (readonly)

Returns the value of attribute item_ids.



7
8
9
# File 'lib/riot_kit/models/riot/match_entry.rb', line 7

def item_ids
  @item_ids
end

#killsObject (readonly)

Returns the value of attribute kills.



7
8
9
# File 'lib/riot_kit/models/riot/match_entry.rb', line 7

def kills
  @kills
end

#match_idObject (readonly)

Returns the value of attribute match_id.



7
8
9
# File 'lib/riot_kit/models/riot/match_entry.rb', line 7

def match_id
  @match_id
end

#participant_summariesObject (readonly)

Returns the value of attribute participant_summaries.



7
8
9
# File 'lib/riot_kit/models/riot/match_entry.rb', line 7

def participant_summaries
  @participant_summaries
end

#puuidObject (readonly)

Returns the value of attribute puuid.



7
8
9
# File 'lib/riot_kit/models/riot/match_entry.rb', line 7

def puuid
  @puuid
end

#queue_idObject (readonly)

Returns the value of attribute queue_id.



7
8
9
# File 'lib/riot_kit/models/riot/match_entry.rb', line 7

def queue_id
  @queue_id
end

#queue_labelObject (readonly)

Returns the value of attribute queue_label.



7
8
9
# File 'lib/riot_kit/models/riot/match_entry.rb', line 7

def queue_label
  @queue_label
end

#summoner_spell_idsObject (readonly)

Returns the value of attribute summoner_spell_ids.



7
8
9
# File 'lib/riot_kit/models/riot/match_entry.rb', line 7

def summoner_spell_ids
  @summoner_spell_ids
end

#winObject (readonly)

Returns the value of attribute win.



7
8
9
# File 'lib/riot_kit/models/riot/match_entry.rb', line 7

def win
  @win
end

Instance Method Details

#==(other) ⇒ Object



33
34
35
# File 'lib/riot_kit/models/riot/match_entry.rb', line 33

def ==(other)
  other.is_a?(self.class) && match_id == other.match_id
end

#details(client: nil, config: RiotKit.config) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/riot_kit/models/riot/match_entry.rb', line 61

def details(client: nil, config: RiotKit.config)
  return nil if puuid.to_s.strip.empty? || match_id.to_s.strip.empty?

  ::RiotKit::Services::Riot::MatchDetail.call(
    match_id: match_id,
    puuid: puuid,
    client: client,
    config: config
  ).value!
rescue ::RiotKit::Errors::MatchNotFound
  nil
end

#to_hObject Also known as: to_cache_hash



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/riot_kit/models/riot/match_entry.rb', line 37

def to_h
  {
    match_id: match_id,
    queue_id: queue_id,
    game_creation: game_creation,
    champion_id: champion_id,
    champion_name: champion_name,
    win: win,
    kills: kills,
    deaths: deaths,
    assists: assists,
    cs_total: cs_total,
    cs_per_minute: cs_per_minute,
    game_duration_seconds: game_duration_seconds,
    queue_label: queue_label,
    summoner_spell_ids: summoner_spell_ids,
    item_ids: item_ids,
    participant_summaries: participant_summaries,
    puuid: puuid
  }
end