Class: AsyncConnectionAdapter
- Inherits:
-
HTTParty::ConnectionAdapter
- Object
- HTTParty::ConnectionAdapter
- AsyncConnectionAdapter
- Defined in:
- lib/resthome/httparty/async_connection_adapter.rb,
lib/resthome/httparty/async_connection_adapter.rb
Defined Under Namespace
Classes: AsyncHTTPConnection, AsyncHTTPResponse
Class Method Summary collapse
Instance Method Summary collapse
- #connection ⇒ Object
-
#initialize(uri, options) ⇒ AsyncConnectionAdapter
constructor
A new instance of AsyncConnectionAdapter.
Constructor Details
#initialize(uri, options) ⇒ AsyncConnectionAdapter
Returns a new instance of AsyncConnectionAdapter.
37 38 39 40 |
# File 'lib/resthome/httparty/async_connection_adapter.rb', line 37 def initialize(uri, ) @uri = uri @options = end |
Class Method Details
.call(uri, options) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/resthome/httparty/async_connection_adapter.rb', line 49 def self.call(uri, ) if EM.reactor_running? self.new(uri, ).connection else HTTParty::ConnectionAdapter.call uri, end end |
Instance Method Details
#connection ⇒ Object
42 43 44 45 46 47 |
# File 'lib/resthome/httparty/async_connection_adapter.rb', line 42 def connection AsyncHTTPConnection.new.tap do |c| c.connopts = HttpConnectionOptions.new(@uri, @options) c.uri = @uri end end |