Exception: Anilibria::Api::Exceptions::ApiError

Inherits:
ResponseError show all
Defined in:
lib/anilibria/api/exceptions/api_error.rb

Instance Attribute Summary collapse

Attributes inherited from ResponseError

#response

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ApiError

Returns a new instance of ApiError.



7
8
9
10
11
12
# File 'lib/anilibria/api/exceptions/api_error.rb', line 7

def initialize(response)
  error = response.body[:error].to_h
  @code = error[:code]

  super(error[:message], response)
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



5
6
7
# File 'lib/anilibria/api/exceptions/api_error.rb', line 5

def code
  @code
end