Class: NgBankParser::Router
- Inherits:
-
Object
- Object
- NgBankParser::Router
- Defined in:
- lib/ng-bank-parser/router.rb
Class Method Summary collapse
-
.parse(bank_key, path, password = nil) ⇒ Object
this takes our bank parser along with the bank name supplied from the payload so as to compare and see if the file extension is available for that bank it’s result is to fill up the @supported_extension_array with the supported bank extensions.
Class Method Details
.parse(bank_key, path, password = nil) ⇒ Object
this takes our bank parser along with the bank name supplied from the payload so as to compare and see if the file extension is available for that bank it’s result is to fill up the @supported_extension_array with the supported bank extensions
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ng-bank-parser/router.rb', line 10 def self.parse(bank_key, path, password = nil) @path = path @password = password @selected_bank = @banks.find {|x| x[:key] == bank_key} if @selected_bank.nil? return {status: 0, message: "Your bank is not yet supported"} end unless file_exists(path) return {status: 0, message: "File does not exist or is not accesible"} end extensions = @selected_bank[:parsers].map {|e| e[:extensions]} @supported_extensions = extensions.reduce(:concat) pick_parser() end |