Class: CFoundry::V2::Base

Inherits:
BaseClient show all
Defined in:
lib/cfoundry/v2/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseClient

#request_path

Constructor Details

#initialize(target = "https://api.cloudfoundry.com", token = nil) ⇒ Base

Returns a new instance of Base.



13
14
15
16
17
18
# File 'lib/cfoundry/v2/base.rb', line 13

def initialize(
    target = "https://api.cloudfoundry.com",
    token = nil)
  @target = target
  @token = token
end

Instance Attribute Details

#proxyObject

Returns the value of attribute proxy.



11
12
13
# File 'lib/cfoundry/v2/base.rb', line 11

def proxy
  @proxy
end

#targetObject

Returns the value of attribute target.



11
12
13
# File 'lib/cfoundry/v2/base.rb', line 11

def target
  @target
end

#tokenObject

Returns the value of attribute token.



11
12
13
# File 'lib/cfoundry/v2/base.rb', line 11

def token
  @token
end

#traceObject

Returns the value of attribute trace.



11
12
13
# File 'lib/cfoundry/v2/base.rb', line 11

def trace
  @trace
end

Instance Method Details

#infoObject

Cloud metadata



44
45
46
# File 'lib/cfoundry/v2/base.rb', line 44

def info
  get("info", nil => :json)
end

#uaaObject

The UAA used for this client.

‘false` if no UAA (legacy)



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/cfoundry/v2/base.rb', line 30

def uaa
  return @uaa unless @uaa.nil?

  endpoint = info[:authorization_endpoint]
  return @uaa = false unless endpoint

  @uaa = CFoundry::UAAClient.new(endpoint)
  @uaa.trace = @trace
  @uaa.token = @token
  @uaa
end