Class: ZATCA::QRCodeExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/zatca/qr_code_extractor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(invoice_base64:) ⇒ QRCodeExtractor

Returns a new instance of QRCodeExtractor.



7
8
9
# File 'lib/zatca/qr_code_extractor.rb', line 7

def initialize(invoice_base64:)
  @invoice_base64 = invoice_base64
end

Instance Attribute Details

#invoice_base64Object (readonly)

Returns the value of attribute invoice_base64.



5
6
7
# File 'lib/zatca/qr_code_extractor.rb', line 5

def invoice_base64
  @invoice_base64
end

Instance Method Details

#extractObject



11
12
13
14
# File 'lib/zatca/qr_code_extractor.rb', line 11

def extract
  xml_invoice = Base64.strict_decode64(invoice_base64)
  extract_qr_code_base64_from_xml(xml_invoice)
end