Class: Whatconverts::ErrorChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/whatconverts/error_checker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_response) ⇒ ErrorChecker

Returns a new instance of ErrorChecker.



6
7
8
# File 'lib/whatconverts/error_checker.rb', line 6

def initialize(api_response)
  @api_response = api_response
end

Instance Attribute Details

#api_responseObject (readonly)

Returns the value of attribute api_response.



4
5
6
# File 'lib/whatconverts/error_checker.rb', line 4

def api_response
  @api_response
end

Instance Method Details

#error_if_appropriateObject



10
11
12
13
# File 'lib/whatconverts/error_checker.rb', line 10

def error_if_appropriate
  return AuthError.new(response_body) if is_auth_error?
  return ApiError.new(response_body) if is_error?
end