Sha256: f511ca928b45ebaa04eb1c69c5b35c48be5148dbeed9c56083d4ae7763f779fc

Contents?: true

Size: 929 Bytes

Versions: 5

Compression:

Stored size: 929 Bytes

Contents

require 'faraday_middleware'
Dir[File.expand_path('../faraday/*.rb', __dir__)].sort.each { |f| require f }

module FirebaseAdmin
  # @private
  module Connection
    private

    def connection
      options = {
        headers: {
          'Content-Type' => 'application/json; charset=utf-8',
          'Accept' => 'application/json; charset=utf-8',
          'User-Agent' => user_agent
        },
        url: endpoint
      }.merge(connection_options)

      Faraday::Connection.new(options) do |connection|
        connection.authorization :Bearer, access_token if access_token
        connection.use Faraday::Request::UrlEncoded
        connection.use FaradayMiddleware::Mashify
        connection.use Faraday::Response::ParseJson
        connection.use FaradayMiddleware::RaiseHttpException
        connection.use FaradayMiddleware::LoudLogger if loud_logger
        connection.adapter(adapter)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
firebase-admin-0.1.4 lib/firebase-admin/connection.rb
firebase-admin-0.1.3 lib/firebase-admin/connection.rb
firebase-admin-0.1.2 lib/firebase-admin/connection.rb
firebase-admin-0.1.1 lib/firebase-admin/connection.rb
firebase-admin-0.1.0 lib/firebase-admin/connection.rb