Class: PandaProcessor

Inherits:
Paperclip::Processor
  • Object
show all
Defined in:
lib/panda-processor.rb

Instance Method Summary collapse

Instance Method Details

#makeObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/panda-processor.rb', line 2

def make
  begin
    Tinify.key = Rails.application.secrets.panda_api_key
    source = Tinify.from_file(File.expand_path(file.path))
    source.to_file(File.expand_path(file.path))
    file
  rescue Tinify::AccountError, Tinify::ServerError, Tinify::ConnectionError => e
    puts 'CUSTOM TinifyError: ' + e.message
    file
  rescue => e
    Rollbar.error(e)
    file
  end
end