Class: BarcodePrinter

Inherits:
ApplicationRecord show all
Includes:
Uuid::Uuidable
Defined in:
app/models/barcode_printer.rb

Overview

Represents a barcode printer, where #name is the hostname of the printer eg. d304bc BarcodePrinterType records which label type (eg. tube or plate labels) is loaded in the printer, and ensures that we can:

- Correctly filter the list of printers displayed to be suitable for the asset
- Send an appropriate label template to the printer

Constant Summary collapse

BarcodePrinterException =

for labels printing, if printer is not registered in ss

Class.new(ActiveRecord::RecordNotFound)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Uuid::Uuidable

included, #unsaved_uuid!, #uuid

Methods inherited from ApplicationRecord

convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Warren::BroadcastMessages

#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren

Instance Attribute Details

#nameString


13
# File 'app/models/barcode_printer.rb', line 13

belongs_to :barcode_printer_type

Class Method Details

.verify(number) ⇒ Object


44
45
46
# File 'app/models/barcode_printer.rb', line 44

def self.verify(number)
  service.verify(number)
end

Instance Method Details

#plate384_printer?Boolean


25
26
27
# File 'app/models/barcode_printer.rb', line 25

def plate384_printer?
  barcode_printer_type.name == '384 Well Plate'
end

#register_printer_in_pmbObject


29
30
31
# File 'app/models/barcode_printer.rb', line 29

def register_printer_in_pmb
  LabelPrinter::PmbClient.register_printer(name)
end

#serviceObject


40
41
42
# File 'app/models/barcode_printer.rb', line 40

def service
  @service ||= self.class.service
end

#service_urlObject


35
36
37
38
# File 'app/models/barcode_printer.rb', line 35

def service_url
  # configatron.barcode_service_url
  'DEPRECATED'
end