Class: Dropmark::Authentication
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Dropmark::Authentication
- Defined in:
- lib/dropmark/authentication.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Authentication
constructor
A new instance of Authentication.
Constructor Details
#initialize(app, options = {}) ⇒ Authentication
Returns a new instance of Authentication.
6 7 8 9 |
# File 'lib/dropmark/authentication.rb', line 6 def initialize(app, ={}) @app = app @options = end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/dropmark/authentication.rb', line 11 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 |