Class: Async::Webdriver::ConnectionPath

Inherits:
Object
  • Object
show all
Defined in:
lib/async/webdriver/connection_path.rb

Instance Method Summary collapse

Constructor Details

#initialize(prefix, connection:) ⇒ ConnectionPath

Returns a new instance of ConnectionPath.



9
10
11
12
# File 'lib/async/webdriver/connection_path.rb', line 9

def initialize(prefix, connection:)
  @connection = connection
  @prefix = prefix
end

Instance Method Details

#call(method:, path: nil, headers: [], body: nil) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/async/webdriver/connection_path.rb', line 14

def call(method:, path:nil, headers:[], body:nil)
  connection_path = if path
    "#{@prefix}/#{path}"
  else
    "#{@prefix}"
  end

  @connection.call method: method, path: connection_path, headers: headers, body: body
end