Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jhsu/google-qr

[DEPRECATED]: simple google charts qr code wrapper
https://github.com/jhsu/google-qr

Last synced: about 2 months ago
JSON representation

[DEPRECATED]: simple google charts qr code wrapper

Awesome Lists containing this project

README

        

# Google Charts QR Code wrapper [![Build Status](http://travis-ci.org/jhsu/google-qr.png)](http://travis-ci.org/jhsu/google-qr)

Generate url strings and HTML img tags for QR codes from [Google's QR code infographics API](https://developers.google.com/chart/infographics/docs/qr_codes)

## 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
#=> ""

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

"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.