Sha256: f08980d1060f9ccdc52913b1bcff914654a606c50a84bc3b13497758d55f5c5f
Contents?: true
Size: 1.32 KB
Versions: 3
Compression:
Stored size: 1.32 KB
Contents
require 'faraday' module CloudAlly # @private module Connection private def connection options = { headers: { 'Accept': "application/#{format}; charset=utf-8", 'User-Agent': user_agent }, url: endpoint }.merge(connection_options) Faraday::Connection.new(options) do |connection| connection.use Faraday::Response::RaiseError connection.adapter Faraday.default_adapter connection.authorization :Bearer, access_token if access_token connection.headers['client-id'] = client_id connection.headers['client-secret'] = client_secret connection.response :json, content_type: /\bjson$/ connection.use Faraday::Request::UrlEncoded setup_logger_filtering(connection,logger) if logger end end def setup_logger_filtering(connection,logger) connection.response :logger, logger, { headers: true, bodies: true } do |l| # filter json content l.filter(/("password":")(.+?)(".*)/, '\1[REMOVED]\3') l.filter(/("accessToken":")(.+?)(".*)/, '\1[REMOVED]\3') # filter header content l.filter(/(client-secret\:.)([^&]+)/, '\1[REMOVED]') l.filter(/(Authorization\:.)([^&]+)/, '\1[REMOVED]') end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cloudally-0.2.0 | lib/cloudally/connection.rb |
cloudally-0.1.3 | lib/cloudally/connection.rb |
cloudally-0.1.2 | lib/cloudally/connection.rb |