/page_glimpse

Ruby: A little Ruby wrapper for the PageGlimpse API for generating webpage snapshots - glimpses - in a snap.

Primary LanguageRubyMIT LicenseMIT

PAGE_GLIMPSE

A little Ruby wrapper for the PageGlimpse API for generating webpage snapshots – glimpses – in a snap.

What Is PageGlimpse?

http://pageglimpse.com

Installation

Dependency:

sudo gem install jnunemaker-httparty

Gem:

sudo gem install grimen-page_glimpse

PageGlimpse API Key

You’ll need a API key, which you can get for free here:

http://pageglimpse.com/signup

Usage/Examples

Initialize:

snapper = PageGlimpse.new('ec0ccd....26df') # => nil

Tell PageGlimpse to generate a webpage thumbnail:

snapper.request!('http://mypage.com') # => true/false

Check if thumbnail exists for a webpage:

snapper.exists?('http://techcrunch.com', :size => :medium) # => true/false

Get direct URL for a cached webpage thumbnail image:

snapper.thumbnail_url('http://techcrunch.com', :size => :large) # => 'http://images.pageglimpse.com/v1/thumbnails?url=http://techcrunch.com&size=large&devkey=ec0ccd....26df'

Get thumbnail (PNG image) for a webpage:

snapper.thumbnail('http://techcrunch.com', :size => :small) # => [raw PNG data]

Save thumbnail into a file (PNG image) for a webpage:

snapper.save!('http://techcrunch.com', '/Users/kid_icarus/techcrunch_thumbnail.png', :size => :large) # => true/false

More?

Yes, all the PageGlimpse API options are supported but not documented in this README right now. Peep the code and read more about the options: http://www.pageglimpse.com/features/api.

License

Copyright © Jonas Grimfelt, released under the MIT-license.