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
Returns the value of attribute headers.
Instance Method Summary collapse
-
#bank_statement_nodes ⇒ Nokogiri::XML::NodeSet
All STMTRS (bank statement) nodes in the document.
-
#credit_card_statement_nodes ⇒ Nokogiri::XML::NodeSet
All CCSTMTRS (credit card statement) nodes in the document.
-
#initialize(headers:, body:) ⇒ Document
constructor
A new instance of Document.
-
#version ⇒ String?
OFX version declared in the file header.
Constructor Details
#initialize(headers:, body:) ⇒ Document
Returns a new instance of Document.
11 12 13 14 |
# File 'lib/ofx_kit/base/document.rb', line 11 def initialize(headers:, body:) @headers = headers @body = body end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
9 10 11 |
# File 'lib/ofx_kit/base/document.rb', line 9 def headers @headers end |
Instance Method Details
#bank_statement_nodes ⇒ Nokogiri::XML::NodeSet
Returns all STMTRS (bank statement) nodes in the document.
22 23 24 |
# File 'lib/ofx_kit/base/document.rb', line 22 def bank_statement_nodes @body.css('STMTRS') end |
#credit_card_statement_nodes ⇒ Nokogiri::XML::NodeSet
Returns all CCSTMTRS (credit card statement) nodes in the document.
27 28 29 |
# File 'lib/ofx_kit/base/document.rb', line 27 def credit_card_statement_nodes @body.css('CCSTMTRS') end |
#version ⇒ String?
Returns OFX version declared in the file header.
17 18 19 |
# File 'lib/ofx_kit/base/document.rb', line 17 def version @headers['VERSION'] end |