Class: Soundcloud::Middleware::RaiseError

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/soundcloud/middleware.rb

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object



9
10
11
12
13
14
# File 'lib/soundcloud/middleware.rb', line 9

def on_complete(env)
  case env[:status]
  when 400...600
    raise Soundcloud::Error[env[:status]], response_values(env)
  end
end

#response_values(env) ⇒ Object



16
17
18
# File 'lib/soundcloud/middleware.rb', line 16

def response_values(env)
  {:status => env[:status], :headers => env[:response_headers], :body => env[:body]}
end