qrgo 0.1.0 → 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 +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +7 -13
- data/lib/qrcode/version.rb +1 -1
- data/lib/qrcode.rb +13 -8
- data/qrcode.gemspec +4 -3
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b670d2aaf9453b0ff3a7c3eb58d9a0b59d6cc5ce44b2501144b8e82dd44a36fc
|
4
|
+
data.tar.gz: e344b78fb831c248016586495166c04e3642a3e523f85e7dfd6920c0ed8f9be2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5512558948b3b48115191eb07fe77e3c91cce2634fd0aa37773b1f73ebbd68ddec4f22011043fd610e0e0e35409815c9d20623b11cf8ab16c16150dca3498c89
|
7
|
+
data.tar.gz: 673154dcbbb35487e86864d67a84d11cb0028c2eef0ee4584b6ee2ec0bd2dc00fd2d2a12098bc9a2a066c1b9d5f731d24ac6c97222b48aa7981fbab8b4236cdf
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,28 +1,22 @@
|
|
1
|
-
#
|
1
|
+
# QR-GO Wrapper
|
2
|
+
[](https://badge.fury.io/rb/qrgo)
|
2
3
|
|
3
|
-
|
4
|
+
This is a wrapper for the [GOQR api](https://goqr.me/), and can be found in the gem store here [https://rubygems.org/gems/qrgo](https://rubygems.org/gems/qrgo)
|
4
5
|
|
5
6
|
## Installation
|
6
7
|
|
7
|
-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
8
8
|
|
9
9
|
Install the gem and add to the application's Gemfile by executing:
|
10
10
|
|
11
|
-
|
11
|
+
gem install qrgo
|
12
12
|
|
13
|
-
|
13
|
+
Alternatively, you may add this to the Gemfile.
|
14
14
|
|
15
|
-
|
15
|
+
gem 'qrgo', '~> 0.1.1'
|
16
16
|
|
17
17
|
## Usage
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
## Development
|
22
|
-
|
23
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
24
|
-
|
25
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
19
|
+
Create and read QR Codes using the api's capability, within ruby applications.
|
26
20
|
|
27
21
|
## Contributing
|
28
22
|
|
data/lib/qrcode/version.rb
CHANGED
data/lib/qrcode.rb
CHANGED
@@ -6,31 +6,36 @@ require 'json'
|
|
6
6
|
module QRCode
|
7
7
|
@base_url = "https://api.qrserver.com/v1/"
|
8
8
|
|
9
|
+
# @param [String] url = URL of the image of the QR Code
|
10
|
+
# @param [Integer] width = width of qr code image
|
11
|
+
# @param [Integer] url = height of qr code image
|
9
12
|
def self.qr_create(url, width = 100, height = 100)
|
10
|
-
uri = URI("#{@base_url}create-qr-code/?data=#{url}&size=#{width.to_s}x#{height.to_s}")
|
13
|
+
uri = URI("#{@base_url}create-qr-code/?data=#{CGI.escape(url)}&size=#{width.to_s}x#{height.to_s}")
|
11
14
|
|
12
15
|
begin
|
13
|
-
|
16
|
+
res = Net::HTTP.get_response(uri)
|
14
17
|
rescue
|
15
|
-
|
18
|
+
return "Failed to connect with API endpoint."
|
16
19
|
end
|
17
20
|
|
18
21
|
return res.body if res.is_a?(Net::HTTPSuccess)
|
19
22
|
end
|
20
23
|
|
21
|
-
|
22
|
-
|
24
|
+
# @param [String] url = URL of the image of the QR Code
|
25
|
+
# @param [String] output = "json" or "xml"
|
26
|
+
def self.qr_read(url, output = 'json')
|
27
|
+
uri = URI("#{@base_url}read-qr-code/?fileurl=#{CGI.escape(url)}&outputformat=#{output}")
|
23
28
|
|
24
29
|
begin
|
25
|
-
|
30
|
+
res = Net::HTTP.get_response(uri)
|
26
31
|
rescue
|
27
|
-
|
32
|
+
return "Failed to connect with API endpoint."
|
28
33
|
end
|
29
34
|
|
30
35
|
parsed_json = JSON.parse(res.body)[0]["symbol"][0];
|
31
36
|
|
32
37
|
if ! parsed_json['error'].nil?
|
33
|
-
|
38
|
+
return "Error: " + parsed_json['error'].to_s
|
34
39
|
end
|
35
40
|
|
36
41
|
return parsed_json['data'].to_s if res.is_a?(Net::HTTPSuccess)
|
data/qrcode.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Dante Bradshaw"]
|
9
9
|
spec.email = ["plansuperior@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary = "Generate a QR Code using the
|
12
|
-
|
11
|
+
spec.summary = "Generate a QR Code using the GOQR api at https://goqr.me/"
|
12
|
+
spec.description = "This is a wrapper for the goqr.me api, it features methods for reading QR Codes as well as creating them."
|
13
13
|
spec.homepage = "https://www.dantebradshaw.com"
|
14
14
|
spec.license = "MIT"
|
15
15
|
spec.required_ruby_version = ">= 2.6.0"
|
@@ -17,7 +17,8 @@ Gem::Specification.new do |spec|
|
|
17
17
|
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
18
18
|
|
19
19
|
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
-
|
20
|
+
|
21
|
+
spec.metadata["source_code_uri"] = "https://github.com/DanteB918/QRGo-Wrapper"
|
21
22
|
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
22
23
|
|
23
24
|
# Specify which files should be added to the gem when it is released.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qrgo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dante Bradshaw
|
@@ -10,7 +10,8 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2024-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description: This is a wrapper for the goqr.me api, it features methods for reading
|
14
|
+
QR Codes as well as creating them.
|
14
15
|
email:
|
15
16
|
- plansuperior@gmail.com
|
16
17
|
executables: []
|
@@ -31,6 +32,7 @@ licenses:
|
|
31
32
|
- MIT
|
32
33
|
metadata:
|
33
34
|
homepage_uri: https://www.dantebradshaw.com
|
35
|
+
source_code_uri: https://github.com/DanteB918/QRGo-Wrapper
|
34
36
|
post_install_message:
|
35
37
|
rdoc_options: []
|
36
38
|
require_paths:
|
@@ -49,5 +51,5 @@ requirements: []
|
|
49
51
|
rubygems_version: 3.3.5
|
50
52
|
signing_key:
|
51
53
|
specification_version: 4
|
52
|
-
summary: Generate a QR Code using the
|
54
|
+
summary: Generate a QR Code using the GOQR api at https://goqr.me/
|
53
55
|
test_files: []
|