Class: OFX::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/ofx/document.rb,
lib/ofx/1.0.2/document.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDocument

Returns a new instance of Document.



24
25
26
27
# File 'lib/ofx/document.rb', line 24

def initialize
    @header = OFX::Header.new
    @message_sets = []
end

Instance Attribute Details

#headerObject

Returns the value of attribute header.



21
22
23
# File 'lib/ofx/document.rb', line 21

def header
  @header
end

#message_setsObject (readonly)

Returns the value of attribute message_sets.



22
23
24
# File 'lib/ofx/document.rb', line 22

def message_sets
  @message_sets
end

Class Method Details

.from_ofx_102_hash(document_hash) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/ofx/1.0.2/document.rb', line 20

def self.from_ofx_102_hash(document_hash)
    contents = document_hash['OFX']
    raise 'The top of the document was not an <OFX> tag.' unless contents
    
    document = OFX::Document.new
    
    contents.each_pair() do |message_set, message_set_hash|
        document.message_sets << OFX::MessageSet.from_ofx_102_message_set_hash(message_set, message_set_hash)
    end
    document.message_sets.sort! { |left, right| left.precedence <=> right.precedence }
    
    return document
end