Sha256: fff0453fade1d9905985dbfe17de692b69bb434c65c3522426f39cc6e86b1bca

Contents?: true

Size: 749 Bytes

Versions: 1

Compression:

Stored size: 749 Bytes

Contents

require 'sinatra/base'
require 'sinatra/json'

module Photograph
  # Preload the chrome instance
  Artist.browser

  class Service < ::Sinatra::Base
    helpers Sinatra::JSON

    get '/' do
      json :version => Photograph::VERSION
    end

    get '/shoot' do
      artist = Artist.new :url => params["url"],
                          :x   => params["x"].to_i,
                          :y   => params["y"].to_i,
                          :w   => params["w"].to_i,
                          :h   => params["h"].to_i,
                          :wait => params["wait"].to_f,
                          :selector => params["selector"]

      artist.shoot! do |image|
        send_file image.path,
          :type => :png
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
photograph-0.0.2 lib/photograph/service.rb