Coder Social home page Coder Social logo

google-qr's Introduction

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.

google-qr's People

Contributors

computeus avatar jhsu avatar nickhammond avatar steelthread avatar wiiikiii avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.