Sha256: 4d9a0cf147751eec5a6652682f1260b702e4b96c57ad9b8c886935afca29ace6

Contents?: true

Size: 477 Bytes

Versions: 46

Compression:

Stored size: 477 Bytes

Contents

class Gillbus
  class FaradayResponseFileLogger < Faraday::Middleware
    def initialize(app, dir = '.')
      @dir = dir
      super(app)
    end

    def call(env)
      path = env.url.path
      @app.call(env).on_complete do |_environment|
        sanitized_path = path.gsub(/[^A-Za-z0-9_-]+/, '_').gsub(/^_|_$/, '')
        sanitized_path = '_' if sanitized_path == ''
        File.write(@dir + '/' + sanitized_path, env.body) if env.body != ''
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
gillbus-0.23.0 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.22.9 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.22.8 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.22.7 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.22.6 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.22.5 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.22.4 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.22.3 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.22.2 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.22.1 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.22.0 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.21.0 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.20.9 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.20.8 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.20.7 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.20.6 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.20.5 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.20.4 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.20.3 lib/gillbus/drivers/faraday_response_file_logger.rb
gillbus-0.20.2 lib/gillbus/drivers/faraday_response_file_logger.rb