Sha256: 2c12dd7c976722c21c5e42fb482ea57bbc9bf6045a75fb9a970a213e083905ca

Contents?: true

Size: 1.25 KB

Versions: 11

Compression:

Stored size: 1.25 KB

Contents

module Slack
  module Web
    module Faraday
      module Connection
        private

        def connection
          options = {
            headers: { 'Accept' => 'application/json; charset=utf-8' }
          }

          options[:headers]['User-Agent'] = user_agent if user_agent
          options[:proxy] = proxy if proxy
          options[:ssl] = { ca_path: ca_path, ca_file: ca_file } if ca_path || ca_file

          request_options = {}
          request_options[:timeout] = timeout if timeout
          request_options[:open_timeout] = open_timeout if open_timeout
          options[:request] = request_options if request_options.any?

          ::Faraday::Connection.new(endpoint, options) do |connection|
            connection.use ::Faraday::Request::Multipart
            connection.use ::Faraday::Request::UrlEncoded
            connection.use ::Faraday::Response::RaiseError
            connection.use ::Slack::Web::Faraday::Response::RaiseError
            connection.use ::FaradayMiddleware::Mashify, mash_class: Slack::Messages::Message
            connection.use ::FaradayMiddleware::ParseJson
            connection.response :logger, logger if logger
            connection.adapter ::Faraday.default_adapter
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
slack-ruby-client-0.14.4 lib/slack/web/faraday/connection.rb
slack-ruby-client-0.14.3 lib/slack/web/faraday/connection.rb
slack-ruby-client-0.14.2 lib/slack/web/faraday/connection.rb
slack-ruby-client-0.14.1 lib/slack/web/faraday/connection.rb
slack-ruby-client-0.14.0 lib/slack/web/faraday/connection.rb
slack-ruby-client-0.13.1 lib/slack/web/faraday/connection.rb
slack-ruby-client-0.13.0 lib/slack/web/faraday/connection.rb
slack-ruby-client-0.12.0 lib/slack/web/faraday/connection.rb
slack-ruby-client-0.11.1 lib/slack/web/faraday/connection.rb
slack-ruby-client-0.11.0 lib/slack/web/faraday/connection.rb
slack-ruby-client-0.10.0 lib/slack/web/faraday/connection.rb