Class: Sinicum::Jcr::ApiQueries
- Inherits:
-
Object
- Object
- Sinicum::Jcr::ApiQueries
- Defined in:
- lib/sinicum/jcr/api_queries.rb
Overview
Private: Encapsulates the functionality to run queries on the server.
Constant Summary collapse
- @@http_client_mutex =
Mutex.new
Class Attribute Summary collapse
-
.jcr_configuration ⇒ Object
readonly
Returns the value of attribute jcr_configuration.
Class Method Summary collapse
Class Attribute Details
.jcr_configuration ⇒ Object (readonly)
Returns the value of attribute jcr_configuration.
9 10 11 |
# File 'lib/sinicum/jcr/api_queries.rb', line 9 def jcr_configuration @jcr_configuration end |
Class Method Details
.configure_jcr=(config_hash) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/sinicum/jcr/api_queries.rb', line 11 def configure_jcr=(config_hash) @http_client = nil if config_hash @jcr_configuration = JcrConfiguration.new(config_hash.dup.with_indifferent_access) if @jcr_configuration.username.present? || @jcr_configuration.password.present? http_client.set_auth(nil, @jcr_configuration.username, @jcr_configuration.password) http_client.www_auth.basic_auth.challenge(@jcr_configuration.base_proto_host_port) end if @jcr_configuration.protocol == "https" http_client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE end end end |
.http_client ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/sinicum/jcr/api_queries.rb', line 25 def http_client # Thread Safety? return @http_client if @http_client @@http_client_mutex.synchronize do return @http_client if @http_client @http_client ||= HTTPClient.new end @http_client end |