Class: RadiumIo::Engine::Authorization

Inherits:
Object
  • Object
show all
Defined in:
lib/radium_io/engine.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Authorization

Returns a new instance of Authorization.



10
11
12
# File 'lib/radium_io/engine.rb', line 10

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/radium_io/engine.rb', line 14

def call(env)
  raise AuthenticationMissing unless config.user_id.present? && config.app_id.present?

  env['HTTP_X_USER_ID'] = config.user_id
  env['HTTP_X_APP_ID'] = config.app_id
  @app.call env
end

#configObject



22
23
24
# File 'lib/radium_io/engine.rb', line 22

def config
  Rails.application.config.radium_io
end