Class: MedicalCopaysPolicy

Inherits:
Struct
  • Object
show all
Defined in:
app/policies/medical_copays_policy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#medical_copaysObject

Returns the value of attribute medical_copays

Returns:

  • (Object)

    the current value of medical_copays



3
4
5
# File 'app/policies/medical_copays_policy.rb', line 3

def medical_copays
  @medical_copays
end

#userObject

Returns the value of attribute user

Returns:

  • (Object)

    the current value of user



3
4
5
# File 'app/policies/medical_copays_policy.rb', line 3

def user
  @user
end

Instance Method Details

#access?Boolean

Determines if the authenticated user has access to the Medical Copays feature

Returns:

  • (Boolean)


10
11
12
13
14
15
# File 'app/policies/medical_copays_policy.rb', line 10

def access?
  accessible = user.edipi.present? && user.icn.present?
  StatsD.increment("api.mcp.policy.#{accessible ? 'success' : 'failure'}")

  accessible
end

#access_notifications?Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
23
24
25
26
# File 'app/policies/medical_copays_policy.rb', line 17

def access_notifications?
  accessible = Flipper.enabled?('medical_copay_notifications')
  if accessible
    StatsD.increment('api.mcp.notification_policy.success')
  else
    StatsD.increment('api.mcp.notification_policy.failure')
  end

  accessible
end