class Sunnyside::ClaimEntry

Attributes

billed[R]
claim_number[R]
invoice[R]
paid[R]
response_code[R]
units[R]

Public Class Methods

new(header = {}) click to toggle source
# File lib/sunnyside/ledger/edi.rb, line 84
def initialize(header = {})
  @invoice       = header[:invoice].gsub(/[OLD]/, 'O' => '0', 'D' => '8', 'L' => '1').gsub(/^0/, '')[0..5].to_i # for the corrupt SHP EDI files
  @response_code = header[:response_code]
  @billed        = header[:billed]
  @paid          = header[:paid]
  @units         = header[:units]
  @claim_number  = header[:claim_number]
end

Public Instance Methods

inv() click to toggle source
# File lib/sunnyside/ledger/edi.rb, line 108
def inv
  Invoice[invoice]
end
to_db(payment) click to toggle source
# File lib/sunnyside/ledger/edi.rb, line 93
def to_db(payment)
  payment.update(provider_id: inv.provider_id) if payment.provider_id.nil?
  Claim.insert(
    :invoice_id     => invoice, 
    :payment_id     => payment.id, 
    :client_id      => inv.client_id, 
    :control_number => claim_number, 
    :paid           => paid, 
    :billed         => billed, 
    :status         => response_code, 
    :provider_id    => inv.provider_id,
    :recipient_id   => inv.recipient_id
  )
end