Class: AsyncConnectionAdapter::AsyncHTTPResponse

Inherits:
Net::HTTPResponse
  • Object
show all
Defined in:
lib/resthome/httparty/async_connection_adapter.rb

Overview

convert EventMachine::HttpClient to a Net::HTTPResponse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ AsyncHTTPResponse

Returns a new instance of AsyncHTTPResponse.



6
7
8
9
10
11
12
13
14
# File 'lib/resthome/httparty/async_connection_adapter.rb', line 6

def initialize(client)
  headers = client.response_header
  super headers.http_version, headers.http_status, headers.http_reason
  @body = client.response
  @read = true
  headers.each do |k, v|
    self.add_field k.downcase.gsub('_', '-'), v
  end
end