Class: BuckarooClient::Gateway::Batch

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/buckaroo_client/gateway/batch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Batch

Returns a new instance of Batch.



12
13
14
# File 'lib/buckaroo_client/gateway/batch.rb', line 12

def initialize(args = {})
  @transactions = args.fetch(:transactions, [])
end

Instance Attribute Details

#transactionsObject (readonly)

Returns the value of attribute transactions.



7
8
9
# File 'lib/buckaroo_client/gateway/batch.rb', line 7

def transactions
  @transactions
end

Instance Method Details

#to_csvObject



16
17
18
19
20
# File 'lib/buckaroo_client/gateway/batch.rb', line 16

def to_csv
  table = CSV::Table.new([])
  transactions.each { |t| table << transaction_to_csv(t) }
  table.to_csv(col_sep: ';')
end