Class: Cmxl::Fields::VmkSummary

Inherits:
Cmxl::Field show all
Defined in:
lib/cmxl/fields/vmk_summary.rb

Constant Summary

Constants inherited from Cmxl::Field

Cmxl::Field::DATE

Instance Attribute Summary

Attributes inherited from Cmxl::Field

#data, #match, #modifier, #source, #tag

Instance Method Summary collapse

Methods inherited from Cmxl::Field

#add_meta_data, #initialize, #method_missing, parse, parsers, #to_amount, #to_amount_in_cents, #to_date, #to_hash, #to_json

Constructor Details

This class inherits a constructor from Cmxl::Field

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Cmxl::Field

Instance Method Details

#amountObject



19
20
21
# File 'lib/cmxl/fields/vmk_summary.rb', line 19

def amount
  to_amount(data['amount'])
end

#credit?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/cmxl/fields/vmk_summary.rb', line 7

def credit?
  modifier == 'C'
end

#debit?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/cmxl/fields/vmk_summary.rb', line 11

def debit?
  modifier == 'D'
end

#entriesObject



15
16
17
# File 'lib/cmxl/fields/vmk_summary.rb', line 15

def entries
  data['entries'].to_i
end

#to_hObject



23
24
25
26
27
28
29
30
# File 'lib/cmxl/fields/vmk_summary.rb', line 23

def to_h
  {
    type: debit? ? 'debit' : 'credit',
    entries: entries,
    amount: amount,
    currency: currency
  }
end