Class: OFX::BankingAccount
- Inherits:
-
Object
- Object
- OFX::BankingAccount
- Defined in:
- lib/ofx/banking_message_set.rb,
lib/ofx/1.0.2/banking_message_set.rb
Instance Attribute Summary collapse
-
#account_identifier ⇒ Object
Returns the value of attribute account_identifier.
-
#account_key ⇒ Object
Returns the value of attribute account_key.
-
#account_type ⇒ Object
Returns the value of attribute account_type.
-
#bank_identifier ⇒ Object
Returns the value of attribute bank_identifier.
-
#branch_identifier ⇒ Object
Returns the value of attribute branch_identifier.
Class Method Summary collapse
- .account_type_to_ofx_102_s(account_type) ⇒ Object
- .from_ofx_102_hash(account_hash) ⇒ Object
- .ofx_102_s_to_account_type(account_type) ⇒ Object
Instance Method Summary collapse
Instance Attribute Details
#account_identifier ⇒ Object
Returns the value of attribute account_identifier.
93 94 95 |
# File 'lib/ofx/banking_message_set.rb', line 93 def account_identifier @account_identifier end |
#account_key ⇒ Object
Returns the value of attribute account_key.
95 96 97 |
# File 'lib/ofx/banking_message_set.rb', line 95 def account_key @account_key end |
#account_type ⇒ Object
Returns the value of attribute account_type.
94 95 96 |
# File 'lib/ofx/banking_message_set.rb', line 94 def account_type @account_type end |
#bank_identifier ⇒ Object
Returns the value of attribute bank_identifier.
91 92 93 |
# File 'lib/ofx/banking_message_set.rb', line 91 def bank_identifier @bank_identifier end |
#branch_identifier ⇒ Object
Returns the value of attribute branch_identifier.
92 93 94 |
# File 'lib/ofx/banking_message_set.rb', line 92 def branch_identifier @branch_identifier end |
Class Method Details
.account_type_to_ofx_102_s(account_type) ⇒ Object
129 130 131 132 133 134 135 136 137 |
# File 'lib/ofx/1.0.2/banking_message_set.rb', line 129 def self.account_type_to_ofx_102_s(account_type) case account_type when :checking then 'CHECKING' when :savings then 'SAVINGS' when :money_market then 'MONEYMRKT' when :line_of_credit then 'CREDITLINE' else raise NotImplementedError end end |
.from_ofx_102_hash(account_hash) ⇒ Object
139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/ofx/1.0.2/banking_message_set.rb', line 139 def self.from_ofx_102_hash(account_hash) account = OFX::BankingAccount.new account.bank_identifier = account_hash['BANKID'] account.branch_identifier = account_hash['BRANCHID'] account.account_identifier = account_hash['ACCTID'] account.account_type = BankingAccount.ofx_102_s_to_account_type(account_hash['ACCTTYPE']) account.account_key = account_hash['ACCTKEY'] account end |
.ofx_102_s_to_account_type(account_type) ⇒ Object
120 121 122 123 124 125 126 127 128 |
# File 'lib/ofx/1.0.2/banking_message_set.rb', line 120 def self.ofx_102_s_to_account_type(account_type) case account_type when 'CHECKING' then :checking when 'SAVINGS' then :savings when 'MONEYMRKT' then :money_market when 'CREDITLINE' then :line_of_credit else raise NotImplementedError end end |
Instance Method Details
#to_ofx_102_request_body ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/ofx/1.0.2/banking_message_set.rb', line 108 def to_ofx_102_request_body body = [] body << " <BANKACCTFROM>" body << " <BANKID>#{bank_identifier}" body << " <BRANCHID>#{branch_identifier}" if branch_identifier body << " <ACCTID>#{account_identifier}" body << " <ACCTTYPE>#{BankingAccount.account_type_to_ofx_102_s(account_type)}" body << " <ACCTKEY>#{account_key}" if account_key body << " </BANKACCTFROM>\n" body.join("\n") end |