How AT&T Parser works - SimplexMobility/public_wiki GitHub Wiki
-
The BillParser module contains the main functionality for parsing bills, and it serves as the top-level namespace for the parser.
-
Within the BillParser module, there is a nested module called Parsers, which contains parsers for different carriers, including AT&T.
-
The Base class is a base class for AT&T parsers. It is inherited from the BillParser::Parsers::Base class, indicating that it shares common functionality with other parsers.
-
The Base class implements several class methods and instance methods to handle parsing and processing AT&T bills.
-
There are various class methods defined within the Base class, such as file_priority, reporting_file_priority, parser_options, and carrier_name, which provide configuration and information related to parsing AT&T bills.
-
The _parse method is responsible for parsing the bill file and returning an instance of the Models::BillData class that encapsulates the parsed data.
-
The _parseable? method checks if a given input file can be parsed by this AT&T parser based on a file identifier.
-
The read_account method is responsible for extracting account information from a row of data in the bill file.
Parse a pdf
- Parsing a single file
To parse a single file we have a class
BillParser::ProcessIO
process = BillParser::ProcessIO.new(<path_to_pdf_file>, options)
# There are there possible outcomes defined for above parsing process
# succeeded failed unparseable_file
# check parsing status
process.outcome?(:succeeded)
# output
process.output
Available options
start_page: n
last_page: n
parser: 'Att::Pdf'
ATT parser has two versions
- V1
- V2
Each version provides us multiple methods to extract data from bill