Sha256: 8542c4c4191dac3d2c025b4d03791e8a107036c363edb1c4ed58f268f4aa7818

Contents?: true

Size: 804 Bytes

Versions: 6

Compression:

Stored size: 804 Bytes

Contents

class Kaui::BundlesController < Kaui::EngineController

  def index
    if params[:bundle_id].present?
      redirect_to bundle_path(params[:bundle_id])
    end
  end

  def show
    key = params[:id]
    if key.present?
      # support id (UUID) and external key search
      if key =~ /[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}/
        @bundle = Kaui::KillbillHelper.get_bundle(key)
      else
        @bundle = Kaui::KillbillHelper.get_bundle_by_external_key(key)
      end

      if @bundle.present?
        @subscriptions = Kaui::KillbillHelper.get_subscriptions_for_bundle(@bundle.bundle_id)
      else
        flash[:error] = "Bundle #{key} not found"
        redirect_to :action => :index
      end
    else
      flash[:error] = "No id given"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
kaui-0.0.8 app/controllers/kaui/bundles_controller.rb
kaui-0.0.7 app/controllers/kaui/bundles_controller.rb
kaui-0.0.6 app/controllers/kaui/bundles_controller.rb
kaui-0.0.5 app/controllers/kaui/bundles_controller.rb
kaui-0.0.4 app/controllers/kaui/bundles_controller.rb
kaui-0.0.3 app/controllers/kaui/bundles_controller.rb