class SyncSign::Widget::QRCode
A widget that draws a QR code.
Attributes
@return [Symbol] the level of error checking code for this QR code,
either :low, :medium, :quartile, or :high.
@return [Integer] scale of the QR code (how many pixels to use to
represent each base pixel).
@return [String] the text to encode in this QR code.
@return [Integer] the version (which is actually size, in QR-speak)
of this QR code.
Public Class Methods
Initialize a new QR code widget. @param x [Integer] horizontal position of the left side of the QR code. @param y [Integer] vertical position of the top of the QR code. @param scale [Integer] scale of the QR code (how many pixels to use to
represent each base pixel).
@param version [Integer] the version (which is actually size, in QR-speak)
of this QR code.
@param ecclevel [Symbol] the level of error checking code for this QR code,
either :low, :medium, :quartile, or :high.
@param text [String] the text to encode in this QR code.
SyncSign::Widget::Item::new
# File lib/syncsign/widgets/qrcode.rb, line 28 def initialize(x: nil, y: nil, scale: 4, version: 2, ecclevel: :medium, text: nil) @scale = scale @version = version @ecclevel = ecclevel @text = text super(x: x, y: y) end
Public Instance Methods
# File lib/syncsign/widgets/qrcode.rb, line 52 def ==(other) @x == other.x && @y == other.y && @scale == other.scale && @version == other.version && @ecclevel == other.ecclevel && @text == other.text end
Convert the widget into an array for sending to the SyncSign
service.
# File lib/syncsign/widgets/qrcode.rb, line 39 def to_a { 'type': 'QRCODE', 'data': { 'scale': @scale, 'eccLevel': @ecclevel.to_s.upcase, 'version': @version, 'position': {x: @x, y: @y}, 'text': @text } } end