class MyJohnDeere::MyJohnDeereError
MyJohnDeereError
is the base error from which all other more specific MyJohnError errors derive.
Attributes
http_body[R]
These fields are now available as part of response
and that usage should be preferred.
http_headers[R]
http_status[R]
message[R]
response[RW]
Public Class Methods
new(message=nil, http_status: nil, http_body: nil, http_headers: nil, my_john_deere_response: nil)
click to toggle source
Initializes a MyJohnDeereError
.
# File lib/myjohndeere/errors.rb, line 15 def initialize(message=nil, http_status: nil, http_body: nil, http_headers: nil, my_john_deere_response: nil) @message = message if my_john_deere_response.is_a?(MyJohnDeere::Response) then self.response = my_john_deere_response http_status = my_john_deere_response.http_status http_body = my_john_deere_response.http_body http_headers = my_john_deere_response.http_headers end @http_status = http_status @http_body = http_body @http_headers = http_headers || {} end
Public Instance Methods
to_s()
click to toggle source
# File lib/myjohndeere/errors.rb, line 29 def to_s status_string = @http_status.nil? ? "" : "(Status #{@http_status}) " id_string = @request_id.nil? ? "" : "(Request #{@request_id}) " "#{status_string}#{id_string}#{@message}" end