Class: Workarea::AssetEndpoints::ProductImages

Inherits:
Base
  • Object
show all
Defined in:
lib/workarea/asset_endpoints/product_images.rb

Instance Attribute Summary

Attributes inherited from Base

#app, #env, #params

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Workarea::AssetEndpoints::Base

Instance Method Details

#resultObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/workarea/asset_endpoints/product_images.rb', line 4

def result
  Catalog::Product
    .find_by(slug: params[:slug])
    .images
    .find(params[:image_id])
    .process(params[:job])

rescue Mongoid::Errors::DocumentNotFound
  Catalog::ProductPlaceholderImage.cached.process(params[:job])
end