Class: NimbusSecure::AuthenticationMiddleware
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- NimbusSecure::AuthenticationMiddleware
- Defined in:
- lib/nimbussecure/connect.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, apikey) ⇒ AuthenticationMiddleware
constructor
A new instance of AuthenticationMiddleware.
- #set_header(env, header, value) ⇒ Object
Constructor Details
#initialize(app, apikey) ⇒ AuthenticationMiddleware
Returns a new instance of AuthenticationMiddleware.
43 44 45 46 |
# File 'lib/nimbussecure/connect.rb', line 43 def initialize(app,apikey) super(app) @apikey=apikey end |
Instance Method Details
#call(env) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/nimbussecure/connect.rb', line 47 def call(env) set_header env,'X-Nimbus-Component-Key',@apikey set_header env,'X-Nimbus-Client-Version',NimbusSecure::VERSION set_header env,'X-Nimbus-Client',"muskratsoftware/NimbusSecureClient" set_header env,'X-Nimbus-Language',"ruby" @app.call(env) end |
#set_header(env, header, value) ⇒ Object
54 55 56 57 58 |
# File 'lib/nimbussecure/connect.rb', line 54 def set_header(env,header,value) unless env[:request_headers][header] env[:request_headers][header] = value end end |