Sha256: c961a5da338580bebb4f7a943cdbf763f0c0dde280ff1dc3cb9193d15004621b

Contents?: true

Size: 633 Bytes

Versions: 6

Compression:

Stored size: 633 Bytes

Contents

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

    def get(path, 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

6 entries across 6 versions & 1 rubygems

Version Path
webdriver-0.5.0 lib/webdriver/prefix_connection.rb
webdriver-0.4.0 lib/webdriver/prefix_connection.rb
webdriver-0.3.0 lib/webdriver/prefix_connection.rb
webdriver-0.2.0 lib/webdriver/prefix_connection.rb
webdriver-0.1.2 lib/webdriver/prefix_connection.rb
webdriver-0.1.1 lib/webdriver/prefix_connection.rb