class PinPayment::BankAccount
Attributes
bank_name[RW]
bsb[RW]
name[RW]
number[RW]
token[RW]
Public Class Methods
create(bank_account_data)
click to toggle source
Uses the pin API to create a bank account.
@param [Hash] bank_account_data @option bank_account_data [String] :name required @option bank_account_data [String] :bsb required @option bank_account_data [String] :number required @return [PinPayment::BankAccount]
# 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 options = parse_options_for_request(attributes, bank_account_data) response = post(URI.parse(PinPayment.api_url).tap{|uri| uri.path = '/1/bank_accounts' }, options) new(response.delete('token'), response) end
Protected Class Methods
attributes()
click to toggle source
# File lib/pin_payment/bank_account.rb, line 29 def self.attributes [:token, :name, :bsb, :number, :bank_name] end
Public Instance Methods
to_hash()
click to toggle source
@return [Hash]
# 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