module MnoEnterprise::Concerns::Controllers::Jpi::V1::MarketplaceController
Public Instance Methods
app_relation()
click to toggle source
# File lib/mno_enterprise/concerns/controllers/jpi/v1/marketplace_controller.rb, line 41 def app_relation if MnoEnterprise.marketplace_listing MnoEnterprise::App.where('nid.in' => MnoEnterprise.marketplace_listing) else MnoEnterprise::App.all end end
index()
click to toggle source
¶ ↑
Instance methods
¶ ↑
GET /mnoe/jpi/v1/marketplace
# File lib/mno_enterprise/concerns/controllers/jpi/v1/marketplace_controller.rb, line 17 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
show()
click to toggle source
GET /mnoe/jpi/v1/marketplace/1
# File lib/mno_enterprise/concerns/controllers/jpi/v1/marketplace_controller.rb, line 37 def show @app = MnoEnterprise::App.find(params[:id]) end