Skip to content

jhsu/google-qr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Charts QR Code wrapper Build Status

Generate url strings and HTML img tags for QR codes from Google's QR code infographics API

Install

gem install google-qr

Usage

require 'google-qr'
# data and size are both required. size defaults to "100x100".
# The default margin is 4 and default error correction level is 'L'
chart = GoogleQR.new(:data => "SomeDataToQRify", :size => "100x100", :margin => 4, :error_correction => "L")

chart.to_s
#=> "https://chart.googleapis.com/chart?cht=qr&chl=SomeDataToQRify&chs=100x100"

chart.render
#=> "<img src='https://chart.googleapis.com/chart?cht=qr&chl=SomeDataToQRify&chs=100x100' width='100' height='100'/>"

You can also use the to_qr and to_qr_image methods on String objects.

"ExampleQRData".to_qr
#=> https://chart.googleapis.com/chart?cht=qr&chl=ExampleQRData&chs=100x100

"ExampleQRData".to_qr_image
<img src='https://chart.googleapis.com/chart?cht=qr&chl=ExampleQRData&chs=100x100' height='100' width='100' />

"ExampleQRData".to_qr(:size => "200x200")
#=> https://chart.googleapis.com/chart?cht=qr&chl=ExampleQRData&chs=200x200

Testing

To run the tests just run the rake command from the root of the gem.

About

[DEPRECATED]: simple google charts qr code wrapper

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages