Class: LabelPrinter::Label::Swipecard
- Inherits:
-
Object
- Object
- LabelPrinter::Label::Swipecard
- Defined in:
- lib/label_printer/label/swipecard.rb
Instance Method Summary collapse
-
#build_label ⇒ Hash
Returns values for the fields of the label.
-
#initialize(attributes) ⇒ Swipecard
constructor
A new instance of Swipecard.
- #labels ⇒ Object
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_label ⇒ Hash
Returns values for the fields of the label. They are used by the the printmybarcode service to populate the label template.
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 |
#labels ⇒ Object
19 20 21 |
# File 'lib/label_printer/label/swipecard.rb', line 19 def labels [build_label] end |