Module: Betfair::API::ErrorPresenter
- Defined in:
- lib/betfair/api.rb
Overview
Mix this into a Hash to give it basic error reporting and a nice path-based data extractor.
Instance Method Summary collapse
Instance Method Details
#format_error ⇒ Object
296 297 298 |
# File 'lib/betfair/api.rb', line 296 def format_error "#{self[:error_code]} - #{self[:header][:error_code]}" end |
#maybe_result(*path) ⇒ Object
301 302 303 |
# File 'lib/betfair/api.rb', line 301 def maybe_result( *path ) success? ? path.inject(self){|m,r| m[r]} : format_error() end |
#success? ⇒ Boolean
291 292 293 |
# File 'lib/betfair/api.rb', line 291 def success? self[:error_code] == "OK" end |