Class: LabelPrinter::Label::Swipecard

Inherits:
Object
  • Object
show all
Defined in:
lib/label_printer/label/swipecard.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Swipecard

Returns a new instance of Swipecard.



5
6
7
8
# File 'lib/label_printer/label/swipecard.rb', line 5

def initialize(attributes)
  @swipecard = attributes[:swipecard]
  @user_login = attributes[:user_login]
end

Instance Method Details

#build_labelHash

Returns values for the fields of the label. They are used by the the printmybarcode service to populate the label template.

Returns:

  • (Hash)

    a hash of label field values



15
16
17
# File 'lib/label_printer/label/swipecard.rb', line 15

def build_label
  { left_text: @user_login, barcode: @swipecard, label_name: 'main' }
end

#labelsObject



19
20
21
# File 'lib/label_printer/label/swipecard.rb', line 19

def labels
  [build_label]
end