Major features finished
This commit is contained in:
@@ -6,14 +6,30 @@ module IdCard
|
||||
|
||||
validate :only_one_exception_field_present
|
||||
|
||||
FIELDS_TO_VALIDATE = [:field_value, :card_logo_file_id, :card_provider_id].freeze
|
||||
FIELDS_TO_VALIDATE = [:field_value, :network_logo_id, :provider_section_id].freeze
|
||||
|
||||
VALID_FIELD_NAMES = ['network_logo', 'provider_section', 'effective_date']
|
||||
VALID_FIELD_NAMES = ['network_logo', 'provider_section', 'medical_eff_date']
|
||||
|
||||
validates :field_name, inclusion: { in: VALID_FIELD_NAMES,
|
||||
message: "%{value} is not a valid Id Card Field Name" }
|
||||
|
||||
|
||||
def card_attrs
|
||||
case self.field_name
|
||||
when "network_logo"
|
||||
{"network_logo_filename" => IdCard::NetworkLogo.find(self.network_logo_id).filename}
|
||||
when "provider_section"
|
||||
IdCard::ProviderSection.find(self.provider_section_id).attributes.with_indifferent_access.slice(
|
||||
:provider_line_1, :provider_line_2, :provider_line_3, :provider_line_4, :provider_line_5, :provider_line_6,
|
||||
:provider_line_7, :provider_line_8, :provider_line_9, :provider_line_10, :provider_line_11, :provider_line_12,
|
||||
:claim_to_1, :claim_to_2, :claim_to_3, :claim_to_4, :claim_to_5, :claim_to_6,
|
||||
:claim_to_7, :claim_to_8, :claim_to_9, :claim_to_10, :claim_to_11, :claim_to_12
|
||||
)
|
||||
when "medical_eff_date"
|
||||
{"medical_eff_date" => self.field_value}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def only_one_exception_field_present
|
||||
|
||||
Reference in New Issue
Block a user