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.
6 7 8 |
# File 'lib/mlb/team.rb', line 6 def ballpark @ballpark end |
#division ⇒ Object (readonly)
Returns the value of attribute division.
6 7 8 |
# File 'lib/mlb/team.rb', line 6 def division @division end |
#founded ⇒ Object (readonly)
Returns the value of attribute founded.
6 7 8 |
# File 'lib/mlb/team.rb', line 6 def founded @founded end |
#league ⇒ Object (readonly)
Returns the value of attribute league.
6 7 8 |
# File 'lib/mlb/team.rb', line 6 def league @league end |
#logo_url ⇒ Object (readonly)
Returns the value of attribute logo_url.
6 7 8 |
# File 'lib/mlb/team.rb', line 6 def logo_url @logo_url end |
#losses ⇒ Object (readonly)
Returns the value of attribute losses.
6 7 8 |
# File 'lib/mlb/team.rb', line 6 def losses @losses end |
#manager ⇒ Object (readonly)
Returns the value of attribute manager.
6 7 8 |
# File 'lib/mlb/team.rb', line 6 def manager @manager end |
#mascot ⇒ Object (readonly)
Returns the value of attribute mascot.
6 7 8 |
# File 'lib/mlb/team.rb', line 6 def mascot @mascot end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/mlb/team.rb', line 6 def name @name end |
#players ⇒ Object (readonly)
Returns the value of attribute players.
6 7 8 |
# File 'lib/mlb/team.rb', line 6 def players @players end |
#wins ⇒ Object (readonly)
Returns the value of attribute wins.
6 7 8 |
# File 'lib/mlb/team.rb', line 6 def wins @wins end |
Class Method Details
.all ⇒ Object
Returns an array of Team objects
24 25 26 27 28 29 30 31 32 |
# File 'lib/mlb/team.rb', line 24 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
34 35 36 |
# File 'lib/mlb/team.rb', line 34 def self.reset @all = nil end |