Sha256: ea06b828c28f02d25e3daa1676c111852a61fb920c760d6e3be761459837555f

Contents?: true

Size: 784 Bytes

Versions: 3

Compression:

Stored size: 784 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
    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
iugusdk-1.0.0.alpha.21 app/controllers/iugu/plan_controller.rb
iugusdk-1.0.0.alpha.20 app/controllers/iugu/plan_controller.rb
iugusdk-1.0.0.alpha.19 app/controllers/iugu/plan_controller.rb