qrcode_intent 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/qrcode_intent.rb +115 -0
- metadata +91 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8379525d4cad897017b4990bb5fe68f7c467347cd4bc3c239282855e4fda5a70
|
4
|
+
data.tar.gz: 5aca60fab9e9777e676640d03d548d83f1e3978c209fddcf5329340ac54ad10d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f7d98c58e47e351d28607810d6229ec955ad13751b95f1f66d66cbefe037755c1184e506ac4ecd7c7721a30c3043bd24fa96e27ee1e9426d1ea9cf780afb5098
|
7
|
+
data.tar.gz: daed90a7cb48d33f3895d1b54578e12f02775aef7edee6c6feefbbf35253136e0fe4d5c44a8b53ab1a5b089f2525a05b93b31fe220d0975fe4a452f1ec6e51e0
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
@@ -0,0 +1,115 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: qrcode_intent.rb
|
4
|
+
|
5
|
+
require 'rqrcode'
|
6
|
+
require 'simplevpim'
|
7
|
+
|
8
|
+
|
9
|
+
class QRCodeIntent
|
10
|
+
|
11
|
+
attr_reader :to_s
|
12
|
+
|
13
|
+
WiFi = Struct.new(*%i(ssid type password))
|
14
|
+
|
15
|
+
def initialize(obj=nil, event: nil, contact: nil, website: nil,
|
16
|
+
wifi: nil, location: nil, debug: false)
|
17
|
+
|
18
|
+
@debug = debug
|
19
|
+
|
20
|
+
if website then
|
21
|
+
|
22
|
+
add_website website
|
23
|
+
|
24
|
+
elsif location
|
25
|
+
|
26
|
+
add_location location
|
27
|
+
|
28
|
+
elsif event
|
29
|
+
|
30
|
+
add_event event
|
31
|
+
|
32
|
+
elsif contact
|
33
|
+
|
34
|
+
add_contact contact
|
35
|
+
|
36
|
+
elsif wifi
|
37
|
+
|
38
|
+
add_wifi wifi
|
39
|
+
|
40
|
+
else
|
41
|
+
|
42
|
+
if obj.is_a? String then
|
43
|
+
obj
|
44
|
+
elsif obj.is_a? Hash
|
45
|
+
obj[:start] ? add_event(obj) : add_contact(obj)
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
def add_contact(obj=nil, &blk)
|
53
|
+
|
54
|
+
@to_s = if block_given? then
|
55
|
+
|
56
|
+
SimpleVpim.new(:contact, &blk).to_vcard.to_s
|
57
|
+
|
58
|
+
elsif obj
|
59
|
+
|
60
|
+
SimpleVpim.new(obj).to_vcard.to_s
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
def add_event(obj=nil, &blk)
|
67
|
+
|
68
|
+
@to_s = if block_given? then
|
69
|
+
|
70
|
+
SimpleVpim.new(:event, &blk).to_vevent
|
71
|
+
|
72
|
+
elsif obj
|
73
|
+
|
74
|
+
SimpleVpim.new(obj).to_vevent
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
# e.g. add_location '55.8835644,-3.2312978'
|
81
|
+
#
|
82
|
+
def add_location(s)
|
83
|
+
@to_s = 'geo:' + s
|
84
|
+
end
|
85
|
+
|
86
|
+
# e.g. add_website 'https://news.bbc.co.uk/'
|
87
|
+
#
|
88
|
+
def add_website(s)
|
89
|
+
@to_s = s
|
90
|
+
end
|
91
|
+
|
92
|
+
def add_wifi(obj=nil, &blk)
|
93
|
+
|
94
|
+
h = if block_given? then
|
95
|
+
|
96
|
+
wifi = WiFi.new(nil, 'WPA', nil)
|
97
|
+
yield wifi
|
98
|
+
wifi.to_h
|
99
|
+
|
100
|
+
|
101
|
+
elsif obj.is_a? Hash
|
102
|
+
|
103
|
+
obj
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
@to_s = "WIFI:S%s;T:%s;P:%s;;" % [h[:ssid], h[:type], h[:password]]
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
def to_svg()
|
112
|
+
RQRCode::QRCode.new(@to_s).as_svg
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: qrcode_intent
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjEwNjIyMTMxMTE2WhcN
|
15
|
+
MjIwNjIyMTMxMTE2WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDkBXlw
|
17
|
+
625ha0SqIYLn40Sbe5pMbGvbZ7aY0kZZoOUfoDtnY6q+v7U8e4087zAr8lBheP+H
|
18
|
+
6RvRU3MiyWSWT48J8lSNMlSdRhYMF04Cc+wuM9KeXJGUB7mXc2CfOB7BzWpfEDPE
|
19
|
+
I9vflmYvGI9RL5Z28cKP5e+2+QWYQ4g5i1tzKUmVHUYQmwGekq1K9FyF15HvUSlm
|
20
|
+
yUValnOrdLqJKeR/vZlO3aP+dFLRKJFj7H66SSHt3oOEFZLZigVLL8pOEkjRrcQH
|
21
|
+
HHqnJGDNdgz1VK86BDRoQHx5mJb7b5hEhXJIfCV1aBGO577TdzObVq0Ug2rx0c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0G
|
37
|
+
-----END CERTIFICATE-----
|
38
|
+
date: 2021-06-22 00:00:00.000000000 Z
|
39
|
+
dependencies:
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: simplevpim
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.5'
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.5.2
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0.5'
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.5.2
|
60
|
+
description:
|
61
|
+
email: digital.robertson@gmail.com
|
62
|
+
executables: []
|
63
|
+
extensions: []
|
64
|
+
extra_rdoc_files: []
|
65
|
+
files:
|
66
|
+
- lib/qrcode_intent.rb
|
67
|
+
homepage: https://github.com/jrobertson/qrcode_intent
|
68
|
+
licenses:
|
69
|
+
- MIT
|
70
|
+
metadata: {}
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
requirements: []
|
86
|
+
rubygems_version: 3.1.2
|
87
|
+
signing_key:
|
88
|
+
specification_version: 4
|
89
|
+
summary: An rqrcode wrapper for adding a website, a contact, wi-fi settings, location,
|
90
|
+
or event.
|
91
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|