Class: NBA::Team
- Inherits:
-
Object
- Object
- NBA::Team
- Defined in:
- lib/nba/team.rb
Instance Attribute Summary collapse
-
#championships ⇒ Object
readonly
Returns the value of attribute championships.
-
#conference ⇒ Object
readonly
Returns the value of attribute conference.
-
#division ⇒ Object
readonly
Returns the value of attribute division.
-
#founded ⇒ Object
readonly
Returns the value of attribute founded.
-
#head_coach ⇒ Object
(also: #coach)
readonly
Returns the value of attribute head_coach.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#players ⇒ Object
readonly
Returns the value of attribute players.
-
#team_stats ⇒ Object
readonly
Returns the value of attribute team_stats.
Class Method Summary collapse
-
.all ⇒ Object
Returns an array of Team objects.
- .reset ⇒ Object
Instance Attribute Details
#championships ⇒ Object (readonly)
Returns the value of attribute championships.
3 4 5 |
# File 'lib/nba/team.rb', line 3 def championships @championships end |
#conference ⇒ Object (readonly)
Returns the value of attribute conference.
3 4 5 |
# File 'lib/nba/team.rb', line 3 def conference @conference end |
#division ⇒ Object (readonly)
Returns the value of attribute division.
3 4 5 |
# File 'lib/nba/team.rb', line 3 def division @division end |
#founded ⇒ Object (readonly)
Returns the value of attribute founded.
3 4 5 |
# File 'lib/nba/team.rb', line 3 def founded @founded end |
#head_coach ⇒ Object (readonly) Also known as: coach
Returns the value of attribute head_coach.
3 4 5 |
# File 'lib/nba/team.rb', line 3 def head_coach @head_coach end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/nba/team.rb', line 3 def name @name end |
#players ⇒ Object (readonly)
Returns the value of attribute players.
3 4 5 |
# File 'lib/nba/team.rb', line 3 def players @players end |
#team_stats ⇒ Object (readonly)
Returns the value of attribute team_stats.
3 4 5 |
# File 'lib/nba/team.rb', line 3 def team_stats @team_stats end |
Class Method Details
.all ⇒ Object
Returns an array of Team objects
16 17 18 19 20 21 22 23 24 |
# File 'lib/nba/team.rb', line 16 def self.all # Attempt to fetch the result from the Freebase API unless there is a # connection error, in which case read from a fixture file @all ||= begin results_to_team(results_from_freebase) rescue Errno::EHOSTUNREACH, Faraday::Error::ConnectionFailed, Faraday::Error::TimeoutError results_to_team(results_from_cache) end end |
.reset ⇒ Object
26 27 28 |
# File 'lib/nba/team.rb', line 26 def self.reset @all = nil end |