Class: RubyHome::HTTP::HAPResponse

Inherits:
WEBrick::HTTPResponse
  • Object
show all
Defined in:
lib/ruby_home/http/hap_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ HAPResponse

Returns a new instance of HAPResponse.



4
5
6
7
8
# File 'lib/ruby_home/http/hap_response.rb', line 4

def initialize(*args)
  cache[:accessory_to_controller_count] ||= 0

  super(*args)
end

Instance Attribute Details

#received_encrypted_request=(value) ⇒ Object (writeonly)

Sets the attribute received_encrypted_request

Parameters:

  • value

    the value to set the attribute received_encrypted_request to.



24
25
26
# File 'lib/ruby_home/http/hap_response.rb', line 24

def received_encrypted_request=(value)
  @received_encrypted_request = value
end

Instance Method Details

#send_response(socket) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ruby_home/http/hap_response.rb', line 10

def send_response(socket)
  if encryption_time?
    response = String.new
    super(response)

    encrypted_response = encrypter.encrypt(response).join
    cache[:accessory_to_controller_count] = encrypter.count

    _write_data(socket, encrypted_response)
  else
    super(socket)
  end
end