Class: WorldCup::Results
- Inherits:
-
Object
- Object
- WorldCup::Results
- Defined in:
- lib/world_cup/results.rb
Constant Summary collapse
- SFG_ENDPOINT =
'http://worldcup.sfg.io/matches'
Instance Attribute Summary collapse
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Results
constructor
A new instance of Results.
- #render ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Results
Returns a new instance of Results.
14 15 16 17 18 19 20 |
# File 'lib/world_cup/results.rb', line 14 def initialize(opts={}) @opts = opts @raw_response = nil @response = nil @rows = nil @table = nil end |
Instance Attribute Details
#raw_response ⇒ Object (readonly)
Returns the value of attribute raw_response.
12 13 14 |
# File 'lib/world_cup/results.rb', line 12 def raw_response @raw_response end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
12 13 14 |
# File 'lib/world_cup/results.rb', line 12 def response @response end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
12 13 14 |
# File 'lib/world_cup/results.rb', line 12 def table @table end |
Instance Method Details
#render ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/world_cup/results.rb', line 22 def render unless retrieve puts "Sorry, #{SFG_ENDPOINT} could not be reached. Please check your internet connection and try again." return end unless convert puts "Sorry, the response at #{SFG_ENDPOINT} could not be interpreted. Please try again." return end select_matches compose_table puts @table end |