class Quickets::TicketPrinter
Attributes
printer_name[R]
Public Class Methods
new(params)
click to toggle source
# File lib/quickets/ticket_printer.rb, line 12 def initialize(params) @api_key = params.fetch('api_key') @printer_name = params.fetch('printer_name') @page_format = params.fetch('page_format') @tickets = params.fetch('tickets') end
Public Instance Methods
can_print?()
click to toggle source
# File lib/quickets/ticket_printer.rb, line 19 def can_print? AvailablePrinters.all(@api_key).include? @printer_name end
print()
click to toggle source
# File lib/quickets/ticket_printer.rb, line 23 def print ticket_print_command = TicketPrintCommand.new ticket_print_command.printer_name = @printer_name ticket_print_command.ticket_page_settings_from_map = @page_format ticket_print_command.tickets_from_data_list = @tickets Thread.new do ticket_print_command.execute end end