zatca 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c25f54eab0d4d04d55d789f691e1143762a4a7e9a62448f57a8ff88571b443c4
4
- data.tar.gz: 13ddbc1574fcccd916a0123a9b9fed53aa611dbcc26df917eaf478092aa74edd
3
+ metadata.gz: c3d50ea1cc7ced6ae04db6b019bbb93b89acd164c93ce6bf0f918e93d3300ca2
4
+ data.tar.gz: 29217d567f38527e15424d822c681e84c44de620f1212658f49fd7e9c9d28a46
5
5
  SHA512:
6
- metadata.gz: abd3917c3ac3de9673f25c65628ab0e61c74da1a0ac9f9e253e87fe50ce4d6cfe284cd0ede5c0ad7e84e5b28fae5d84c6b1ae0921ad0c590d3cd912de2b99d3a
7
- data.tar.gz: e5053c248cc3ba0121b6bb2be7145730ea1e862104cfdd845a67d20ff898061f81a5393b8ae83aa6335c4370f9dee7f0077571f1065bb84341a036a2a7bc33ac
6
+ metadata.gz: 3b3c1935011617463f0adee23e3590eddf956be5df53dd6adcd56e1f0c0ba97135faabcb5c97baa93b0565e04dcd2ffde0136573751c12d390f531a5cdccc576
7
+ data.tar.gz: b1f4612a7c601565791d14d21bae937ef0c7728e3e2aeada65611b7db7a10d12261ebaf2f8b3c56ff6bb5f793173022ea3c26ae126732e3038d17fb27903ca69
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # zatca
2
2
  ![](https://img.shields.io/gem/v/zatca) ![](https://img.shields.io/github/workflow/status/mrsool/zatca/Ruby)
3
3
 
4
- [🚧 Still being validated by ZATCA](https://github.com/mrsool/zatca/issues/3).
5
-
6
4
  A Ruby library for generating QR Codes for the e-invoice standard by ZATCA in Saudi Arabia.
7
5
 
6
+ ✅ Validated to have the same output as [ZATCA's SDK](https://zatca.gov.sa/en/E-Invoicing/SystemsDevelopers/ComplianceEnablementToolbox/Pages/DownloadSDK.aspx) as of 12 November 2021.
7
+
8
8
  # Installation
9
9
 
10
10
  ## Rubygems
data/lib/zatca/tag.rb CHANGED
@@ -24,7 +24,7 @@ module ZATCA
24
24
  # TLV should be concatenated together without any separator in the following
25
25
  # format: character_value_of_id character_value_of_value_length value_itself
26
26
  # All of this should be in 8-bit ASCII.
27
- tlv = @id.chr + @value.length.chr + value
27
+ tlv = @id.chr + @value.bytesize.chr + value
28
28
 
29
29
  # We need to use force_encoding because encode will raise errors when
30
30
  # trying to encode a string with utf-8 characters.
data/lib/zatca/tags.rb CHANGED
@@ -25,6 +25,10 @@ module ZATCA
25
25
  end.sort_by(&:id)
26
26
  end
27
27
 
28
+ def [](index)
29
+ @tags[index]
30
+ end
31
+
28
32
  def to_base64
29
33
  Base64.strict_encode64(to_tlv)
30
34
  end
data/lib/zatca/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZATCA
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zatca
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Omar Bahareth
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-12 00:00:00.000000000 Z
11
+ date: 2021-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk