Class: MLB::Award
- Inherits:
-
Shale::Mapper
- Object
- Shale::Mapper
- MLB::Award
- Includes:
- Comparable, ComparableByAttribute
- Defined in:
- lib/mlb/award.rb
Overview
Represents an MLB award with recipient and voting information
Instance Attribute Summary collapse
-
#date ⇒ Date
Returns the date the award was given.
-
#id ⇒ String
Returns the unique identifier for the award.
-
#league ⇒ League
Returns the league associated with the award.
-
#name ⇒ String
Returns the name of the award.
-
#notes ⇒ String
Returns additional notes about the award.
-
#player ⇒ Player
Returns the player who received the award.
-
#season ⇒ Integer
Returns the season year for the award.
-
#sort_order ⇒ Integer
Returns the sort order for display.
-
#sport ⇒ Sport
Returns the sport associated with the award.
-
#votes ⇒ Integer
Returns the number of votes received.
Instance Method Summary collapse
-
#comparable_attribute ⇒ Symbol
private
Returns the attribute used for sorting.
-
#recipients(season: nil) ⇒ Array<Award>
Retrieves recipients of this award for a given season.
Methods included from ComparableByAttribute
Instance Attribute Details
#date ⇒ Date
Returns the date the award was given
59 |
# File 'lib/mlb/award.rb', line 59 attribute :date, Shale::Type::Date |
#id ⇒ String
Returns the unique identifier for the award
27 |
# File 'lib/mlb/award.rb', line 27 attribute :id, Shale::Type::String |
#league ⇒ League
Returns the league associated with the award
91 |
# File 'lib/mlb/award.rb', line 91 attribute :league, League |
#name ⇒ String
Returns the name of the award
35 |
# File 'lib/mlb/award.rb', line 35 attribute :name, Shale::Type::String |
#notes ⇒ String
Returns additional notes about the award
43 |
# File 'lib/mlb/award.rb', line 43 attribute :notes, Shale::Type::String |
#player ⇒ Player
Returns the player who received the award
83 |
# File 'lib/mlb/award.rb', line 83 attribute :player, Player |
#season ⇒ Integer
Returns the season year for the award
67 |
# File 'lib/mlb/award.rb', line 67 attribute :season, Shale::Type::Integer |
#sort_order ⇒ Integer
Returns the sort order for display
99 |
# File 'lib/mlb/award.rb', line 99 attribute :sort_order, Shale::Type::Integer |
#sport ⇒ Sport
Returns the sport associated with the award
75 |
# File 'lib/mlb/award.rb', line 75 attribute :sport, Sport |
#votes ⇒ Integer
Returns the number of votes received
51 |
# File 'lib/mlb/award.rb', line 51 attribute :votes, Shale::Type::Integer |
Instance Method Details
#comparable_attribute ⇒ Symbol
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the attribute used for sorting
19 |
# File 'lib/mlb/award.rb', line 19 def comparable_attribute = :sort_order |
#recipients(season: nil) ⇒ Array<Award>
Retrieves recipients of this award for a given season
120 121 122 123 124 |
# File 'lib/mlb/award.rb', line 120 def recipients(season: nil) season ||= Utils.current_season response = CLIENT.get("awards/#{id}/recipients?#{Utils.build_query(season:)}") Awards.from_json(response).awards end |