Sha256: bb8a3d643790ac7fc5a2e53d6db2b02565129e53e5f576406e0c2406641dd69e
Contents?: true
Size: 1.52 KB
Versions: 1
Compression:
Stored size: 1.52 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.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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mno-enterprise-api-3.3.1 | lib/mno_enterprise/concerns/controllers/jpi/v1/marketplace_controller.rb |