Module: HAP::Request
Constant Summary
EncryptionRequest::AAD_LENGTH_BYTES, EncryptionRequest::AUTHENTICATE_TAG_LENGTH_BYTES
Instance Attribute Summary
#decryption_count, #encryption_count
Instance Method Summary
collapse
#encryption_ready?
Instance Method Details
#get(url) ⇒ Object
42
43
44
|
# File 'lib/hap_client/request.rb', line 42
def get(url)
request("GET", url)
end
|
#init_request ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/hap_client/request.rb', line 7
def init_request()
@req_queue = EM::Queue.new
@res_queue = EM::Queue.new
response_work = nil
request_work = Proc.new do |req|
if encryption_ready?
encrypt(req).each do |r|
if @socket.nil?
send_data(r)
else
@socket.write(r)
end
end
else
if @socket.nil?
send_data(req)
else
@socket.write(req)
end
end
init_parser()
@res_queue.pop(&response_work)
end
response_work = Proc.new do |res|
@req_queue.pop(&request_work)
end
@req_queue.pop(&request_work)
end
|
#post(url, type, data) ⇒ Object
46
47
48
|
# File 'lib/hap_client/request.rb', line 46
def post(url, type, data)
request("POST", url, type, data)
end
|
#put(url, type, data) ⇒ Object
50
51
52
|
# File 'lib/hap_client/request.rb', line 50
def put(url, type, data)
request("PUT", url, type, data)
end
|