Created
May 9, 2012 16:33
-
-
Save jhchabran/2646331 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra/base' | |
require 'sinatra/json' | |
module Photograph | |
class Service < ::Sinatra::Base | |
helpers Sinatra::JSON | |
def artist | |
unless @artist | |
puts "CWEIR" | |
@artist = Artist.new | |
end | |
@artist | |
end | |
get '/' do | |
json :version => Photograph::VERSION | |
end | |
get '/shoot' do | |
options = {:url => params["url"], | |
:x => params["x"].to_i, | |
:y => params["y"].to_i, | |
:w => params["w"].to_i, | |
:h => params["h"].to_i} | |
artist.shoot! options do |image| | |
send_file image.path, :type => :png | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment