class QTest::Client

Public Class Methods

new(_opts = {}) click to toggle source
# File lib/qtest/client.rb, line 5
def initialize(_opts = {})
  define_base_client
  define_base_instance_client
end

Public Instance Methods

base_uri() click to toggle source

Get the base URI registered for the Client.

@example

client = Client.new.configure do |c|
  c.base_uri = 'http://qtest.mycompany.com'
end

client.base_uri #=> 'http://qtest.mycompany.com'

@return [String]

# File lib/qtest/client.rb, line 34
def base_uri
  self.class.base_uri
end
base_uri=(uri) click to toggle source

Set the base URI for the Client.

@param uri [String] host/address

# File lib/qtest/client.rb, line 41
def base_uri=(uri)
  self.class.send(:base_uri, uri)
  @base_uri = uri
end
configure() { |self| ... } click to toggle source

Configure the Client.

## Example

client = Client.new.configure do |c|
  c.base_uri = 'http//qtest.mycompany.com'
end
# File lib/qtest/client.rb, line 18
def configure
  yield self
  self
end

Private Instance Methods

define_base_client() click to toggle source

@api private

# File lib/qtest/client.rb, line 49
def define_base_client
  this = self
  QTest::Base.send(:define_singleton_method, :client) do
    this
  end
end
define_base_instance_client() click to toggle source

@api private

# File lib/qtest/client.rb, line 57
def define_base_instance_client
  this = self
  QTest::Base.send(:define_method, :client) do
    this
  end
end