0.0
No commit activity in last 3 years
No release in over 3 years
An rqrcode wrapper for adding a website, a contact, wi-fi settings, location, event, cryptocurrency and more
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.5, >= 0.5.2
 Project Readme

Introducing the qrcode_intent gem

require 'qrcode_intent'

# -- Adding an event -----------

h = {
  title: 'Book Festival', start: 'june 24', end: 'june 25', 
  location: 'Edinburgh', description: 'Refreshments included'
}
qci = QRCodeIntent.new(event: h)
s = qci.to_svg

# ... or in block form

qci = QRCodeIntent.new
qci.add_event do |e|
  e.title = 'Book Festival'
  e.start = 'june 24'
  e.end   = 'june 25'
  e.location    = 'Edinburgh'
  e.description =  'Refreshments included'
end

s = qci.to_s

Output:

BEGIN:VEVENT
SUMMARY:Book Festival
DTSTART;VALUE=DATE:20210624
DTEND;VALUE=DATE:20210625
LOCATION:Edinburgh
DESCRIPTION:Refreshments included
END:VEVENT
s = qci.to_svg


# -- Adding a contact ---------------

h = {
  firstname: 'James',
  lastname: 'Robertson',
  tel: '0131 511 1610',
  addr: '45 High Street',
  email: 'james@example.com'
}


qci = QRCodeIntent.new(contact: h)
s = qci.to_svg

# .. or in block form

qci = QRCodeIntent.new
qci.add_contact do |c|
  c.firstname = 'James'
  c.lastname = 'Robertson'
  c.tel = '0131 511 1610'
  c.addr = '45 High Street'
  c.email = 'james@example.com'
end

s = qci.to_s

output:

BEGIN:VCARD
VERSION:3.0
N:Robertson;James;;;
FN:James Robertson
EMAIL:james@example.com
ADR:;;45 High Street;;;;
TEL:0131 511 1610
END:VCARD
s = qci.to_svg

# -- Adding Wi-Fi settings -----------------

qci = QRCodeIntent.new
qci.add_wifi do |wifi|
  wifi.ssid = 'Lucky2'
  wifi.type = 'WPA'
  wifi.password = 'foo123465'
end

# note: apply type 'WPA' when WPA or WPA2

s = qci.to_s #=> "WIFI:SLucky2;T:WPA;P:foo123465;;" 
s = qci.to_svg

# -- Adding a website ------------------------

qci = QRCodeIntent.new(website: 'http://news.bbc.co.uk')
qci.to_s #=> http://news.bbc.co.uk
s = qci.to_svg


# -- Adding a location ------------------------

qci = QRCodeIntent.new(location: '55.8835644,-3.2312978')
qci.to_s #=> geo:55.8835644,-3.2312978
s = qci.to_svg

Resources

qrcode_intent qrcode rqrcode vcard event vevent website url contact