Class: Ey::Core::TokenAuthentication

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/ey-core/token_authentication.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, token) ⇒ TokenAuthentication

Returns a new instance of TokenAuthentication.



4
5
6
7
# File 'lib/ey-core/token_authentication.rb', line 4

def initialize(app, token)
  super(app)
  @token = token
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



2
3
4
# File 'lib/ey-core/token_authentication.rb', line 2

def token
  @token
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
# File 'lib/ey-core/token_authentication.rb', line 9

def call(env)
  env[:request_headers]["X-EY-TOKEN"] = token
  super
end