zatca 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31fc90251ebaaa59adb0c0e56c685d7a0328621d4135ec652c1b755ffaba9dcb
4
- data.tar.gz: dfe4cf0d45af7b39910b74f960f9eac6396baa4d023633f8a14dd45f23f0fb36
3
+ metadata.gz: c25f54eab0d4d04d55d789f691e1143762a4a7e9a62448f57a8ff88571b443c4
4
+ data.tar.gz: 13ddbc1574fcccd916a0123a9b9fed53aa611dbcc26df917eaf478092aa74edd
5
5
  SHA512:
6
- metadata.gz: 509c63d4567ad7a299feb239f52138f89d5085785584f12a8b2b2f2ef907cdcbbfe84a902b301eb04e5b13fac42811f9c7932e84606c861427da66da07024755
7
- data.tar.gz: 531d7fe55112f3c5f50765895a9d0276fd9dcef4807fba574c901fd73fd2be8c7adf2bd304469744dc0fb1adb41da73e7991c7cb0020abfc95988a3b9aa889cb
6
+ metadata.gz: abd3917c3ac3de9673f25c65628ab0e61c74da1a0ac9f9e253e87fe50ce4d6cfe284cd0ede5c0ad7e84e5b28fae5d84c6b1ae0921ad0c590d3cd912de2b99d3a
7
+ data.tar.gz: e5053c248cc3ba0121b6bb2be7145730ea1e862104cfdd845a67d20ff898061f81a5393b8ae83aa6335c4370f9dee7f0077571f1065bb84341a036a2a7bc33ac
data/Gemfile CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- # Specify your gem's dependencies in zatca-qr-code.gemspec
5
+ # Specify your gem's dependencies in zatca.gemspec
6
6
  gemspec
7
7
 
8
8
  gem "rake", "~> 13.0"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zatca-qr-code (0.1.0)
4
+ zatca (0.1.1)
5
5
  dry-schema (~> 1.5)
6
6
  rqrcode (~> 2.1.0)
7
7
  zeitwerk (~> 2.4)
@@ -94,7 +94,7 @@ DEPENDENCIES
94
94
  rake (~> 13.0)
95
95
  rspec (~> 3.10)
96
96
  standard (~> 1.3)
97
- zatca-qr-code!
97
+ zatca!
98
98
 
99
99
  BUNDLED WITH
100
- 2.2.27
100
+ 2.2.30
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # zatca-qr-code
2
- ![](https://img.shields.io/gem/v/zatca-qr-code) ![](https://img.shields.io/github/workflow/status/mrsool/zatca-qr-code/Ruby)
1
+ # zatca
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-qr-code/issues/3).
4
+ [🚧 Still being validated by ZATCA](https://github.com/mrsool/zatca/issues/3).
5
5
 
6
6
  A Ruby library for generating QR Codes for the e-invoice standard by ZATCA in Saudi Arabia.
7
7
 
@@ -9,18 +9,18 @@ A Ruby library for generating QR Codes for the e-invoice standard by ZATCA in Sa
9
9
 
10
10
  ## Rubygems
11
11
  ```sh
12
- gem install zatca-qr-code
12
+ gem install zatca
13
13
  ```
14
14
 
15
15
  ## Bundler
16
16
  ```sh
17
- bundle add zatca-qr-code
17
+ bundle add zatca
18
18
  ```
19
19
 
20
20
  # Usage
21
21
 
22
22
  ```rb
23
- require "zatca-qr-code"
23
+ require "zatca"
24
24
 
25
25
  tags = {
26
26
  seller_name: "Mrsool",
@@ -38,7 +38,7 @@ ZATCA.render_qr_code(tags)
38
38
  If you'd like to customize the size of the QR Code you can manually use the generator like so:
39
39
 
40
40
  ```rb
41
- require "zatca-qr-code"
41
+ require "zatca"
42
42
 
43
43
  tags = ZATCA::Tags.new({
44
44
  seller_name: "Mrsool",
data/lib/zatca/tag.rb CHANGED
@@ -22,10 +22,13 @@ module ZATCA
22
22
 
23
23
  def to_tlv
24
24
  # TLV should be concatenated together without any separator in the following
25
- # format: hex_value_of_id hex_value_of_length value_itself
26
- # where hex_values should be padded with a 0 if containing only a single digit.
25
+ # format: character_value_of_id character_value_of_value_length value_itself
26
+ # All of this should be in 8-bit ASCII.
27
+ tlv = @id.chr + @value.length.chr + value
27
28
 
28
- sprintf("%02X%02X%s", @id, @value.length, @value)
29
+ # We need to use force_encoding because encode will raise errors when
30
+ # trying to encode a string with utf-8 characters.
31
+ tlv.force_encoding("ASCII-8BIT")
29
32
  end
30
33
  end
31
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.0"
4
+ VERSION = "0.1.1"
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.0
4
+ version: 0.1.1
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-04 00:00:00.000000000 Z
11
+ date: 2021-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -116,13 +116,13 @@ files:
116
116
  - lib/zatca/tags.rb
117
117
  - lib/zatca/tags_schema.rb
118
118
  - lib/zatca/version.rb
119
- homepage: https://github.com/mrsool/zatca-qr-code
119
+ homepage: https://github.com/mrsool/zatca
120
120
  licenses: []
121
121
  metadata:
122
122
  allowed_push_host: https://rubygems.org
123
- homepage_uri: https://github.com/mrsool/zatca-qr-code
124
- source_code_uri: https://github.com/mrsool/zatca-qr-code
125
- changelog_uri: https://github.com/mrsool/zatca-qr-code/releases
123
+ homepage_uri: https://github.com/mrsool/zatca
124
+ source_code_uri: https://github.com/mrsool/zatca
125
+ changelog_uri: https://github.com/mrsool/zatca/releases
126
126
  post_install_message:
127
127
  rdoc_options: []
128
128
  require_paths: