Class: Formulary::QHPPlanDrug

Inherits:
Object
  • Object
show all
Defined in:
lib/formulary/qhp_plan_drug.rb

Overview

A drug with plan-specific details (tier, prior auth, limits)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(drug, plan) ⇒ QHPPlanDrug

Returns a new instance of QHPPlanDrug.



8
9
10
11
# File 'lib/formulary/qhp_plan_drug.rb', line 8

def initialize(drug, plan)
  @drug = drug
  @plan = plan
end

Instance Attribute Details

#drugObject (readonly)

Returns the value of attribute drug.



6
7
8
# File 'lib/formulary/qhp_plan_drug.rb', line 6

def drug
  @drug
end

#planObject (readonly)

Returns the value of attribute plan.



6
7
8
# File 'lib/formulary/qhp_plan_drug.rb', line 6

def plan
  @plan
end

Instance Method Details

#drug_plan_infoObject (private)



53
54
55
# File 'lib/formulary/qhp_plan_drug.rb', line 53

def drug_plan_info
  @drug_plan_info ||= drug.plans.find { |drug_plan| drug_plan[:plan_id] == plan.id }
end

#nameObject



17
18
19
# File 'lib/formulary/qhp_plan_drug.rb', line 17

def name
  drug.name
end

#plan_idObject



47
48
49
# File 'lib/formulary/qhp_plan_drug.rb', line 47

def plan_id
  plan.id
end

#prior_auth?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/formulary/qhp_plan_drug.rb', line 35

def prior_auth?
  drug_plan_info[:prior_authorization]
end

#quantity_limit?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/formulary/qhp_plan_drug.rb', line 43

def quantity_limit?
  drug_plan_info[:quantity_limit]
end

#rxnorm_codeObject



13
14
15
# File 'lib/formulary/qhp_plan_drug.rb', line 13

def rxnorm_code
  drug.rxnorm_code
end

#step_therapy_limit?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/formulary/qhp_plan_drug.rb', line 39

def step_therapy_limit?
  drug_plan_info[:step_therapy]
end

#tierObject



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/formulary/qhp_plan_drug.rb', line 21

def tier

if drug_plan_info[:drug_tier] == "ZERO-COST-SHARE-PREVENTIVE"
  drug_plan_info[:drug_tier] = "ZERO-COST-SHARE-PREVENTATIVE"
elsif drug_plan_info[:drug_tier] == "MEDICAL-BENEFIT"
  drug_plan_info[:drug_tier] = "MEDICAL-SERVICE"
elsif drug_plan_info[:drug_tier] == "NON-PREFERRED-BRAND-SPECIALTY"
  drug_plan_info[:drug_tier] = "SPECIALTY"
end

  drug_plan_info[:drug_tier].downcase
 
end