Sha256: 0b6cd1953841bd120fecc819046776dbd370b7ac7bc29716531fd44a12a40e9f

Contents?: true

Size: 635 Bytes

Versions: 19

Compression:

Stored size: 635 Bytes

Contents

module Webdriver
  class PrefixConnection
    def initialize(prefix, connection)
      @prefix = prefix
      @connection = connection
    end

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

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

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

    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
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
webdriver-0.19.0 lib/webdriver/prefix_connection.rb
webdriver-0.18.0 lib/webdriver/prefix_connection.rb
webdriver-0.17.0 lib/webdriver/prefix_connection.rb
webdriver-0.16.0 lib/webdriver/prefix_connection.rb
webdriver-0.15.0 lib/webdriver/prefix_connection.rb
webdriver-0.14.0 lib/webdriver/prefix_connection.rb
webdriver-0.13.0 lib/webdriver/prefix_connection.rb
webdriver-0.12.0 lib/webdriver/prefix_connection.rb
webdriver-0.11.1 lib/webdriver/prefix_connection.rb
webdriver-0.11.0 lib/webdriver/prefix_connection.rb
webdriver-0.10.0 lib/webdriver/prefix_connection.rb
webdriver-0.9.1 lib/webdriver/prefix_connection.rb
webdriver-0.9.0 lib/webdriver/prefix_connection.rb
webdriver-0.8.0 lib/webdriver/prefix_connection.rb
webdriver-0.7.0 lib/webdriver/prefix_connection.rb
webdriver-0.6.4 lib/webdriver/prefix_connection.rb
webdriver-0.6.3 lib/webdriver/prefix_connection.rb
webdriver-0.6.2 lib/webdriver/prefix_connection.rb
webdriver-0.6.0 lib/webdriver/prefix_connection.rb