Module: HAP::Parser
- Included in:
- Client
- Defined in:
- lib/hap_client/parser.rb
Instance Method Summary collapse
- #init_parser ⇒ Object
- #on_body(chunk) ⇒ Object
- #on_headers_complete(headers) ⇒ Object
- #on_message_begin ⇒ Object
- #on_message_complete ⇒ Object
- #receive_data(data) ⇒ Object
Instance Method Details
#init_parser ⇒ Object
5 6 7 |
# File 'lib/hap_client/parser.rb', line 5 def init_parser @parser = Http::Parser.new(self) end |
#on_body(chunk) ⇒ Object
30 31 32 |
# File 'lib/hap_client/parser.rb', line 30 def on_body(chunk) @body << chunk end |
#on_headers_complete(headers) ⇒ Object
26 27 28 |
# File 'lib/hap_client/parser.rb', line 26 def on_headers_complete(headers) @headers = headers end |
#on_message_begin ⇒ Object
21 22 23 24 |
# File 'lib/hap_client/parser.rb', line 21 def @headers = nil @body = '' end |
#on_message_complete ⇒ Object
34 35 36 |
# File 'lib/hap_client/parser.rb', line 34 def (@body) end |
#receive_data(data) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/hap_client/parser.rb', line 9 def receive_data(data) if encryption_ready? data = decrypt(data) if data.start_with?("EVENT/") data.sub!("EVENT/","HTTP/") end end @parser << data end |