Class: Mediaflux::HttpConnection
- Inherits:
-
Object
- Object
- Mediaflux::HttpConnection
- Includes:
- Singleton
- Defined in:
- app/models/mediaflux/http_connection.rb
Instance Attribute Summary collapse
-
#http_client ⇒ Object
readonly
Returns the value of attribute http_client.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ HttpConnection
constructor
A new instance of HttpConnection.
Constructor Details
#initialize ⇒ HttpConnection
Returns a new instance of HttpConnection.
18 19 20 21 22 23 24 25 |
# File 'app/models/mediaflux/http_connection.rb', line 18 def initialize @http_client = Net::HTTP::Persistent.new Rails.logger.debug "created http" # https is not working correctly on td-meta1 we should not need this, but we do... @http_client.verify_mode = OpenSSL::SSL::VERIFY_NONE ObjectSpace.define_finalizer(self, self.class.finalizer(@http_client)) end |
Instance Attribute Details
#http_client ⇒ Object (readonly)
Returns the value of attribute http_client.
6 7 8 |
# File 'app/models/mediaflux/http_connection.rb', line 6 def http_client @http_client end |
Class Method Details
.finalizer(http_client) ⇒ Object
10 11 12 13 14 15 |
# File 'app/models/mediaflux/http_connection.rb', line 10 def finalizer(http_client) proc { Rails.logger.debug "finalized http" http_client&.shutdown } end |