Sha256: a5f49d5160bb4aa66ae18f8c0e4383b92bf6a38b658d63d0826140a66de8d5f2

Contents?: true

Size: 803 Bytes

Versions: 1

Compression:

Stored size: 803 Bytes

Contents

class Kaui::BundlesController < ApplicationController

  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

1 entries across 1 versions & 1 rubygems

Version Path
kaui-0.0.2 app/controllers/kaui/bundles_controller.rb