Class: Spoolprint::ReceiverManager

Inherits:
Object
  • Object
show all
Defined in:
lib/spoolprint/server/receiver_manager.rb

Defined Under Namespace

Classes: RemoteServer, Request, Response

Constant Summary collapse

FLAG_SUCCESS =
[0x80, 0x00].collect(&:chr).join

Instance Method Summary collapse

Constructor Details

#initialize(remote_meth) ⇒ ReceiverManager

Returns a new instance of ReceiverManager.



41
42
43
# File 'lib/spoolprint/server/receiver_manager.rb', line 41

def initialize(remote_meth)
  @remote = RemoteServer.new(remote_meth)
end

Instance Method Details

#make_response(req_raw) ⇒ Object



45
46
47
48
49
50
51
# File 'lib/spoolprint/server/receiver_manager.rb', line 45

def make_response(req_raw)
  req = Request.urai(req_raw) { |length| @remote.use(length) }
  resp = Response.new
  resp.success = FLAG_SUCCESS
  resp.for_print = req.message
  return resp
end