Class: Faraday::Response::OSResponseRecorder
- Inherits:
-
Middleware
- Object
- Middleware
- Faraday::Response::OSResponseRecorder
- Defined in:
- lib/yao/faraday_middlewares.rb
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/yao/faraday_middlewares.rb', line 108 def on_complete(env) require 'pathname' root = Pathname.new(File.('../../../tmp', __FILE__)) Dir.mkdir(root) unless File.exist?(root) path = [env.method.to_s.upcase, env.url.path.gsub('/', '-')].join("-") + ".json" puts root.join(path) File.open(root.join(path), 'w') do |f| f.write env.body end end |