Class: ApiProviderFactory
- Inherits:
-
Object
- Object
- ApiProviderFactory
- Extended by:
- Logging::ThirdPartyTransaction::MethodWrapper
- Defined in:
- lib/disability_compensation/factories/api_provider_factory.rb
Defined Under Namespace
Classes: UndefinedFactoryTypeError
Constant Summary collapse
- API_PROVIDER =
{ evss: :evss, lighthouse: :lighthouse }.freeze
- FACTORIES =
{ rated_disabilities: :rated_disabilities, intent_to_file: :intent_to_file, ppiu: :ppiu, claims: :claims }.freeze
- FEATURE_TOGGLE_RATED_DISABILITIES_FOREGROUND =
Splitting the rated disabilities functionality into two use cases:
-
foreground tasks (i.e. web requests)
-
the background jobs (i.e. submit526 job)
-
'disability_compensation_lighthouse_rated_disabilities_provider_foreground'
- FEATURE_TOGGLE_RATED_DISABILITIES_BACKGROUND =
'disability_compensation_lighthouse_rated_disabilities_provider_background'
- FEATURE_TOGGLE_INTENT_TO_FILE =
'disability_compensation_lighthouse_intent_to_file_provider'
- FEATURE_TOGGLE_CLAIMS_SERVICE =
'disability_compensation_lighthouse_claims_service_provider'
- FEATURE_TOGGLE_PPIU_DIRECT_DEPOSIT =
PPIU calls out to Direct Deposit APIs in Lighthouse
'disability_compensation_lighthouse_ppiu_direct_deposit_provider'
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(type:, current_user:, feature_toggle:, provider: nil, options: {}) ⇒ ApiProviderFactory
constructor
A new instance of ApiProviderFactory.
Methods included from Logging::ThirdPartyTransaction::MethodWrapper
Constructor Details
#initialize(type:, current_user:, feature_toggle:, provider: nil, options: {}) ⇒ ApiProviderFactory
Returns a new instance of ApiProviderFactory.
66 67 68 69 70 71 72 73 74 |
# File 'lib/disability_compensation/factories/api_provider_factory.rb', line 66 def initialize(type:, current_user:, feature_toggle:, provider: nil, options: {}) @type = type @api_provider = provider @options = # current user is necessary for the Flipper toggle to check against @current_user = current_user # for now, rated disabilities is the only special case that needs the feature toggle name sent in @feature_toggle = feature_toggle end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
46 47 48 |
# File 'lib/disability_compensation/factories/api_provider_factory.rb', line 46 def type @type end |
Class Method Details
.call ⇒ Object
62 63 64 |
# File 'lib/disability_compensation/factories/api_provider_factory.rb', line 62 def self.call(**) new(**).call end |
Instance Method Details
#call ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/disability_compensation/factories/api_provider_factory.rb', line 76 def call case @type when FACTORIES[:rated_disabilities] rated_disabilities_service_provider when FACTORIES[:intent_to_file] intent_to_file_service_provider when FACTORIES[:ppiu] ppiu_service_provider when FACTORIES[:claims] claims_service_provider else raise UndefinedFactoryTypeError end end |