class BN::Middleware::APIResponse
Checks the JSON API
response to see if it is an error.
Public Instance Methods
execute(data)
click to toggle source
Execute the middleware.
@param [#to_h] data @return [Hash]
# File lib/bn/middleware/api_error.rb, line 12 def execute(data) data = data.to_h raise BN::Error::Middleware::InvalidAPIRequest, data if error?(data) data end
Protected Instance Methods
error?(data)
click to toggle source
# File lib/bn/middleware/api_error.rb, line 22 def error?(data) data.keys.sort == [:code, :reason].sort end