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,
  eager_partial: false  # currently TFS pagination is broken, remove this once fixed
}

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



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

def connection_options
  CONNECTION_DEFAULTS
end

.endpointObject



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

def endpoint
  ENV['TFS_ENDPOINT']
end

.keysObject



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

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

.namespaceObject

No default namespace



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

def namespace ; end

.optionsObject



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

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

.passwordObject



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

def password
  ENV['TFS_PASSWORD']
end

.providerObject



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

def provider
  OData::Service
end

.usernameObject



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

def username
  ENV['TFS_USERNAME']
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



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

def configure
  yield self
  self
end

#reset!Object Also known as: setup



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

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