Class: Sunnyside::ClaimParser
- Defined in:
- lib/sunnyside/ledger/edi.rb
Instance Attribute Summary collapse
-
#claim_header ⇒ Object
readonly
Returns the value of attribute claim_header.
-
#payment_id ⇒ Object
readonly
Returns the value of attribute payment_id.
-
#service_data ⇒ Object
readonly
Returns the value of attribute service_data.
Attributes inherited from EdiReader
Instance Method Summary collapse
- #header ⇒ Object
-
#initialize(claim, payment_id) ⇒ ClaimParser
constructor
A new instance of ClaimParser.
- #parse ⇒ Object
Methods inherited from EdiReader
#check_number, #check_total, #claims, #parse_claims
Constructor Details
#initialize(claim, payment_id) ⇒ ClaimParser
Returns a new instance of ClaimParser.
57 58 59 60 61 |
# File 'lib/sunnyside/ledger/edi.rb', line 57 def initialize(claim, payment_id) @claim_header = claim[0].split(/\*/) @service_data = claim.select { |clm| clm =~ /^SVC/ } @payment_id = Payment[payment_id] end |
Instance Attribute Details
#claim_header ⇒ Object (readonly)
Returns the value of attribute claim_header.
55 56 57 |
# File 'lib/sunnyside/ledger/edi.rb', line 55 def claim_header @claim_header end |
#payment_id ⇒ Object (readonly)
Returns the value of attribute payment_id.
55 56 57 |
# File 'lib/sunnyside/ledger/edi.rb', line 55 def payment_id @payment_id end |
#service_data ⇒ Object (readonly)
Returns the value of attribute service_data.
55 56 57 |
# File 'lib/sunnyside/ledger/edi.rb', line 55 def service_data @service_data end |
Instance Method Details
#header ⇒ Object
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/sunnyside/ledger/edi.rb', line 63 def header { :invoice => claim_header[0], :response_code => claim_header[1], :billed => claim_header[2], :paid => claim_header[3], :units => claim_header[5], # 4 is not used - that is the patient responsibility amount :claim_number => claim_header[6][/^\d+/] } end |
#parse ⇒ Object
74 75 76 77 78 |
# File 'lib/sunnyside/ledger/edi.rb', line 74 def parse claim = ClaimEntry.new(header) claim_id = claim.to_db(payment_id) service_data.each { |service| ServiceParser.new(service, claim_id).parse } end |