Class: Formulary::QHPDrugTier

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

Overview

An individual drug tier as represented by QHP data

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tier) ⇒ QHPDrugTier

Returns a new instance of QHPDrugTier.

[View source]

9
10
11
12
13
14
15
16
17
18
# File 'lib/formulary/qhp_drug_tier.rb', line 9

def initialize(tier)
  @tier = tier
  if tier[:drug_tier] == "ZERO-COST-SHARE-PREVENTIVE"
    tier[:drug_tier] = "ZERO-COST-SHARE-PREVENTATIVE"
  elsif tier[:drug_tier] == "MEDICAL-BENEFIT"
      tier[:drug_tier] = "MEDICAL-SERVICE"
  elsif tier[:drug_tier] == "NON-PREFERRED-BRAND-SPECIALTY"
      tier[:drug_tier] = "SPECIALTY"
  end
end

Instance Attribute Details

#tierObject (readonly)

Returns the value of attribute tier.


7
8
9
# File 'lib/formulary/qhp_drug_tier.rb', line 7

def tier
  @tier
end

Instance Method Details

#cost_sharingObject

[View source]

28
29
30
# File 'lib/formulary/qhp_drug_tier.rb', line 28

def cost_sharing
  @cost_sharing ||= tier[:cost_sharing].map { |cost| QHPDrugTierCostSharing.new(cost) }
end

#mail_order?Boolean

Returns:

  • (Boolean)
[View source]

24
25
26
# File 'lib/formulary/qhp_drug_tier.rb', line 24

def mail_order?
  tier[:mail_order]
end

#nameObject

[View source]

20
21
22
# File 'lib/formulary/qhp_drug_tier.rb', line 20

def name
  @name ||= tier[:drug_tier].downcase
end