Sha256: 80fdbe8b832506273f232a974efdc9efe98d733860f76d6404df5ea508f6ebbf

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 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
          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

            clean_hash[:id] = clean_hash.delete(:subscriberid) if clean_hash.has_key?(:subscriberid)
            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.4 lib/trizetto/api/eligibility/web_service/subscriber.rb