Class: CFoundry::BaseClient
- Inherits:
-
Object
- Object
- CFoundry::BaseClient
- Defined in:
- lib/cfoundry/baseclient.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#no_backtrace ⇒ Object
Returns the value of attribute no_backtrace.
-
#trace ⇒ Object
Returns the value of attribute trace.
Instance Method Summary collapse
-
#initialize(target, token = nil) ⇒ BaseClient
constructor
A new instance of BaseClient.
- #request_path(method, path, types = {}, options = {}) ⇒ Object
Constructor Details
#initialize(target, token = nil) ⇒ BaseClient
Returns a new instance of BaseClient.
8 9 10 11 12 13 |
# File 'lib/cfoundry/baseclient.rb', line 8 def initialize(target, token = nil) @target = target @token = token @trace = false @no_backtrace = false end |
Instance Attribute Details
#no_backtrace ⇒ Object
Returns the value of attribute no_backtrace.
6 7 8 |
# File 'lib/cfoundry/baseclient.rb', line 6 def no_backtrace @no_backtrace end |
#trace ⇒ Object
Returns the value of attribute trace.
6 7 8 |
# File 'lib/cfoundry/baseclient.rb', line 6 def trace @trace end |
Instance Method Details
#request_path(method, path, types = {}, options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/cfoundry/baseclient.rb', line 15 def request_path(method, path, types = {}, = {}) path = url(path) if path.is_a?(Array) unless types.empty? if params = types.delete(:params) [:params] = params end if types.size > 1 raise "request types must contain only one Content-Type => Accept" end [:type] = types.keys.first [:accept] = types.values.first end request(method, path, ) end |