class KucoinRuby::Exceptions::ResponseError
Attributes
response[R]
Public Class Methods
new(response)
click to toggle source
# File lib/kucoin_ruby/exceptions/response_error.rb, line 6 def initialize(response) @response = response end
Public Instance Methods
error_code()
click to toggle source
# File lib/kucoin_ruby/exceptions/response_error.rb, line 15 def error_code data[:error_code] || data['error_code'] end
to_s()
click to toggle source
Calls superclass method
# File lib/kucoin_ruby/exceptions/response_error.rb, line 10 def to_s super + format(' (%s)', data.map { |k, v| %(#{k}: "#{v}") }.join(', ')) end
Private Instance Methods
data()
click to toggle source
# File lib/kucoin_ruby/exceptions/response_error.rb, line 21 def data @data ||= begin JSON.parse(response.body) rescue JSON::ParserError { error_code: response.code, uri: response.request.last_uri.to_s } end end