Class: MLB::BaseballStat

Inherits:
Shale::Mapper
  • Object
show all
Defined in:
lib/mlb/baseball_stat.rb

Overview

Represents a baseball statistic type

Instance Attribute Summary collapse

Instance Attribute Details

#is_countingBoolean Also known as: counting?

Returns whether this is a counting stat

Examples:

stat.is_counting #=> true

Returns:

  • (Boolean)

    whether this is a counting stat



31
# File 'lib/mlb/baseball_stat.rb', line 31

attribute :is_counting, Shale::Type::Boolean

#labelString

Returns the display label for the stat

Examples:

stat.label #=> "Home Runs"

Returns:

  • (String)

    the display label for the stat



39
# File 'lib/mlb/baseball_stat.rb', line 39

attribute :label, Shale::Type::String

#lookup_paramString

Returns the query parameter used in API requests

Examples:

stat.lookup_param #=> "hr"

Returns:

  • (String)

    the query parameter used in API requests



23
# File 'lib/mlb/baseball_stat.rb', line 23

attribute :lookup_param, Shale::Type::String

#nameString

Returns the internal identifier for the stat

Examples:

stat.name #=> "homeRuns"

Returns:

  • (String)

    the internal identifier for the stat



15
# File 'lib/mlb/baseball_stat.rb', line 15

attribute :name, Shale::Type::String

#stat_groupsArray<Hash>

Returns the applicable stat categories

Examples:

stat.stat_groups #=> [{"displayName"=>"hitting"}]

Returns:

  • (Array<Hash>)

    the applicable stat categories



47
# File 'lib/mlb/baseball_stat.rb', line 47

attribute :stat_groups, Shale::Type::Value, collection: true