Class: Trizetto::Api::Eligibility::WebService::Subscriber

Inherits:
Patient
  • Object
show all
Includes:
Rejectable
Defined in:
lib/trizetto/api/eligibility/web_service/subscriber.rb

Overview

The subscriber is who holds the insurance. They may be the patient, or they may have dependents who are the patients.

Constant Summary

Constants inherited from Patient

Patient::KEY_CLEANUP

Instance Attribute Summary

Attributes inherited from Patient

#benefits, #name

Instance Method Summary collapse

Methods included from Rejectable

#after_inititlize

Constructor Details

#initialize(raw_hash = {}) ⇒ Subscriber

Returns a new instance of Subscriber.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/trizetto/api/eligibility/web_service/subscriber.rb', line 11

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