class Trizetto::Api::Eligibility::WebService::Node
Base class for parsed reponses in the eligibility response.
Public Class Methods
new(raw_hash = {})
click to toggle source
Calls superclass method
# File lib/trizetto/api/eligibility/web_service/node.rb, line 10 def initialize(raw_hash = {}) raw_hash ||= {} # handle <Node/> tags - the hash comes through, but its nil required_keys = self.class.constants.include?(:REQUIRED_KEYS) ? self.class::REQUIRED_KEYS : {} clean_hash = required_keys.merge(raw_hash) cleanup_keys = self.class.constants.include?(:KEY_CLEANUP) ? self.class::KEY_CLEANUP : {} cleanup_keys.each do |uglykey, friendly_key| clean_hash[friendly_key] = clean_hash.delete(uglykey) if clean_hash.has_key?(uglykey) end # Convert prefixed keys "benefit_related_entity_id" to simple keys "id" prefix_translations = self.class.constants.include?(:PREFIX_TRANSLATIONS) ? self.class::PREFIX_TRANSLATIONS : {} prefix_translations.each do |key_prefix| clean_hash.keys.each do |key| if key.to_s =~ /^#{key_prefix}_(.*)$/ clean_hash["#{$1}".to_sym] = clean_hash.delete(key) end end end super(clean_hash) after_inititlize(clean_hash) end
Protected Instance Methods
after_inititlize(hash)
click to toggle source
Callback after the prased eligibility response has been cleaned up
# File lib/trizetto/api/eligibility/web_service/node.rb, line 37 def after_inititlize(hash) end