Class: LeccaClient::CNAB::Loan::LoanFile
- Inherits:
-
Object
- Object
- LeccaClient::CNAB::Loan::LoanFile
- Defined in:
- lib/lecca_client/cnab/loan/loan_file.rb
Constant Summary collapse
- FILE_PREFIX =
'LEC_DEPARA'
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#filepath ⇒ Object
readonly
Returns the value of attribute filepath.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(filename:, filepath:, content:) ⇒ LoanFile
constructor
A new instance of LoanFile.
- #parse ⇒ Object
- #purge ⇒ Object
Constructor Details
#initialize(filename:, filepath:, content:) ⇒ LoanFile
8 9 10 11 12 |
# File 'lib/lecca_client/cnab/loan/loan_file.rb', line 8 def initialize(filename:, filepath:, content:) @filename = filename @filepath = filepath @content = content end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
6 7 8 |
# File 'lib/lecca_client/cnab/loan/loan_file.rb', line 6 def content @content end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
6 7 8 |
# File 'lib/lecca_client/cnab/loan/loan_file.rb', line 6 def filename @filename end |
#filepath ⇒ Object (readonly)
Returns the value of attribute filepath.
6 7 8 |
# File 'lib/lecca_client/cnab/loan/loan_file.rb', line 6 def filepath @filepath end |
Class Method Details
.available_files ⇒ Object
26 27 28 29 |
# File 'lib/lecca_client/cnab/loan/loan_file.rb', line 26 def self.available_files files = LeccaClient::Downloader.new.download_files(FILE_PREFIX) files.map { |file| new(file) } end |
.retrieve_file(filename) ⇒ Object
22 23 24 |
# File 'lib/lecca_client/cnab/loan/loan_file.rb', line 22 def self.retrieve_file(filename) new(LeccaClient::Downloader.new.download_file(filename)) end |
Instance Method Details
#parse ⇒ Object
14 15 16 |
# File 'lib/lecca_client/cnab/loan/loan_file.rb', line 14 def parse @parsed ||= Parser.new(content).parse end |
#purge ⇒ Object
18 19 20 |
# File 'lib/lecca_client/cnab/loan/loan_file.rb', line 18 def purge LeccaClient::FileHandler.new.remove(filepath) end |