wiiikiii / google-qr

[DEPRECATED]: simple google charts qr code wrapper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

License:MIT License


Languages

Language:Ruby 100.0%