class Rainforest::ApiError
Attributes
api_method[R]
Public Class Methods
new(message=nil, api_method=nil)
click to toggle source
# File lib/rainforest/errors/api_error.rb, line 5 def initialize(message=nil, api_method=nil) @message = message @api_method = api_method end
Public Instance Methods
body()
click to toggle source
# File lib/rainforest/errors/api_error.rb, line 14 def body @api_method.response_body if @api_method end
code()
click to toggle source
# File lib/rainforest/errors/api_error.rb, line 10 def code @api_method.response_code if @api_method end
json()
click to toggle source
# File lib/rainforest/errors/api_error.rb, line 18 def json begin if @api_method hash = @api_method.response_json return ApiObject.construct(hash) end rescue ApiError nil end end
to_s()
click to toggle source
# File lib/rainforest/errors/api_error.rb, line 29 def to_s prefix = code.nil? ? "" : "(Status #{code}) " "#{prefix}#{@message}" end