Created
March 2, 2010 21:09
-
-
Save trevmex/319951 to your computer and use it in GitHub Desktop.
This file contains 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
module ActiveResource | |
class Base | |
# Returns the raw data to display the thumbnail of an Alfresco document | |
def thumbnail | |
if self.doclib | |
begin | |
Net::HTTP.start(self.class.site.host, self.class.site.port) do |http| | |
req = Net::HTTP::Get.new(self.doclib, {'Content-Type' => 'image/png'}) | |
req.basic_auth self.class.user, self.class.password | |
http.request(req).body | |
end | |
rescue Exception => error_message | |
STDERR.puts "Failed to connect to #{self.class.site.to_s}: #{error_message}" | |
raise | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment