Class: SepaFileParser::Camt054::Notification
- Inherits:
-
Object
- Object
- SepaFileParser::Camt054::Notification
- Defined in:
- lib/sepa_file_parser/camt054/notification.rb
Instance Attribute Summary collapse
-
#xml_data ⇒ Object
readonly
Returns the value of attribute xml_data.
Class Method Summary collapse
Instance Method Summary collapse
- #account ⇒ Account
- #entries ⇒ Array<Entry>
- #from_date_time ⇒ Time?
- #generation_date ⇒ Time
- #identification ⇒ String
-
#initialize(xml_data) ⇒ Notification
constructor
A new instance of Notification.
- #source ⇒ String
- #to_date_time ⇒ Time?
Constructor Details
#initialize(xml_data) ⇒ Notification
Returns a new instance of Notification.
9 10 11 |
# File 'lib/sepa_file_parser/camt054/notification.rb', line 9 def initialize(xml_data) @xml_data = xml_data end |
Instance Attribute Details
#xml_data ⇒ Object (readonly)
Returns the value of attribute xml_data.
7 8 9 |
# File 'lib/sepa_file_parser/camt054/notification.rb', line 7 def xml_data @xml_data end |
Class Method Details
.parse(xml) ⇒ SepaFileParser::Camt054::Notification
49 50 51 |
# File 'lib/sepa_file_parser/camt054/notification.rb', line 49 def self.parse(xml) self.new Nokogiri::XML(xml).xpath('Ntfctn') end |
Instance Method Details
#account ⇒ Account
34 35 36 |
# File 'lib/sepa_file_parser/camt054/notification.rb', line 34 def account @account ||= SepaFileParser::Account.from_camt_data(xml_data.xpath('Acct').first) end |
#entries ⇒ Array<Entry>
39 40 41 |
# File 'lib/sepa_file_parser/camt054/notification.rb', line 39 def entries @entries ||= xml_data.xpath('Ntry').map{ |x| Entry.new(x) } end |
#from_date_time ⇒ Time?
24 25 26 |
# File 'lib/sepa_file_parser/camt054/notification.rb', line 24 def from_date_time @from_date_time ||= (x = xml_data.xpath('FrToDt/FrDtTm')).empty? ? nil : Time.parse(x.first.content) end |
#generation_date ⇒ Time
19 20 21 |
# File 'lib/sepa_file_parser/camt054/notification.rb', line 19 def generation_date @generation_date ||= Time.parse(xml_data.xpath('CreDtTm/text()').text) end |
#identification ⇒ String
14 15 16 |
# File 'lib/sepa_file_parser/camt054/notification.rb', line 14 def identification @identification ||= xml_data.xpath('Id/text()').text end |
#source ⇒ String
44 45 46 |
# File 'lib/sepa_file_parser/camt054/notification.rb', line 44 def source xml_data.to_s end |
#to_date_time ⇒ Time?
29 30 31 |
# File 'lib/sepa_file_parser/camt054/notification.rb', line 29 def to_date_time @to_date_time ||= (x = xml_data.xpath('FrToDt/ToDtTm')).empty? ? nil : Time.parse(x.first.content) end |