Class: Caboose::MediaImage
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Caboose::MediaImage
- Defined in:
- app/models/caboose/media_image.rb
Instance Method Summary collapse
Instance Method Details
#api_hash ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/caboose/media_image.rb', line 31 def api_hash { :id => self.id, :name => self.name, :description => self.description, :tiny_url => self.image.url(:tiny), :thumb_url => self.image.url(:thumb), :large_url => self.image.url(:large), :original_url => self.image.url(:original) } end |
#process ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/models/caboose/media_image.rb', line 19 def process config = YAML.load(File.read(Rails.root.join('config', 'aws.yml')))[Rails.env] bucket = config['bucket'] uri = "http://#{bucket}.s3.amazonaws.com/media-images/#{self.id}#{File.extname(self.name.downcase)}" puts "Processing #{uri}..." self.image = URI.parse(uri) self.save end |