Class: LeagueOfLegends::DTO::Game

Inherits:
Object
  • Object
show all
Defined in:
lib/league_of_legends/dto/game.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Game

Returns a new instance of Game.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/league_of_legends/dto/game.rb', line 15

def initialize attributes
  return if attributes.nil?

  @champion_id = attributes[:championId].to_i
  @create_date = Time.at(attributes[:createDate]/1000)
  @fellow_players = attributes[:fellowPlayers].map do |player|
    ::LeagueOfLegends::DTO::Player.new(player)
  end
  @game_id = attributes[:gameId].to_i
  @game_mode = attributes[:gameMode]
  @game_type = attributes[:gameType]
  @invalid = attributes[:invalid]
  @level = attributes[:level].to_i
  @map_id = attributes[:mapId].to_i
  @spell_1 = attributes[:spell1].to_i
  @spell_2 = attributes[:spell2].to_i
  @stats = ::LeagueOfLegends::DTO::RawStats.new(attributes[:stats])
  @sub_type = attributes[:subType]
  @team_id = attributes[:teamId].to_i
end

Instance Attribute Details

#champion_idObject (readonly)

Returns the value of attribute champion_id.



11
12
13
# File 'lib/league_of_legends/dto/game.rb', line 11

def champion_id
  @champion_id
end

#create_dateObject (readonly)

Returns the value of attribute create_date.



11
12
13
# File 'lib/league_of_legends/dto/game.rb', line 11

def create_date
  @create_date
end

#fellow_playersObject (readonly)

Returns the value of attribute fellow_players.



11
12
13
# File 'lib/league_of_legends/dto/game.rb', line 11

def fellow_players
  @fellow_players
end

#game_idObject (readonly)

Returns the value of attribute game_id.



11
12
13
# File 'lib/league_of_legends/dto/game.rb', line 11

def game_id
  @game_id
end

#game_modeObject (readonly)

Returns the value of attribute game_mode.



11
12
13
# File 'lib/league_of_legends/dto/game.rb', line 11

def game_mode
  @game_mode
end

#game_typeObject (readonly)

Returns the value of attribute game_type.



11
12
13
# File 'lib/league_of_legends/dto/game.rb', line 11

def game_type
  @game_type
end

#invalidObject (readonly)

Returns the value of attribute invalid.



11
12
13
# File 'lib/league_of_legends/dto/game.rb', line 11

def invalid
  @invalid
end

#levelObject (readonly)

Returns the value of attribute level.



11
12
13
# File 'lib/league_of_legends/dto/game.rb', line 11

def level
  @level
end

#map_idObject (readonly)

Returns the value of attribute map_id.



11
12
13
# File 'lib/league_of_legends/dto/game.rb', line 11

def map_id
  @map_id
end

#spell_1Object (readonly)

Returns the value of attribute spell_1.



11
12
13
# File 'lib/league_of_legends/dto/game.rb', line 11

def spell_1
  @spell_1
end

#spell_2Object (readonly)

Returns the value of attribute spell_2.



11
12
13
# File 'lib/league_of_legends/dto/game.rb', line 11

def spell_2
  @spell_2
end

#statsObject (readonly)

Returns the value of attribute stats.



11
12
13
# File 'lib/league_of_legends/dto/game.rb', line 11

def stats
  @stats
end

#sub_typeObject (readonly)

Returns the value of attribute sub_type.



11
12
13
# File 'lib/league_of_legends/dto/game.rb', line 11

def sub_type
  @sub_type
end

#team_idObject (readonly)

Returns the value of attribute team_id.



11
12
13
# File 'lib/league_of_legends/dto/game.rb', line 11

def team_id
  @team_id
end

Class Method Details

.versionObject



7
8
9
# File 'lib/league_of_legends/dto/game.rb', line 7

def self.version
  ::LeagueOfLegends::DTO::RecentGames.version
end