class DigitalFabric::RequestAdapter

Public Class Methods

new(agent, msg) click to toggle source
# File lib/tipi/digital_fabric/request_adapter.rb, line 7
def initialize(agent, msg)
  @agent = agent
  @id = msg[Protocol::Attribute::ID]
end

Public Instance Methods

finish(request) click to toggle source
# File lib/tipi/digital_fabric/request_adapter.rb, line 38
def finish(request)
  @agent.send_df_message(
    Protocol.http_response(@id, nil, nil, true)
  )
end
get_body_chunk(request) click to toggle source
# File lib/tipi/digital_fabric/request_adapter.rb, line 16
def get_body_chunk(request)
  @agent.get_http_request_body(@id, 1)
end
protocol() click to toggle source
# File lib/tipi/digital_fabric/request_adapter.rb, line 12
def protocol
  'df'
end
respond(request, body, headers) click to toggle source
# File lib/tipi/digital_fabric/request_adapter.rb, line 20
def respond(request, body, headers)
  @agent.send_df_message(
    Protocol.http_response(@id, body, headers, true)
  )
end
send_chunk(request, body, done: ) click to toggle source
# File lib/tipi/digital_fabric/request_adapter.rb, line 32
def send_chunk(request, body, done: )
  @agent.send_df_message(
    Protocol.http_response(@id, body, nil, done)
  )
end
send_headers(request, headers, opts = {}) click to toggle source
# File lib/tipi/digital_fabric/request_adapter.rb, line 26
  def send_headers(request, headers, opts = {})
    @agent.send_df_message(
      Protocol.http_response(@id, nil, headers, false)
    )
end