Sha256: b1616fd4c24ca6fb989cd8c0e9e3072757f39aace199323cda1a897d198a8fd6
Contents?: true
Size: 1.53 KB
Versions: 3
Compression:
Stored size: 1.53 KB
Contents
module MnoEnterprise::Concerns::Controllers::Jpi::V1::MarketplaceController extend ActiveSupport::Concern #================================================================== # Included methods #================================================================== # 'included do' causes the included code to be evaluated in the # context where it is included rather than being executed in the module's context included do respond_to :json end #================================================================== # Instance methods #================================================================== # GET /mnoe/jpi/v1/marketplace def index expires_in 0, public: true, must_revalidate: true @last_modified = app_relation.order_by('updated_at.desc').limit(1).first.try(:updated_at) if stale?(last_modified: @last_modified) @apps = Rails.cache.fetch("marketplace/index-apps-#{@last_modified}") do apps = app_relation.to_a apps.sort_by! { |app| [app.rank ? 0 : 1 , app.rank] } # the nil ranks will appear at the end apps end @categories = MnoEnterprise::App.categories(@apps) @categories.delete('Most Popular') respond_to do |format| format.json end end end # GET /mnoe/jpi/v1/marketplace/1 def show @app = MnoEnterprise::App.find(params[:id]) end def app_relation if MnoEnterprise.marketplace_listing MnoEnterprise::App.where('nid.in' => MnoEnterprise.marketplace_listing) else MnoEnterprise::App.all end end end
Version data entries
3 entries across 3 versions & 1 rubygems