Sha256: 4c5829c99941e6ebf2773a64bc9a8124e6f8bde796a6299d05b01abe569437f9

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

module Trizetto
  module Api
    module Eligibility
      module WebService

        # The subscriber is who holds the insurance.  They may be the patient, or
        # they may have dependents who are the patients.
        class Subscriber < Patient
          prepend Rejectable

          def initialize(raw_hash = {})
            # If we are in subscriber / depdent relationship, we get back subscribername
            # instead of patientname (as the subscriber is _not_ the patient).  For
            # convience, we'll transform the subscriber name into a name

            clean_hash = raw_hash.dup
            if clean_hash.has_key?(:subscribername) && !clean_hash.has_key?(:patientname) && clean_hash[:subscribername].is_a?(Hash)
              clean_hash[:patientname] = clean_hash.delete(:subscribername)
              clean_hash[:patientname].keys.each do |key|
                if key.to_s =~ /^subscriber(.*)$/
                  clean_hash[:patientname]["patient#{$1}".to_sym] = clean_hash[:patientname].delete(key)
                end
              end
            end
            super(clean_hash)
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trizetto-api-0.2.2 lib/trizetto/api/eligibility/web_service/subscriber.rb