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

Instance Attribute Details

#nameString

Returns The hostname of the printer, eg. d304bc.

Returns:

  • (String)

    The hostname of the printer, eg. d304bc


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

belongs_to :barcode_printer_type

Class Method Details

.verify(_number) ⇒ Object


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

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

Instance Method Details

#plate384_printer?Boolean

Returns:

  • (Boolean)

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

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

#register_printer_in_pmbObject


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

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

#serviceObject


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

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

#service_urlObject


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

def service_url
  # configatron.barcode_service_url
  'DEPRECATED'
end