Class: TFS::Client

Inherits:
Object
  • Object
show all
Extended by:
ClassHelpers
Includes:
Configuration
Defined in:
lib/tfs/client.rb

Constant Summary collapse

PROVIDER_OPTIONS =

Options specific to the provider (odata in this case)

[:username, :password, :verify_ssl]

Constants included from ClassHelpers

TFS::ClassHelpers::SPECIAL_CASES

Constants included from Configuration

TFS::Configuration::CONNECTION_OPTIONS

Instance Attribute Summary collapse

Attributes included from Configuration

#connection_options, #password, #provider, #username

Instance Method Summary collapse

Methods included from ClassHelpers

base_class, method_name_from_class, odata_class_from_method_name

Methods included from Configuration

#configure, connection_options, endpoint, keys, options, password, provider, #reset!, username

Constructor Details

#initialize(options = {}) ⇒ Client

Creates an instance of the client



18
19
20
21
22
# File 'lib/tfs/client.rb', line 18

def initialize(options={})
  TFS::Configuration.keys.each do |key|
    instance_variable_set(:"@#{key}", options[key] || TFS.instance_variable_get(:"@#{key}"))
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



39
40
41
42
# File 'lib/tfs/client.rb', line 39

def method_missing(method_name, *args, &block)
  return super unless @connection.respond_to? method_name
  @connection.send(method_name, *args, &block)
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



15
16
17
# File 'lib/tfs/client.rb', line 15

def connection
  @connection
end

#endpointObject (readonly)

Returns the value of attribute endpoint.



15
16
17
# File 'lib/tfs/client.rb', line 15

def endpoint
  @endpoint
end

Instance Method Details

#connectObject

Creates the connection to the data provider source



25
26
27
# File 'lib/tfs/client.rb', line 25

def connect
  @connection = @provider.new endpoint, opts_for_connection
end

#runObject



35
36
37
# File 'lib/tfs/client.rb', line 35

def run
  @connection.execute
end