Class: RubyHome::HTTP::HAPRequest
- Inherits:
-
WEBrick::HTTPRequest
- Object
- WEBrick::HTTPRequest
- RubyHome::HTTP::HAPRequest
- Defined in:
- lib/ruby_home/http/hap_request.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ HAPRequest
constructor
A new instance of HAPRequest.
- #parse(socket = nil) ⇒ Object
- #received_encrypted_request? ⇒ Boolean
Constructor Details
#initialize(*args) ⇒ HAPRequest
Returns a new instance of HAPRequest.
4 5 6 7 8 |
# File 'lib/ruby_home/http/hap_request.rb', line 4 def initialize(*args) cache[:controller_to_accessory_count] ||= 0 super(*args) end |
Instance Method Details
#parse(socket = nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ruby_home/http/hap_request.rb', line 10 def parse(socket=nil) if decryption_time? request_line = socket.read_nonblock(@buffer_size) decrypted_request = decrypter.decrypt(request_line).join cache[:controller_to_accessory_count] = decrypter.count super(StringIO.new(decrypted_request)) else super(socket) end end |
#received_encrypted_request? ⇒ Boolean
23 24 25 |
# File 'lib/ruby_home/http/hap_request.rb', line 23 def received_encrypted_request? cache[:controller_to_accessory_count] >= 1 end |