Class: Bambora::BatchUpload::MakeArray

Inherits:
Object
  • Object
show all
Defined in:
lib/bambora/batch_upload.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(txn_type) ⇒ MakeArray



58
59
60
61
# File 'lib/bambora/batch_upload.rb', line 58

def initialize(txn_type)
  @txn_type = txn_type
  @array    = []
end

Instance Attribute Details

#arrayObject

Returns the value of attribute array.



57
58
59
# File 'lib/bambora/batch_upload.rb', line 57

def array
  @array
end

#txn_typeObject

Returns the value of attribute txn_type.



57
58
59
# File 'lib/bambora/batch_upload.rb', line 57

def txn_type
  @txn_type
end

Instance Method Details

#push_into_file(params) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/bambora/batch_upload.rb', line 62

def push_into_file(params)
  validate_args params
  array << OpenStruct.new(txn_type:               @txn_type,
                          payment_type:           params[:payment_type].to_s,
                          institution_number:     params[:institution_number].to_s,
                          transit_number:         params[:transit_number], 
                          transit_routing_number: params[:transit_routing_number].to_s,
                          account_number:         params[:account_number].to_s,
                          account_code:           params[:account_code].to_s,
                          amount:                 params[:amount],
                          ref:                    (params[:reference] || 0 ).to_s,
                          recipient:              params[:recipient].to_s,
                          customer_code:          params[:customer_code].to_s,
                          descriptor:             params[:dynamic_descriptor].to_s,
                          standard_entry_code:    params[:standard_entry_code].to_s,
                          entry_detail_addenda:   params[:entry_detail_addenda_record].to_s
                         )
end