Class: MLB::Team
- Inherits:
-
Object
- Object
- MLB::Team
- Defined in:
- lib/mlb/team.rb
Instance Attribute Summary collapse
-
#ballpark ⇒ Object
readonly
Returns the value of attribute ballpark.
-
#division ⇒ Object
readonly
Returns the value of attribute division.
-
#founded ⇒ Object
readonly
Returns the value of attribute founded.
-
#league ⇒ Object
readonly
Returns the value of attribute league.
-
#logo_url ⇒ Object
readonly
Returns the value of attribute logo_url.
-
#losses ⇒ Object
readonly
Returns the value of attribute losses.
-
#manager ⇒ Object
readonly
Returns the value of attribute manager.
-
#mascot ⇒ Object
readonly
Returns the value of attribute mascot.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#players ⇒ Object
readonly
Returns the value of attribute players.
-
#wins ⇒ Object
readonly
Returns the value of attribute wins.
Class Method Summary collapse
-
.all ⇒ Object
Returns an array of Team objects.
- .reset ⇒ Object
Instance Attribute Details
#ballpark ⇒ Object (readonly)
Returns the value of attribute ballpark.
7 8 9 |
# File 'lib/mlb/team.rb', line 7 def ballpark @ballpark end |
#division ⇒ Object (readonly)
Returns the value of attribute division.
7 8 9 |
# File 'lib/mlb/team.rb', line 7 def division @division end |
#founded ⇒ Object (readonly)
Returns the value of attribute founded.
7 8 9 |
# File 'lib/mlb/team.rb', line 7 def founded @founded end |
#league ⇒ Object (readonly)
Returns the value of attribute league.
7 8 9 |
# File 'lib/mlb/team.rb', line 7 def league @league end |
#logo_url ⇒ Object (readonly)
Returns the value of attribute logo_url.
7 8 9 |
# File 'lib/mlb/team.rb', line 7 def logo_url @logo_url end |
#losses ⇒ Object (readonly)
Returns the value of attribute losses.
7 8 9 |
# File 'lib/mlb/team.rb', line 7 def losses @losses end |
#manager ⇒ Object (readonly)
Returns the value of attribute manager.
7 8 9 |
# File 'lib/mlb/team.rb', line 7 def manager @manager end |
#mascot ⇒ Object (readonly)
Returns the value of attribute mascot.
7 8 9 |
# File 'lib/mlb/team.rb', line 7 def mascot @mascot end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/mlb/team.rb', line 7 def name @name end |
#players ⇒ Object (readonly)
Returns the value of attribute players.
7 8 9 |
# File 'lib/mlb/team.rb', line 7 def players @players end |
#wins ⇒ Object (readonly)
Returns the value of attribute wins.
7 8 9 |
# File 'lib/mlb/team.rb', line 7 def wins @wins end |
Class Method Details
.all ⇒ Object
Returns an array of Team objects
25 26 27 28 29 30 31 32 33 |
# File 'lib/mlb/team.rb', line 25 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 Faraday::Error::ConnectionFailed, Faraday::Error::TimeoutError results_to_team(results_from_cache) end end |
.reset ⇒ Object
35 36 37 |
# File 'lib/mlb/team.rb', line 35 def self.reset @all = nil end |