Exception: CoinMarketCap::Errors::ClientError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/coinmarketcap/errors/client_error.rb

Direct Known Subclasses

PermissionDeniedError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ClientError

Returns a new instance of ClientError.



6
7
8
9
# File 'lib/coinmarketcap/errors/client_error.rb', line 6

def initialize(response)
  @response = response
  super error
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



4
5
6
# File 'lib/coinmarketcap/errors/client_error.rb', line 4

def response
  @response
end

Instance Method Details

#bodyObject



19
20
21
# File 'lib/coinmarketcap/errors/client_error.rb', line 19

def body
  response[:body]
end

#errorObject



11
12
13
14
15
16
17
# File 'lib/coinmarketcap/errors/client_error.rb', line 11

def error
  if body.is_a?(Hash) && body.key?('error')
    body['error']
  else
    body
  end
end