Module: TFS::Configuration

Extended by:
Forwardable
Included in:
TFS, Client
Defined in:
lib/tfs/configuration.rb

Constant Summary collapse

CONNECTION_DEFAULTS =
{
  rest_options: {
    headers: {
      user_agent: "TFS Ruby Gem"
    },
    request: {
      open_timeout: 5,
      timeout: 10,
    },
  },
  verify_ssl: false
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#connection_optionsObject

Returns the value of attribute connection_options.



8
9
10
# File 'lib/tfs/configuration.rb', line 8

def connection_options
  @connection_options
end

#endpointObject

Returns the value of attribute endpoint.



8
9
10
# File 'lib/tfs/configuration.rb', line 8

def endpoint
  @endpoint
end

#namespaceObject

Returns the value of attribute namespace.



8
9
10
# File 'lib/tfs/configuration.rb', line 8

def namespace
  @namespace
end

#password=(value) ⇒ Object (writeonly)

Sets the attribute password

Parameters:

  • value

    the value to set the attribute password to.



7
8
9
# File 'lib/tfs/configuration.rb', line 7

def password=(value)
  @password = value
end

#providerObject

Returns the value of attribute provider.



8
9
10
# File 'lib/tfs/configuration.rb', line 8

def provider
  @provider
end

#username=(value) ⇒ Object (writeonly)

Sets the attribute username

Parameters:

  • value

    the value to set the attribute username to.



7
8
9
# File 'lib/tfs/configuration.rb', line 7

def username=(value)
  @username = value
end

Class Method Details

.connection_optionsObject



37
38
39
# File 'lib/tfs/configuration.rb', line 37

def connection_options
  CONNECTION_DEFAULTS
end

.endpointObject



49
50
51
# File 'lib/tfs/configuration.rb', line 49

def endpoint
  ENV['TFS_ENDPOINT']
end

.keysObject



26
27
28
29
30
31
32
33
34
35
# File 'lib/tfs/configuration.rb', line 26

def keys
  @keys ||= [
    :username,
    :password,
    :endpoint,
    :connection_options,
    :provider,
    :namespace
  ]
end

.namespaceObject

No default namespace



62
# File 'lib/tfs/configuration.rb', line 62

def namespace ; end

.optionsObject



57
58
59
# File 'lib/tfs/configuration.rb', line 57

def options
  Hash[Configuration.keys.map{|key| [key, send(key)]}]
end

.passwordObject



45
46
47
# File 'lib/tfs/configuration.rb', line 45

def password
  ENV['TFS_PASSWORD']
end

.providerObject



53
54
55
# File 'lib/tfs/configuration.rb', line 53

def provider
  OData::Service
end

.usernameObject



41
42
43
# File 'lib/tfs/configuration.rb', line 41

def username
  ENV['TFS_USERNAME']
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



65
66
67
68
# File 'lib/tfs/configuration.rb', line 65

def configure
  yield self
  self
end

#reset!Object Also known as: setup



70
71
72
73
74
75
# File 'lib/tfs/configuration.rb', line 70

def reset!
  TFS::Configuration.keys.each do |key|
    instance_variable_set(:"@#{key}", Configuration.options[key])
  end
  self
end