Class: CFONB::Operation
- Inherits:
-
Object
- Object
- CFONB::Operation
- Defined in:
- lib/cfonb/operation.rb
Constant Summary collapse
- BASE_ATTRIBUTES =
%i[ raw amount currency date exoneration_code interbank_code internal_code label number reference rejection_code unavailability_code value_date details ].freeze
Instance Method Summary collapse
-
#initialize(line) ⇒ Operation
constructor
A new instance of Operation.
- #merge_detail(line) ⇒ Object
- #type_code ⇒ Object
Constructor Details
#initialize(line) ⇒ Operation
Returns a new instance of Operation.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/cfonb/operation.rb', line 26 def initialize(line) self.raw = line.body self.internal_code = line.internal_operation_code self.interbank_code = line.interbank_operation_code self.rejection_code = line.rejection_code self.exoneration_code = line.exoneration_code self.unavailability_code = line.unavailability_code self.currency = line.currency self.amount = line.amount self.date = line.date self.value_date = line.value_date self.label = line.label.strip self.number = line.number self.reference = line.reference self.details = Details.new end |
Instance Method Details
#merge_detail(line) ⇒ Object
43 44 45 46 47 |
# File 'lib/cfonb/operation.rb', line 43 def merge_detail(line) self.raw += "\n#{line.body}" OperationDetails.for(line)&.apply(details, line) end |
#type_code ⇒ Object
49 50 51 |
# File 'lib/cfonb/operation.rb', line 49 def type_code "#{interbank_code}#{direction}" end |