Class: PinPayment::BankAccount
- Defined in:
- lib/pin_payment/bank_account.rb
Instance Attribute Summary collapse
-
#bank_name ⇒ Object
readonly
Returns the value of attribute bank_name.
-
#bsb ⇒ Object
readonly
Returns the value of attribute bsb.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Class Method Summary collapse
-
.create(bank_account_data) ⇒ PinPayment::BankAccount
Uses the pin API to create a bank account.
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from PinPayment::Base
Instance Attribute Details
#bank_name ⇒ Object
Returns the value of attribute bank_name.
4 5 6 |
# File 'lib/pin_payment/bank_account.rb', line 4 def bank_name @bank_name end |
#bsb ⇒ Object
Returns the value of attribute bsb.
4 5 6 |
# File 'lib/pin_payment/bank_account.rb', line 4 def bsb @bsb end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/pin_payment/bank_account.rb', line 4 def name @name end |
#number ⇒ Object
Returns the value of attribute number.
4 5 6 |
# File 'lib/pin_payment/bank_account.rb', line 4 def number @number end |
#token ⇒ Object
Returns the value of attribute token.
4 5 6 |
# File 'lib/pin_payment/bank_account.rb', line 4 def token @token end |
Class Method Details
.create(bank_account_data) ⇒ PinPayment::BankAccount
Uses the pin API to create a bank account.
14 15 16 17 18 19 |
# File 'lib/pin_payment/bank_account.rb', line 14 def self.create bank_account_data attributes = self.attributes - [:token,:bank_name] # fix attributes allowed by POST API = (attributes, bank_account_data) response = post(URI.parse(PinPayment.api_url).tap{|uri| uri.path = '/1/bank_accounts' }, ) new(response.delete('token'), response) end |
Instance Method Details
#to_hash ⇒ Hash
23 24 25 |
# File 'lib/pin_payment/bank_account.rb', line 23 def to_hash {}.tap{|h| self.class.attributes.each{|k| v = send(k) ; h[k] = v if v }} end |