upi 0.1.0 → 1.0.0
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +3 -1
- data/lib/upi/version.rb +1 -1
- data/lib/upi.rb +25 -10
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0e39f9a2fd875f3180e609a85f83ff9655615b6d7a488c7e6c429cf8c13116c
|
4
|
+
data.tar.gz: b022628db4f744f477049ea8dfa9f57359948ff0e55b6c5c02a68ffd16e52855
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6d835ac551a922fea2b3b24e3f18f95277895e69953c3516bf80be3e2fe9f0ff38a228e12f9eca7029ad68712d933af78b7fdfe4f40cb1262cbdc21b3cc6c88
|
7
|
+
data.tar.gz: f95200673d9726028e5ed770b6def9dee46ae7f1cdb743f46bbf45a2fb6348dbce129c8a7cd92779d333ab565ec8d5a7d90ea3861d21cd77bdb30c6b1bf12777
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [1.0.0] - 2024-09-05
|
4
|
+
|
5
|
+
- Added `mode` option to `generate_qr` method to support both PNG and SVG formats.
|
6
|
+
- Made `upi_content` method public for easier access.
|
7
|
+
- Improved handling of QR code generation and added detailed error handling.
|
8
|
+
|
3
9
|
## [0.1.0] - 2024-09-05
|
4
10
|
|
5
11
|
- Initial release
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/lib/upi/version.rb
CHANGED
data/lib/upi.rb
CHANGED
@@ -21,20 +21,36 @@ module Upi
|
|
21
21
|
}.compact
|
22
22
|
end
|
23
23
|
|
24
|
-
def generate_qr
|
24
|
+
def generate_qr(mode: :svg)
|
25
25
|
content = upi_content
|
26
26
|
qrcode = RQRCode::QRCode.new(content)
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
case mode
|
29
|
+
when :svg
|
30
|
+
qrcode.as_svg(
|
31
|
+
color: '000',
|
32
|
+
shape_rendering: 'crispEdges',
|
33
|
+
module_size: 11
|
34
|
+
)
|
35
|
+
when :png
|
36
|
+
png = qrcode.as_png(
|
37
|
+
bit_depth: 1,
|
38
|
+
border_modules: 4,
|
39
|
+
color_mode: ChunkyPNG::COLOR_GRAYSCALE,
|
40
|
+
color: 'black',
|
41
|
+
file: nil,
|
42
|
+
fill: 'white',
|
43
|
+
module_px_size: 6, # Adjust size as needed
|
44
|
+
resize_exactly_to: false,
|
45
|
+
resize_gte_to: false,
|
46
|
+
size: 300 # Adjust size as needed
|
47
|
+
)
|
48
|
+
png.to_s
|
49
|
+
else
|
50
|
+
raise ArgumentError, "Unsupported mode: #{mode}. Use :svg or :png."
|
51
|
+
end
|
34
52
|
end
|
35
53
|
|
36
|
-
private
|
37
|
-
|
38
54
|
def upi_content
|
39
55
|
# Manually construct the UPI URI string without URI::UPI
|
40
56
|
query_string = URI.encode_www_form(params)
|
@@ -43,5 +59,4 @@ module Upi
|
|
43
59
|
end
|
44
60
|
|
45
61
|
class Error < StandardError; end
|
46
|
-
# Your code goes here...
|
47
62
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Faraz Noor
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: chunky_png
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description: This gem generates UPI QR codes for payments. It can be used in e-commerce
|
28
42
|
applications to generate QR codes for payments. The QR codes can be scanned by UPI
|
29
43
|
apps to make payments. The gem uses the rqrcode gem to generate the QR codes.
|
@@ -59,7 +73,7 @@ metadata:
|
|
59
73
|
allowed_push_host: https://rubygems.org
|
60
74
|
homepage_uri: https://github.com/stingrayzboy/upi
|
61
75
|
source_code_uri: https://github.com/stingrayzboy/upi
|
62
|
-
changelog_uri: https://github.com/stingrayzboy/upi/blob/
|
76
|
+
changelog_uri: https://github.com/stingrayzboy/upi/blob/master/CHANGELOG.md
|
63
77
|
post_install_message:
|
64
78
|
rdoc_options: []
|
65
79
|
require_paths:
|