class Selligent::Middlewares::Authorization
Auth is a Faraday middleware
Constants
- AUTH_HEADER
Public Class Methods
setup!()
click to toggle source
# File lib/selligent/middlewares/authorization.rb, line 18 def self.setup! Faraday::Request.register_middleware selligent_auth: -> { self } end
Public Instance Methods
auth_header()
click to toggle source
# File lib/selligent/middlewares/authorization.rb, line 22 def auth_header "#{Selligent.config.api_key}:#{Selligent.config.api_secret}" end
call(env)
click to toggle source
# File lib/selligent/middlewares/authorization.rb, line 13 def call(env) env[:request_headers][AUTH_HEADER] = auth_header @app.call(env) end