Class: Webdriver::PrefixConnection

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

Instance Method Summary collapse

Constructor Details

#initialize(prefix, connection) ⇒ PrefixConnection

Returns a new instance of PrefixConnection.



3
4
5
6
# File 'lib/webdriver/prefix_connection.rb', line 3

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

Instance Method Details

#call(method, path = nil, headers = {}, body = nil) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/webdriver/prefix_connection.rb', line 20

def call method, path=nil, headers={}, body=nil
  prefixed_path = if path
    "#{@prefix}/#{path}"
  else
    "#{@prefix}"
  end

  @connection.call method, prefixed_path, headers, body
end

#delete(path = nil, headers = {}, body = nil) ⇒ Object



16
17
18
# File 'lib/webdriver/prefix_connection.rb', line 16

def delete path=nil, headers={}, body=nil
  call :delete, path, headers, body
end

#get(path = nil, headers = {}) ⇒ Object



8
9
10
# File 'lib/webdriver/prefix_connection.rb', line 8

def get path=nil, headers={}
  call :get, path, headers
end

#post(path = nil, headers = {}, body = nil) ⇒ Object



12
13
14
# File 'lib/webdriver/prefix_connection.rb', line 12

def post path=nil, headers={}, body=nil
  call :post, path, headers, body
end