Class: Besepa::Debit

Inherits:
Resource show all
Includes:
ApiCalls::Create, ApiCalls::Destroy, ApiCalls::List, ApiCalls::Update
Defined in:
lib/besepa/debit.rb

Constant Summary collapse

FIELDS =
[:id, :reference, :amount, :currency, :status,
:collect_at, :sent_at, :description, :metadata,
:error_code, :platform_error_code, :created_at, :rejected_at,
:debtor_bank_account_id, :creditor_bank_account_id]
ALLOWED_NILS =
[:collect_at]

Constants included from Utils::Request

Utils::Request::END_POINT_URL_PREFIX

Instance Attribute Summary collapse

Attributes inherited from Resource

#activities

Instance Method Summary collapse

Methods included from ApiCalls::Destroy

#destroy

Methods included from ApiCalls::Update

#save

Methods included from ApiCalls::Create

included

Methods included from ApiCalls::List

included

Methods inherited from Resource

#as_json, handle_errors, #initialize, klass_name, #klass_name, #serializable_hash

Methods included from Utils::Request

#delete, #get, #post, #put

Methods included from Utils::Connection

#connection

Constructor Details

This class inherits a constructor from Besepa::Resource

Instance Attribute Details

#creditor_bank_accountObject

Returns the value of attribute creditor_bank_account.



20
21
22
# File 'lib/besepa/debit.rb', line 20

def 
  @creditor_bank_account
end

#customerObject

Returns the value of attribute customer.



20
21
22
# File 'lib/besepa/debit.rb', line 20

def customer
  @customer
end

#debtor_bank_accountObject

Returns the value of attribute debtor_bank_account.



20
21
22
# File 'lib/besepa/debit.rb', line 20

def 
  @debtor_bank_account
end

#remittanceObject

Returns the value of attribute remittance.



20
21
22
# File 'lib/besepa/debit.rb', line 20

def remittance
  @remittance
end

#subscriptionObject

Returns the value of attribute subscription.



20
21
22
# File 'lib/besepa/debit.rb', line 20

def subscription
  @subscription
end

Instance Method Details

#allowed_nilsObject



35
36
37
# File 'lib/besepa/debit.rb', line 35

def allowed_nils
  ALLOWED_NILS
end

#to_hashObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/besepa/debit.rb', line 22

def to_hash
  values = {}
  self.class::FIELDS.each do |key|
    values[key] = self.send("#{key.to_s}")
  end
  values[:debtor_bank_account] = .to_hash if 
  values[:creditor_bank_account] = .to_hash if 
  values[:customer] = customer.to_hash if customer
  values[:remittance] = remittance.to_hash if remittance
  values[:subscription] = subscription.to_hash if subscription
  values
end