Sha256: 0fc11faba3532ad912912b06c43dc47ed75d78ad0206eb8720f069ec0554ad95

Contents?: true

Size: 1.48 KB

Versions: 27

Compression:

Stored size: 1.48 KB

Contents

require 'lol/model'

module Lol
  class PlayerStatistic < Lol::Model
    # @!attribute [r] aggregated_stats
    # @return [Array] List of aggregated statistics
    attr_reader :aggregated_stats

    # @!attribute [r] losses
    # @return [Fixnum] Number of losses for this queue type. It's presed only for ranked queue types
    attr_reader :losses

    # @!attribute [r] modify_date
    # @return [Time] Date stat was last modified
    attr_reader :modify_date

    # @!attribute [r] modify_date_str
    # @return [String] Human readable string representing date stat was last modified
    attr_reader :modify_date_str

    # @!attribute [r] player_stat_summary_type
    # @return [String] Summary Type. Legal values: AramUnranked5x5, CoopVsAI, OdinUnranked, RankedPremade3x3, RankedPremade5x5, RankedSolo5x5, RankedTeam3x3, RankedTeam5x5, Unranked, Unranked3x3
    attr_reader :player_stat_summary_type

    # @!attribute [r] wins
    # @return [Fixnum] Number of wins for this queue type
    attr_reader :wins

    private

    attr_writer :id, :losses, :modify_date_str, :player_stat_summary_type,
                :wins

    def modify_date= value
      @modify_date = value.is_a?(Numeric) && Time.at(value / 1000) || value
    end

    def aggregated_stats= value
      @aggregated_stats = value.is_a?(Hash) && OpenStruct.new(underscore_hash_keys value) || value
    end

    def underscore_hash_keys hash
      hash.inject({}) { |memo, (key, value)| memo.update key.to_s.underscore => value }
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
ruby-lol-0.12.2 lib/lol/player_statistic.rb
ruby-lol-0.12.1 lib/lol/player_statistic.rb
ruby-lol-0.12.0 lib/lol/player_statistic.rb
ruby-lol-0.11.6 lib/lol/player_statistic.rb
ruby-lol-0.11.5 lib/lol/player_statistic.rb
ruby-lol-0.11.4 lib/lol/player_statistic.rb
ruby-lol-0.11.3 lib/lol/player_statistic.rb
ruby-lol-0.11.2 lib/lol/player_statistic.rb
ruby-lol-0.11.1 lib/lol/player_statistic.rb
ruby-lol-0.11.0 lib/lol/player_statistic.rb
ruby-lol-0.10.0 lib/lol/player_statistic.rb
ruby-lol-0.9.19.1 lib/lol/player_statistic.rb
ruby-lol-0.9.19 lib/lol/player_statistic.rb
ruby-lol-0.9.18 lib/lol/player_statistic.rb
ruby-lol-0.9.17 lib/lol/player_statistic.rb
ruby-lol-0.9.16 lib/lol/player_statistic.rb
ruby-lol-0.9.15 lib/lol/player_statistic.rb
ruby-lol-0.9.14 lib/lol/player_statistic.rb
ruby-lol-0.9.13 lib/lol/player_statistic.rb
ruby-lol-0.9.12 lib/lol/player_statistic.rb