Class: Applitools::Connectivity::UserAgentMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/applitools/connectivity/user_agent_middleware.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, params) ⇒ UserAgentMiddleware

Returns a new instance of UserAgentMiddleware.



4
5
6
7
8
# File 'lib/applitools/connectivity/user_agent_middleware.rb', line 4

def initialize(app, params)
  self.app = app
  self.get_user_id_proc = params[:get_user_agent]
  self.server_url_proc = params[:get_server_url]
end

Instance Attribute Details

#appObject

Returns the value of attribute app.



3
4
5
# File 'lib/applitools/connectivity/user_agent_middleware.rb', line 3

def app
  @app
end

#get_user_id_procObject

Returns the value of attribute get_user_id_proc.



3
4
5
# File 'lib/applitools/connectivity/user_agent_middleware.rb', line 3

def get_user_id_proc
  @get_user_id_proc
end

#server_url_procObject

Returns the value of attribute server_url_proc.



3
4
5
# File 'lib/applitools/connectivity/user_agent_middleware.rb', line 3

def server_url_proc
  @server_url_proc
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
# File 'lib/applitools/connectivity/user_agent_middleware.rb', line 10

def call(env)
  # server_url = URI.parse(server_url_proc.call)
  env.request_headers['x-applitools-eyes-client'] = obtain_user_id
  @app.call(env)
end