Class: Applitools::Connectivity::ServerConnector

Inherits:
Object
  • Object
show all
Extended by:
Helpers
Defined in:
lib/applitools/connectivity/server_connector.rb

Overview

ServerConnector provides configuration for connecting to Applitools servers. All actual HTTP communication is now handled by the Universal SDK.

Constant Summary collapse

DEFAULT_SERVER_URL =
'https://eyesapi.applitools.com'.freeze
DEFAULT_TIMEOUT =
300_000
API_SESSIONS =
'/api/sessions'.freeze
API_SESSIONS_RUNNING =
API_SESSIONS + '/running/'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

abstract_attr_accessor, abstract_method, env_variable, environment_attribute, environment_variables

Constructor Details

#initialize(url = nil) ⇒ ServerConnector

Returns a new instance of ServerConnector.



25
26
27
# File 'lib/applitools/connectivity/server_connector.rb', line 25

def initialize(url = nil)
  self.server_url = url
end

Instance Attribute Details

#agent_id_procObject (readonly)

Returns the value of attribute agent_id_proc.



22
23
24
# File 'lib/applitools/connectivity/server_connector.rb', line 22

def agent_id_proc
  @agent_id_proc
end

#endpoint_urlObject (readonly)

Returns the value of attribute endpoint_url.



20
21
22
# File 'lib/applitools/connectivity/server_connector.rb', line 20

def endpoint_url
  @endpoint_url
end

#proxyObject

Returns the value of attribute proxy.



21
22
23
# File 'lib/applitools/connectivity/server_connector.rb', line 21

def proxy
  @proxy
end

#server_urlObject

Returns the value of attribute server_url.



19
20
21
# File 'lib/applitools/connectivity/server_connector.rb', line 19

def server_url
  @server_url
end

Instance Method Details

#agent_idObject



33
34
35
36
37
# File 'lib/applitools/connectivity/server_connector.rb', line 33

def agent_id
  return agent_id_proc.call if agent_id_proc
  Applitools::EyesLogger.error('The agent id is not set!')
  "eyes.sdk.ruby/#{Applitools::VERSION}"
end

#obtain_agent_id(&block) ⇒ Object



29
30
31
# File 'lib/applitools/connectivity/server_connector.rb', line 29

def obtain_agent_id(&block)
  @agent_id_proc = block if block_given?
end

#set_proxy(uri, user = nil, password = nil) ⇒ Object



52
53
54
# File 'lib/applitools/connectivity/server_connector.rb', line 52

def set_proxy(uri, user = nil, password = nil)
  self.proxy = Proxy.new uri, user, password
end