Sha256: fdaf0c8a464639aa03a094c810b8524de3935675036ac76b464ae580cbd27b7b
Contents?: true
Size: 510 Bytes
Versions: 1
Compression:
Stored size: 510 Bytes
Contents
require 'base64' module Dropmark class Authentication < Faraday::Middleware def initialize(app, options={}) @app = app @options = options end def call(env) if Dropmark.user_id basic_auth = Base64.encode64([Dropmark.user_id, Dropmark.user_token].join(':')).to_s.gsub!("\n", '') env[:request_headers]["Authorization"] = "Basic #{basic_auth}" end env[:request_headers]["X-API-Key"] = Dropmark.api_key @app.call(env) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dropmark-0.1.5 | lib/dropmark/authentication.rb |