Class: TFS::Client

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

Constant Summary

Constants included from ClassHelpers

TFS::ClassHelpers::SPECIAL_CASES

Constants included from Configuration

TFS::Configuration::CONNECTION_DEFAULTS

Instance Attribute Summary

Attributes included from Configuration

#connection_options, #endpoint, #namespace, #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, namespace, options, password, provider, #reset!, username

Constructor Details

#initialize(options = {}) ⇒ Client

Creates an instance of the client



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

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



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

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

Instance Method Details

#connectObject

Creates the connection to the data provider source



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

def connect
  @connection ||= @provider.new endpoint, client_options
end

#runObject



30
31
32
# File 'lib/tfs/client.rb', line 30

def run
  @connection.execute
end