Class: Bankserv::Transmission::UserSet::Document
- Inherits:
-
Set
- Object
- ActiveRecord::Base
- Set
- Bankserv::Transmission::UserSet::Document
show all
- Defined in:
- lib/bankserv/transmission/set/document.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Set
#base_set, #contained_sets, from_hash, #get_document, #header, #number_of_records, #parent, partial_class_name, #process, #rec_status, #record_with_sequence_number, #set_type, #to_hash, #trailer, #transactions
Class Method Details
.generate(options) ⇒ Object
9
10
11
12
13
14
|
# File 'lib/bankserv/transmission/set/document.rb', line 9
def self.generate(options)
set = self.new
set.(options)
set.build_trailer(no_of_recs: options[:no_of_recs])
set
end
|
Instance Method Details
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/bankserv/transmission/set/document.rb', line 16
def (options = {})
defaults = {
client_code: options[:client_code],
client_name: options[:client_name],
date: Date.today.strftime("%Y%m%d"),
destination: "0"
}
records.build(record_type: "header", data: defaults.merge(options))
end
|
#build_trailer(options = {}) ⇒ Object
27
28
29
30
|
# File 'lib/bankserv/transmission/set/document.rb', line 27
def build_trailer(options = {})
options[:no_of_recs] = options[:no_of_recs].to_s
records.build(record_type: "trailer", data: options)
end
|
#decorate_records ⇒ Object
32
33
34
35
|
# File 'lib/bankserv/transmission/set/document.rb', line 32
def decorate_records
super
set_trailer_number_of_records
end
|
#set_trailer_number_of_records ⇒ Object
37
38
39
|
# File 'lib/bankserv/transmission/set/document.rb', line 37
def set_trailer_number_of_records
trailer.data.merge!(no_of_recs: number_of_records.to_s)
end
|