Module: CF::UAA::Http
- Included in:
- Info, Scim, TokenIssuer
- Defined in:
- lib/uaa/http.rb
Overview
Utility accessors and methods for objects that want to access JSON web APIs.
Constant Summary collapse
- JSON_UTF8 =
'application/json;charset=utf-8'
- FORM_UTF8 =
'application/x-www-form-urlencoded;charset=utf-8'
Class Method Summary collapse
-
.basic_auth(name, password) ⇒ String
Constructs an http basic authentication header.
Instance Method Summary collapse
- #initialize_http_options(options) ⇒ Object
-
#logger ⇒ Logger
The current logger or Util.default_logger if none has been set.
-
#logger=(logr) ⇒ Logger
Sets the current logger instance to recieve error messages.
-
#set_request_handler(&blk) ⇒ nil
Sets a handler for outgoing http requests.
-
#trace? ⇒ Boolean
Indicates if the current logger is set to
:trace
level.
Class Method Details
.basic_auth(name, password) ⇒ String
Constructs an http basic authentication header.
84 85 86 87 88 |
# File 'lib/uaa/http.rb', line 84 def self.basic_auth(name, password) str = "#{name}:#{password}" 'Basic ' + (Base64.respond_to?(:strict_encode64)? Base64.strict_encode64(str): [str].pack('m').gsub(/\n/, '')) end |
Instance Method Details
#initialize_http_options(options) ⇒ Object
55 56 57 58 59 60 |
# File 'lib/uaa/http.rb', line 55 def () @skip_ssl_validation = [:skip_ssl_validation] @ssl_ca_file = [:ssl_ca_file] @ssl_cert_store = [:ssl_cert_store] @http_timeout = [:http_timeout] end |
#logger ⇒ Logger
The current logger or Util.default_logger if none has been set.
69 |
# File 'lib/uaa/http.rb', line 69 def logger ; @logger || Util.default_logger end |
#logger=(logr) ⇒ Logger
Sets the current logger instance to recieve error messages.
65 |
# File 'lib/uaa/http.rb', line 65 def logger=(logr); @logger = logr end |
#set_request_handler(&blk) ⇒ nil
Sets a handler for outgoing http requests. If no handler is set, an internal cache of net/http connections is used. Arguments to the handler are url, method, body, headers.
80 |
# File 'lib/uaa/http.rb', line 80 def set_request_handler(&blk) @req_handler = blk; nil end |
#trace? ⇒ Boolean
Indicates if the current logger is set to :trace
level.
73 |
# File 'lib/uaa/http.rb', line 73 def trace? ; (lgr = logger).respond_to?(:trace?) && lgr.trace? end |