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 Squishify

extended

Methods included from Warren::BroadcastMessages

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

Instance Attribute Details

#nameString

Returns The hostname of the printer, eg. d304bc.

Returns:

  • (String)

    The hostname of the printer, eg. d304bc


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

belongs_to :barcode_printer_type

Class Method Details

.verify(_number) ⇒ Object


47
48
49
50
# File 'app/models/barcode_printer.rb', line 47

def self.verify(_number)
  # service.verify(number)
  'DEPRECATED'
end

Instance Method Details

#plate384_printer?Boolean

Returns:

  • (Boolean)

27
28
29
# File 'app/models/barcode_printer.rb', line 27

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

#register_printer_in_pmbObject


31
32
33
# File 'app/models/barcode_printer.rb', line 31

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

#serviceObject


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

def service
  # @service ||= self.class.service
  'DEPRECATED'
end

#service_urlObject


37
38
39
40
# File 'app/models/barcode_printer.rb', line 37

def service_url
  # configatron.barcode_service_url
  'DEPRECATED'
end