Class: DigitalFabric::RequestAdapter
- Inherits:
-
Object
- Object
- DigitalFabric::RequestAdapter
- Defined in:
- lib/tipi/digital_fabric/request_adapter.rb
Instance Method Summary collapse
- #finish(request) ⇒ Object
- #get_body_chunk(request) ⇒ Object
-
#initialize(agent, msg) ⇒ RequestAdapter
constructor
A new instance of RequestAdapter.
- #protocol ⇒ Object
- #respond(request, body, headers) ⇒ Object
- #send_chunk(request, body, done:) ⇒ Object
- #send_headers(request, headers, opts = {}) ⇒ Object
Constructor Details
#initialize(agent, msg) ⇒ RequestAdapter
Returns a new instance of RequestAdapter.
7 8 9 10 |
# File 'lib/tipi/digital_fabric/request_adapter.rb', line 7 def initialize(agent, msg) @agent = agent @id = msg[Protocol::Attribute::ID] end |
Instance Method Details
#finish(request) ⇒ Object
38 39 40 41 42 |
# File 'lib/tipi/digital_fabric/request_adapter.rb', line 38 def finish(request) @agent.( Protocol.http_response(@id, nil, nil, true) ) end |
#get_body_chunk(request) ⇒ Object
16 17 18 |
# File 'lib/tipi/digital_fabric/request_adapter.rb', line 16 def get_body_chunk(request) @agent.get_http_request_body(@id, 1) end |
#protocol ⇒ Object
12 13 14 |
# File 'lib/tipi/digital_fabric/request_adapter.rb', line 12 def protocol 'df' end |
#respond(request, body, headers) ⇒ Object
20 21 22 23 24 |
# File 'lib/tipi/digital_fabric/request_adapter.rb', line 20 def respond(request, body, headers) @agent.( Protocol.http_response(@id, body, headers, true) ) end |
#send_chunk(request, body, done:) ⇒ Object
32 33 34 35 36 |
# File 'lib/tipi/digital_fabric/request_adapter.rb', line 32 def send_chunk(request, body, done: ) @agent.( Protocol.http_response(@id, body, nil, done) ) end |
#send_headers(request, headers, opts = {}) ⇒ Object
26 27 28 29 30 |
# File 'lib/tipi/digital_fabric/request_adapter.rb', line 26 def send_headers(request, headers, opts = {}) @agent.( Protocol.http_response(@id, nil, headers, false) ) end |