Sha256: d197e86e572ef1870b557eed521bf8f7d732b676274a76cddb72b76603075010

Contents?: true

Size: 520 Bytes

Versions: 5

Compression:

Stored size: 520 Bytes

Contents

# frozen_string_literal: true

require 'faraday'
require 'truelayer/version'

module Truelayer
  class FaradayAuth < Faraday::Middleware
    def initialize(app, token, options = {})
      super(app)
      @token = token
      @options = options
    end

    def call(env)
      env[:request_headers]['Authorization'] = "Bearer #{@token}"
      env[:request_headers]['Content-Type'] = 'application/json'
      env[:request_headers]['User-Agent'] = "finpoint/#{Truelayer::VERSION}"

      @app.call(env)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
truelayer-0.1.4 lib/truelayer/faraday_auth.rb
truelayer-0.1.3 lib/truelayer/faraday_auth.rb
truelayer-0.1.2 lib/truelayer/faraday_auth.rb
truelayer-0.1.1 lib/truelayer/faraday_auth.rb
truelayer-0.1.0 lib/truelayer/faraday_auth.rb