Sha256: b3649a28f9dfcfc6eea1c7b5dfdd88fbc78c52865698ad16997416cafcec65e0

Contents?: true

Size: 858 Bytes

Versions: 4

Compression:

Stored size: 858 Bytes

Contents

class Iugu::PlanController < Iugu::AccountSettingsController
  def index
    params[:id] ? @account = current_user.accounts.find(params[:id]) : @account = current_user_account.account
    get_index_data
    render 'iugu/plan/index'
  end

  def change
    return unless params[:plan]
    params[:id] ? @account = current_user.accounts.find(params[:id]) : @account = current_user_account.account

    subscription = Iugu::Api::Subscription.find @account.subscription_id.to_uuid.to_s
    @account.clear_cached_subscription_features if subscription.change_plan params[:plan]

    get_index_data
    render 'iugu/plan/index'
  end

  private

  def get_index_data
    @currency = locale_to_currency I18n.locale
    @plans = Iugu::Api::Plan.with_currency @currency

    @subscription = Iugu::Api::Subscription.find @account.subscription_id.to_uuid.to_s
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
iugusdk-1.0.0.alpha.25 app/controllers/iugu/plan_controller.rb
iugusdk-1.0.0.alpha.24 app/controllers/iugu/plan_controller.rb
iugusdk-1.0.0.alpha.23 app/controllers/iugu/plan_controller.rb
iugusdk-1.0.0.alpha.22 app/controllers/iugu/plan_controller.rb