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, request_id:) ⇒ HAPResponse

Returns a new instance of HAPResponse.



7
8
9
10
11
12
# File 'lib/ruby_home/http/hap_response.rb', line 7

def initialize(*args, request_id: )
  @_request_id = request_id
  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.



28
29
30
# File 'lib/ruby_home/http/hap_response.rb', line 28

def received_encrypted_request=(value)
  @received_encrypted_request = value
end

Instance Method Details

#send_response(socket) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ruby_home/http/hap_response.rb', line 14

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