Class: CamtParser::Charges

Inherits:
Object
  • Object
show all
Defined in:
lib/camt_parser/general/charges.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml_data) ⇒ Charges

Returns a new instance of Charges.



6
7
8
9
# File 'lib/camt_parser/general/charges.rb', line 6

def initialize(xml_data)
  @xml_data = xml_data
  @total_charges_and_tax_amount = xml_data.xpath('TtlChrgsAndTaxAmt/text()').text
end

Instance Attribute Details

#xml_dataObject (readonly)

Returns the value of attribute xml_data.



4
5
6
# File 'lib/camt_parser/general/charges.rb', line 4

def xml_data
  @xml_data
end

Instance Method Details

#recordsObject



19
20
21
# File 'lib/camt_parser/general/charges.rb', line 19

def records
  @records ||= xml_data.xpath('Rcrd').map{ |x| CamtParser::Record.new(x) }
end

#total_charges_and_tax_amountObject



11
12
13
# File 'lib/camt_parser/general/charges.rb', line 11

def total_charges_and_tax_amount
  CamtParser::Misc.to_amount(@total_charges_and_tax_amount)
end

#total_charges_and_tax_amount_in_centsObject



15
16
17
# File 'lib/camt_parser/general/charges.rb', line 15

def total_charges_and_tax_amount_in_cents
  CamtParser::Misc.to_amount_in_cents(@total_charges_and_tax_amount)
end