Class: Sightstone::RankedStats

Inherits:
Object
  • Object
show all
Defined in:
lib/sightstone/ranked_stats.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ RankedStats

Returns a new instance of RankedStats.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/sightstone/ranked_stats.rb', line 9

def initialize(data)
  @summonerId = data['summonerId']
  @modifyDate = data['modifyDate']
  @champions = {}
  
  data['champions'].each do |champ|
    id = champ['id']
    @champions[id] = Hash.new unless @champions.has_key? id
    stat_keys = champ['stats'].keys
    stat_keys.each do |key|
      @champions[id][key] = champ['stats'][key]
    end
  end
end

Instance Attribute Details

#championsHash<Fixnum, Hash<String, Fixnum>>

Statisitc for each champion in a Hash. Each key stands for a champions id (0 is sum of all champs) and returns a Hash<stat, stat_value>.

Returns:

  • (Hash<Fixnum, Hash<String, Fixnum>>)

    the current value of champions



6
7
8
# File 'lib/sightstone/ranked_stats.rb', line 6

def champions
  @champions
end

#modifyDateObject

Returns the value of attribute modifyDate.



7
8
9
# File 'lib/sightstone/ranked_stats.rb', line 7

def modifyDate
  @modifyDate
end

#summonerIdObject

Returns the value of attribute summonerId.



7
8
9
# File 'lib/sightstone/ranked_stats.rb', line 7

def summonerId
  @summonerId
end