Class: Sunnyside::ParseInvoice
- Inherits:
-
Object
- Object
- Sunnyside::ParseInvoice
- Defined in:
- lib/sunnyside/ledger/auth_report.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#client_line ⇒ Object
readonly
Returns the value of attribute client_line.
-
#visits ⇒ Object
readonly
Returns the value of attribute visits.
Instance Method Summary collapse
- #client_data ⇒ Object
-
#initialize(entry) ⇒ ParseInvoice
constructor
A new instance of ParseInvoice.
- #invoice_lines ⇒ Object
-
#process ⇒ Object
removes the client name from the line.
Constructor Details
#initialize(entry) ⇒ ParseInvoice
Returns a new instance of ParseInvoice.
20 21 22 23 |
# File 'lib/sunnyside/ledger/auth_report.rb', line 20 def initialize(entry) @client_line = entry.split(/\n/).select { |line| line =~ /\s+001\s+/ }.join @visits = entry.split(/\n/).select { |line| line =~ /^\d{6}/ } end |
Instance Attribute Details
#client_line ⇒ Object (readonly)
Returns the value of attribute client_line.
18 19 20 |
# File 'lib/sunnyside/ledger/auth_report.rb', line 18 def client_line @client_line end |
#visits ⇒ Object (readonly)
Returns the value of attribute visits.
18 19 20 |
# File 'lib/sunnyside/ledger/auth_report.rb', line 18 def visits @visits end |
Instance Method Details
#client_data ⇒ Object
25 26 27 |
# File 'lib/sunnyside/ledger/auth_report.rb', line 25 def client_data client_line.slice(9..28) + client_line.slice(54..120) end |
#invoice_lines ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/sunnyside/ledger/auth_report.rb', line 29 def invoice_lines visits.map { |inv| InvoiceDetail.new( client_data, { :invoice => inv[0..5], :svc_code => inv[18..22], :modifier => inv[25..30], :dos => inv[57..66], :units => inv[69..75], :amount => inv[79..88] } ) } end |
#process ⇒ Object
removes the client name from the line
45 46 47 |
# File 'lib/sunnyside/ledger/auth_report.rb', line 45 def process invoice_lines.each { |inv| inv.to_db } end |