LivePaper
Provides a ruby interface to the Live Paper service by HP for creating watermarked images, QR codes, and mobile-friendly shortened URLs.
Installation
Add this line to your application's Gemfile:
gem 'live_paper'
And then execute:
$ bundle
Or install it yourself as:
$ gem install live_paper
Register with the Live Paper Service
In order to generate access credentials, register here: https://www.linkcreationstudio.com
Usage
Authenticate
The live_paper gem requires authentication. Obtain your credentials from https://www.linkcreationstudio.com/api/libraries/ruby/
lp = LivePaper.auth({id: "your client id", secret: "your client secret"})
Shortening URLs
short_url = lp.shorten('http://www.google.com')
Generating QR Codes
qr_bytes = lp.qr_bytes('http://www.amazon.com')
File.open("qr.png", "w") { |f| f.write(qr_bytes) }
Watermarking Images
wm_bytes = lp.watermark_bytes("http://www.hp.com",
"http://www.letsstartsmall.com/ITSE2313_WebAuthoring/images/unit3/jpg_example1.jpg")
File.open("watermark.jpg", "w:UTF-8") { |f| f.write(wm_bytes.force_encoding("UTF-8")) }
Note: Version 1 of the API only supports returning image bytes. Version 2 may host publicly accessible images.
Contributing
- Fork it ( https://github.com/IPGPTP/live_paper/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request