Il gestore qui descritto elabora i callback dal servizio web screenshot di GrabzIt. L'URL di questo gestore viene passato a GrabzIt in callBackURL
parametro del save metodo.
Tuttavia questa tecnica funzionerà solo se il gestore è accessibile tramite Internet.
I seguenti parametri vengono passati al gestore come parametri GET.
Se vuoi bloccare tutti gli accessi al gestore, ad eccezione di GrabzIt, usa questo tecnica di sicurezza.
Questo esempio mostra come implementare un gestore GrabzIt Ruby. Questo acquisisce cinque parametri passati dal servizio GrabzIt, incluso l'id univoco dello screenshot che viene passato al get_result metodo.
Questo metodo quindi restituisce lo screenshot, che è saved nella directory dello screenshot. Tuttavia se a nil
il valore viene restituito da get_result Questo metodo indica che si è verificato un errore.
require 'grabzit' class HandlerController < ApplicationController def index message = params[:message] customId = params[:customid] id = params[:id] filename = params[:filename] format = params[:format] targetError = params[:targeterror] grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")%>") result = grabzItClient.get_result(id) if result == nil return end # Ensure that the application has the correct rights for this directory. screenshot = File.new("public/screenshots/"+filename, "wb") screenshot.write(result) screenshot.close end end