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

alias_association, 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



52
53
54
55
# File 'app/models/barcode_printer.rb', line 52

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

Instance Method Details

#plate384_printer?Boolean

Returns:

  • (Boolean)


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

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

#register_printer_in_pmbObject



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

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

#serviceObject



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

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

#service_urlObject



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

def service_url
  # configatron.barcode_service_url
  'DEPRECATED'
end