Sha256: c4bde17872c5e14cde737c74a3abb45243e0422dc0da2e702f76bf3cfb61ef44

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

require 'open_pay_resource'



#TODO change name
class Bankaccounts < OpenPayResource


  def create(bank_account,customer_id)
    customers=@api_hook.create(:customers)
    customers.create_bank_account(customer_id,bank_account)
  end


  def get(customer_id='',bank_account=nil)
    customers=@api_hook.create(:customers)

    if bank_account
      customers.get_bank_account(customer_id,bank_account)
    else
      customers.get_bank_account(customer_id)
    end

  end


  def delete(customer_id,bank_account)
    customers=@api_hook.create(:customers)
    customers.delete_bank_account(customer_id,bank_account)
  end


  def each(customer_id)
    customers=@api_hook.create(:customers)
     customers.each_bank_account(customer_id)  do |acc|
       yield acc
     end

  end


  def all(customer_id)
      customers=@api_hook.create(:customers)
      customers.all_bank_accounts(customer_id)
  end


  def delete_all(customer_id)

    if env == :production
      raise OpenpayException.new('This method is not supported on PRODUCTION',false)
    end

    customers=@api_hook.create(:customers)
    customers.delete_all_bank_accounts(customer_id)

  end








end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
openpay-1.0.1 lib/OpenPay/bankaccounts.rb
openpay-0.9.8 lib/OpenPay/bankaccounts.rb