Class: Arisaid::Faraday::Response
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Arisaid::Faraday::Response
- Defined in:
- lib/arisaid/faraday/response.rb
Instance Method Summary collapse
Instance Method Details
#call(env) ⇒ Object
4 5 6 7 8 |
# File 'lib/arisaid/faraday/response.rb', line 4 def call(env) @app.call(env).on_complete do |_env| show_response(_env) if Arisaid.debug? && defined?(AwesomePrint) end end |
#show_response(env) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/arisaid/faraday/response.rb', line 10 def show_response(env) require 'awesome_print' env.response.to_hash.slice(*valid_debug_attributes).each do |k, v| if k == :body k = :response_body v = Sawyer::Agent.serializer.decode(v) end puts "#{k}:" ap v end end |
#valid_debug_attributes ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/arisaid/faraday/response.rb', line 24 def valid_debug_attributes %i( status body response_headers ) end |