Sha256: 0f6ee1b56b56953b7ceaf3be6e6abc0a17532200231effb3d8132020b0aa4205

Contents?: true

Size: 660 Bytes

Versions: 1

Compression:

Stored size: 660 Bytes

Contents

require 'digest/md5'

module Hull
  module Request
    class Auth  < Faraday::Middleware

      def call(env)
        env[:request_headers]["Hull-App-Id"] = @credentials[:app_id]
        if !@credentials[:access_token].nil?
          env[:request_headers]["Hull-Access-Token"] = @credentials[:access_token]
        else
          env[:request_headers]["Hull-Access-Token"] = @credentials[:app_secret]
          env[:request_headers]["Hull-User-Id"] = @credentials[:user_id] if @credentials[:user_id]
        end
        @app.call(env)
      end

      def initialize(app, credentials)
        @app, @credentials = app, credentials
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hullio-0.4.0 lib/hull/request/auth.rb