Class: OFX::AccountInformationResponse

Inherits:
TransactionalResponse show all
Defined in:
lib/ofx/signup_message_set.rb,
lib/ofx/1.0.2/signup_message_set.rb

Instance Attribute Summary collapse

Attributes inherited from TransactionalResponse

#client_cookie, #transaction_identifier

Attributes inherited from Response

#status

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TransactionalResponse

#to_ofx_102_s

Methods inherited from Response

#to_ofx_102_s

Instance Attribute Details

#accountsObject

Returns the value of attribute accounts.



76
77
78
# File 'lib/ofx/signup_message_set.rb', line 76

def accounts
  @accounts
end

#date_of_last_account_updateObject

Returns the value of attribute date_of_last_account_update.



75
76
77
# File 'lib/ofx/signup_message_set.rb', line 75

def 
  @date_of_last_account_update
end

Class Method Details

.from_ofx_102_hash(transaction_hash) ⇒ Object



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/ofx/1.0.2/signup_message_set.rb', line 120

def self.from_ofx_102_hash(transaction_hash)
    response = AccountInformationResponse.new
               
    response.transaction_identifier = transaction_hash['TRNUID']
    response.status = OFX::Status.from_ofx_102_hash(transaction_hash['STATUS'])
    
    response_hash = transaction_hash['ACCTINFORS']
    if not response_hash
      return response
    end
    response. = response_hash['DTACCTUP'].to_datetime if response_hash['DTACCTUP']
    
    response.accounts = []
     = response_hash['ACCTINFO'] if response_hash['ACCTINFO'].kind_of?(Array)
     = [response_hash['ACCTINFO']] if response_hash['ACCTINFO'].kind_of?(Hash)
     = [] unless 
    .each do ||
         = OFX::AccountInformation.new
        .description = ['DESC']
        .phone_number = ['PHONE']
        
        if ['BANKACCTINFO']
            bank_acct_info_hash = ['BANKACCTINFO']
            . = OFX::BankingAccountInformation.new
            
            acct_from_hash = bank_acct_info_hash['BANKACCTFROM']
            .. = OFX::BankingAccount.new
            ...bank_identifier = acct_from_hash['BANKID']
            ...branch_identifier = acct_from_hash['BRANCHID']
            ... = acct_from_hash['ACCTID']
            ... = case acct_from_hash['ACCTTYPE']
                                                                        when 'CHECKING' then :checking
                                                                        when 'SAVINGS' then :savings
                                                                        when 'MONEYMRKT' then :money_market
                                                                        when 'CREDITLINE' then :line_of_credit
                                                                        else raise NotImplementedError
                                                                    end
            ... = acct_from_hash['ACCTKEY']
            
            ..supports_transaction_detail_downloads = bank_acct_info_hash['SUPTXDL'] == 'Y'
            ..transfer_source = bank_acct_info_hash['XFERSRC'] == 'Y'
            ..transfer_destination = bank_acct_info_hash['XFERDEST'] == 'Y'
            ..status = case bank_acct_info_hash['SVCSTATUS']
                                                        when 'AVAIL' then :available
                                                        when 'PEND' then :pending
                                                        when 'ACTIVE' then :active
                                                        else raise NotImplementedError
                                                      end
        elsif ['CCACCTINFO']
            cc_acct_info_hash = ['CCACCTINFO']
            . = OFX::CreditCardAccountInformation.new
            
            acct_from_hash = cc_acct_info_hash['CCACCTFROM']
            .. = OFX::CreditCardAccount.new
            ... = acct_from_hash['ACCTID']
            ... = acct_from_hash['ACCTKEY']
            
            ..supports_transaction_detail_downloads = cc_acct_info_hash['SUPTXDL'] == 'Y'
            ..transfer_source = cc_acct_info_hash['XFERSRC'] == 'Y'
            ..transfer_destination = cc_acct_info_hash['XFERDEST'] == 'Y'
            ..status = case cc_acct_info_hash['SVCSTATUS']
                                                        when 'AVAIL' then :available
                                                        when 'PEND' then :pending
                                                        when 'ACTIVE' then :active
                                                        else raise NotImplementedError
                                                      end
        elsif ['INVACCTINFO']
            cc_acct_info_hash = ['INVACCTINFO']
            . = OFX::CreditCardAccountInformation.new

            acct_from_hash = cc_acct_info_hash['INVACCTFROM']
            .. = OFX::CreditCardAccount.new
            ... = acct_from_hash['ACCTID']
            ..status = case cc_acct_info_hash['SVCSTATUS']
                                                        when 'AVAIL' then :available
                                                        when 'PEND' then :pending
                                                        when 'ACTIVE' then :active
                                                        else raise NotImplementedError
                                                      end
        else
            raise NotImplementedError
        end
        
        response.accounts << 
    end
    
    response
end

Instance Method Details

#account_identifier(account_id = nil) ⇒ Object



113
114
115
116
117
118
# File 'lib/ofx/1.0.2/signup_message_set.rb', line 113

def (=nil)
     = 0 if not 
    info = accounts[]. if accounts and accounts.size > 
    id = info.. if info
    return id
end

#ofx_102_nameObject



105
106
107
# File 'lib/ofx/1.0.2/signup_message_set.rb', line 105

def ofx_102_name
    'ACCTINFO'
end

#ofx_102_response_bodyObject

Raises:

  • (NotImplementedError)


109
110
111
# File 'lib/ofx/1.0.2/signup_message_set.rb', line 109

def ofx_102_response_body
    raise NotImplementedError
end