Class: OFX::Base::Document
- Inherits:
-
Object
- Object
- OFX::Base::Document
- Defined in:
- lib/ofx_kit/base/document.rb
Overview
Wraps the parsed OFX file, providing access to headers and XML body nodes. Consumers use #bank_statement_nodes and #credit_card_statement_nodes to extract statement data for domain object construction.
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Parsed OFX header key/value pairs (Hash).
Instance Method Summary collapse
-
#bank_statement_nodes ⇒ Object
Returns all STMTRS (bank statement) nodes in the document (Nokogiri::XML::NodeSet).
-
#credit_card_statement_nodes ⇒ Object
Returns all CCSTMTRS (credit card statement) nodes in the document (Nokogiri::XML::NodeSet).
-
#initialize(headers:, body:) ⇒ Document
constructor
Creates a new document.
-
#version ⇒ Object
Returns the OFX version declared in the file header (String or
nil).
Constructor Details
#initialize(headers:, body:) ⇒ Document
Creates a new document. headers is a Hash of parsed OFX header key/value pairs. body is a Nokogiri::XML::Document of the parsed OFX body.
18 19 20 21 |
# File 'lib/ofx_kit/base/document.rb', line 18 def initialize(headers:, body:) @headers = headers @body = body end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Parsed OFX header key/value pairs (Hash).
12 13 14 |
# File 'lib/ofx_kit/base/document.rb', line 12 def headers @headers end |
Instance Method Details
#bank_statement_nodes ⇒ Object
Returns all STMTRS (bank statement) nodes in the document (Nokogiri::XML::NodeSet).
32 33 34 |
# File 'lib/ofx_kit/base/document.rb', line 32 def bank_statement_nodes @body.css('STMTRS') end |
#credit_card_statement_nodes ⇒ Object
Returns all CCSTMTRS (credit card statement) nodes in the document (Nokogiri::XML::NodeSet).
39 40 41 |
# File 'lib/ofx_kit/base/document.rb', line 39 def credit_card_statement_nodes @body.css('CCSTMTRS') end |
#version ⇒ Object
Returns the OFX version declared in the file header (String or nil).
25 26 27 |
# File 'lib/ofx_kit/base/document.rb', line 25 def version @headers['VERSION'] end |