Sha256: 308176ab41fbdcdcddcb9e5334438c5b1c69bb5bc84f076ee275bd398530cdcc

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require_dependency "plaid_rails/application_controller"

module PlaidRails
  class AccountsController < ApplicationController
    
    def index
      @accounts =PlaidRails::Account.where(owner_id: account_params[:owner_id])
    end
    
    # display list of accounts for authenticated user
    def new
      account_params["access_token"]
      @user = Plaid::User.load(:connect, account_params["access_token"])
      @user.transactions
      @accounts = @user.accounts
    end
    
    #create new bank account and return all the accounts for the owner
    def create
      @accounts = PlaidRails::CreateAccountService.call(account_params)
    end
    
    def update
      
    end
    
    def destroy
      account = PlaidRails::Account.find(params[:id])
      account.destroy
    end
    
    private
    
    # Never trust parameters from the scary internet, only allow the white list through.
    def account_params
      params.require(:account).permit(:token,:access_token, :type,:name,
        :owner_id,:owner_type, :transactions_start_date, account_ids:[])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
plaid_rails-0.6.0 app/controllers/plaid_rails/accounts_controller.rb