Class: SportsDataApi::Nfl::Team
- Inherits:
-
Object
- Object
- SportsDataApi::Nfl::Team
- Defined in:
- lib/sports_data_api/nfl/team.rb
Instance Attribute Summary collapse
-
#alias ⇒ Object
readonly
Returns the value of attribute alias.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#market ⇒ Object
readonly
Returns the value of attribute market.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#remaining_challenges ⇒ Object
readonly
Returns the value of attribute remaining_challenges.
-
#remaining_timeouts ⇒ Object
readonly
Returns the value of attribute remaining_timeouts.
-
#statistics ⇒ Object
readonly
Returns the value of attribute statistics.
Instance Method Summary collapse
- #conference ⇒ Object
- #division ⇒ Object
-
#initialize(json, conference: nil, division: nil, statistics: nil) ⇒ Team
constructor
A new instance of Team.
- #players ⇒ Object
- #points ⇒ Object
- #venue ⇒ Object
Constructor Details
#initialize(json, conference: nil, division: nil, statistics: nil) ⇒ Team
Returns a new instance of Team.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/sports_data_api/nfl/team.rb', line 7 def initialize(json, conference: nil, division: nil, statistics: nil) @json = json @conference = conference @division = division @statistics = statistics @id = json['id'] @name = json['name'] @alias = json['alias'] @market = json['market'] @remaining_challenges = json['remaining_challenges'] @remaining_timeouts = json['remaining_timeouts'] end |
Instance Attribute Details
#alias ⇒ Object (readonly)
Returns the value of attribute alias.
4 5 6 |
# File 'lib/sports_data_api/nfl/team.rb', line 4 def alias @alias end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/sports_data_api/nfl/team.rb', line 4 def id @id end |
#market ⇒ Object (readonly)
Returns the value of attribute market.
4 5 6 |
# File 'lib/sports_data_api/nfl/team.rb', line 4 def market @market end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/sports_data_api/nfl/team.rb', line 4 def name @name end |
#remaining_challenges ⇒ Object (readonly)
Returns the value of attribute remaining_challenges.
4 5 6 |
# File 'lib/sports_data_api/nfl/team.rb', line 4 def remaining_challenges @remaining_challenges end |
#remaining_timeouts ⇒ Object (readonly)
Returns the value of attribute remaining_timeouts.
4 5 6 |
# File 'lib/sports_data_api/nfl/team.rb', line 4 def remaining_timeouts @remaining_timeouts end |
#statistics ⇒ Object (readonly)
Returns the value of attribute statistics.
4 5 6 |
# File 'lib/sports_data_api/nfl/team.rb', line 4 def statistics @statistics end |
Instance Method Details
#conference ⇒ Object
21 22 23 |
# File 'lib/sports_data_api/nfl/team.rb', line 21 def conference @conference || json.dig('conference', 'name') end |
#division ⇒ Object
25 26 27 |
# File 'lib/sports_data_api/nfl/team.rb', line 25 def division @division || json.dig('division', 'name') end |
#players ⇒ Object
38 39 40 |
# File 'lib/sports_data_api/nfl/team.rb', line 38 def players players_json.map { |p| Player.new(p) } end |
#points ⇒ Object
34 35 36 |
# File 'lib/sports_data_api/nfl/team.rb', line 34 def points json['points'] end |