Class: Ebics::File::Download

Inherits:
Client
  • Object
show all
Defined in:
lib/ebics/file/download.rb

Constant Summary

Constants inherited from Client

Client::BANK_NAME, Client::URL_EBICS_SERVER

Instance Attribute Summary

Attributes inherited from Client

#banks, #conf, #partners, #users

Instance Method Summary collapse

Methods inherited from Client

#create_bank, #create_partner, #create_user_directories, #initialize, #load_user, #log, #messages, #require_product, #require_user, #require_user_and_product, #t

Constructor Details

This class inherits a constructor from Ebics::Client

Instance Method Details

#fetch_file(path, user, product, test, date_start, date_end) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ebics/file/download.rb', line 5

def fetch_file(path, user, product, test, date_start, date_end)
  session = Java::OrgKopiEbicsSession.EbicsSession.new(user, conf)

  session.add_session_param 'FORMAT', 'pain.xxx.cfonb160.dct'
  session.add_session_param 'TEST', 'true' if test
  session.product = product

  conf.trace_manager.trace_directory = conf.get_transfer_trace_directory(user)

  transfer_manager = Java::OrgKopiEbicsClient.FileTransfer.new(session)
  transfer_manager.fetch_file(
    Java::OrgKopiEbicsSession.OrderType::FDL,
    date_start,
    date_end,
    Java::JavaIo.FileOutputStream.new(path)
  )
end

#run(path, options) ⇒ Object



23
24
25
26
# File 'lib/ebics/file/download.rb', line 23

def run(path, options)
  require_user_and_product(options)
  fetch_file(path, @user, @product, options[:test], options[:start], options[:end])
end