Exception: MLB::HTTPError
- Defined in:
- lib/mlb/errors/http_error.rb
Overview
HTTP error raised when an API request fails
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ String
readonly
Returns the HTTP status code.
-
#response ⇒ Net::HTTPResponse
readonly
Returns the HTTP response.
Instance Method Summary collapse
-
#initialize(response:) ⇒ HTTPError
constructor
Initializes a new HTTPError instance.
Constructor Details
#initialize(response:) ⇒ HTTPError
Initializes a new HTTPError instance
28 29 30 31 32 |
# File 'lib/mlb/errors/http_error.rb', line 28 def initialize(response:) super(response.) @response = response @code = response.code end |
Instance Attribute Details
#code ⇒ String (readonly)
Returns the HTTP status code
20 21 22 |
# File 'lib/mlb/errors/http_error.rb', line 20 def code @code end |
#response ⇒ Net::HTTPResponse (readonly)
Returns the HTTP response
12 13 14 |
# File 'lib/mlb/errors/http_error.rb', line 12 def response @response end |