Class: TFS::Client
- Inherits:
-
Object
- Object
- TFS::Client
- 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
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
Attributes included from Configuration
#connection_options, #password, #provider, #username
Instance Method Summary collapse
-
#connect ⇒ Object
Creates the connection to the data provider source.
-
#initialize(options = {}) ⇒ Client
constructor
Creates an instance of the client.
- #method_missing(method_name, *args, &block) ⇒ Object
- #run ⇒ Object
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(={}) TFS::Configuration.keys.each do |key| instance_variable_set(:"@#{key}", [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
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
15 16 17 |
# File 'lib/tfs/client.rb', line 15 def connection @connection end |
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
15 16 17 |
# File 'lib/tfs/client.rb', line 15 def endpoint @endpoint end |
Instance Method Details
#connect ⇒ Object
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 |
#run ⇒ Object
35 36 37 |
# File 'lib/tfs/client.rb', line 35 def run @connection.execute end |