Skip to content

Commit

Permalink
Adds bean name to several services. Adds health checks for new services.
Browse files Browse the repository at this point in the history
stiehlrod committed Dec 18, 2024
1 parent e459d58 commit 58d3360
Showing 9 changed files with 97 additions and 16 deletions.
80 changes: 64 additions & 16 deletions modules/claims_api/config/initializers/okcomputer.rb
Original file line number Diff line number Diff line change
@@ -123,6 +123,32 @@ def name
end
end

class BGSServiceCheck < BaseCheck
def initialize(bean, service)
@bean = bean
@service = service
@endpoint = "#{bean}/#{service}"
end

def check
service = eval("ClaimsApi::#{@service} = Class.new")

Check failure on line 134 in modules/claims_api/config/initializers/okcomputer.rb

GitHub Actions / Linting and Security

Security/Eval: The use of `eval` is a serious security risk.

Check failure on line 134 in modules/claims_api/config/initializers/okcomputer.rb

GitHub Actions / Linting and Security

Style/DocumentDynamicEvalDefinition: Add a comment block showing its appearance if interpolated.

Check failure on line 134 in modules/claims_api/config/initializers/okcomputer.rb

GitHub Actions / Linting and Security

Style/EvalWithLocation: Pass a binding, `__FILE__`, and `__LINE__` to `eval`.
faraday_service = service.new(
external_uid: 'healthcheck_uid',
external_key: 'healthcheck_key'
)
status = faraday_service.send('healthcheck', @endpoint)
status == 200 ? process_success : process_failure
rescue
process_failure
end

protected

def name
"Faraday BGS #{@endpoint}"
end
end

def faraday_client
Faraday.new( # Disable SSL for (localhost) testing
ssl: { verify: !Rails.env.development? }
@@ -136,24 +162,46 @@ def faraday_client
end

OkComputer::Registry.register 'mpi', MpiCheck.new
OkComputer::Registry.register 'localbgs-claimant',
FaradayBGSCheck.new('ClaimantServiceBean/ClaimantWebService')
OkComputer::Registry.register 'localbgs-corporate_update',
FaradayBGSCheck.new('CorporateUpdateServiceBean/CorporateUpdateWebService')
OkComputer::Registry.register 'localbgs-person',
FaradayBGSCheck.new('PersonWebServiceBean/PersonWebService')
OkComputer::Registry.register 'localbgs-org',
FaradayBGSCheck.new('OrgWebServiceBean/OrgWebService')
# rubocop:disable Layout/LineLength
OkComputer::Registry.register 'localbgs-ebenefitsbenftclaim',
FaradayBGSCheck.new('EBenefitsBnftClaimStatusWebServiceBean/EBenefitsBnftClaimStatusWebService')
# rubocop:enable Layout/LineLength
OkComputer::Registry.register 'localbgs-intenttofile',
FaradayBGSCheck.new('IntentToFileWebServiceBean/IntentToFileWebService')
OkComputer::Registry.register 'localbgs-trackeditem',
FaradayBGSCheck.new('TrackedItemService/TrackedItemService')
OkComputer::Registry.register 'benefits-documents',
BeneftsDocumentsCheck.new('services/benefits-documents/v1/healthcheck')
OkComputer::Registry.register 'form-526-docker-container',
Form526DockerContainerCheck.new('wss-form526-services-web/tools/version.jsp')
OkComputer::Registry.register 'pdf-generator', PDFGenratorCheck.new('form-526ez-pdf-generator/actuator/health')
# new bgs services 12/24
OkComputer::Registry.register 'claimant-service',
BGSServiceCheck.new('ClaimantServiceBean', 'ClaimantWebService')
OkComputer::Registry.register 'contention-service',
BGSServiceCheck.new('ContentionServiceBean', 'ContentionService')
OkComputer::Registry.register 'corporate-update-web-service',
BGSServiceCheck.new('CorporateUpdateServiceBean', 'CorporateUpdateService')
OkComputer::Registry.register 'e-benefits-bnft-claim-status-web-service',
BGSServiceCheck.new(
'EBenefitsBnftClaimStatusWebServiceBean', 'EBenefitsBenefitClaimStatusWebService'
)
OkComputer::Registry.register 'intent-to-file-service',
BGSServiceCheck.new('IntentToFileWebServiceBean', 'IntentToFileWebService')
# future service
# OkComputer::Registry.register 'org-web-service', BGSServiceCheck.new('OrgWebServiceBean','OrgWebService')
OkComputer::Registry.register 'person-web-service', BGSServiceCheck.new('PersonWebServiceBean', 'PersonWebService')
OkComputer::Registry.register 'standard-data-service', BGSServiceCheck.new('StandardDataService', 'StandardDataService')
# future service
# OkComputer::Registry.register 'standard-data-web-service',
# BGSServiceCheck.new('StandardDataWebServiceBean','StandardDataWebService')
OkComputer::Registry.register 'tracked-item-service', BGSServiceCheck.new('TrackedItemService', 'TrackedItemService')
OkComputer::Registry.register 'manage-rep-service', BGSServiceCheck.new('VDC', 'ManageRepresentativeService')
OkComputer::Registry.register 'vet-rep-service', BGSServiceCheck.new('VDC', 'VeteranRepresentativeService')
OkComputer::Registry.register 'vet-record-service', BGSServiceCheck.new('VetRecordServiceBean', 'VetRecordWebService')
OkComputer::Registry.register 'vnp-atchms-web-service',
BGSServiceCheck.new('VnpAtchmsWebServiceBean', 'VnpAtchmsService')
OkComputer::Registry.register 'vnp-person-web-service',
BGSServiceCheck.new('VnpPersonWebServiceBean', 'VnpPersonService')
OkComputer::Registry.register 'vnp-proc-form-web-service',
BGSServiceCheck.new('VnpProcFormWebServiceBean', 'VnpProcFormService')
OkComputer::Registry.register 'vnp-proc-web-v2-service',
BGSServiceCheck.new('VnpProcWebServiceBeanV2', 'VnpProcServiceV2')
OkComputer::Registry.register 'vnp-ptcpnt-addrs-web-service',
BGSServiceCheck.new('VnpPtcpntAddrsWebServiceBean', 'VnpPtcpntAddrsService')
OkComputer::Registry.register 'vnp-ptcpnt-phone-service',
BGSServiceCheck.new('VnpPtcpntPhoneWebServiceBean', 'VnpPtcpntPhoneService')
OkComputer::Registry.register 'vnp-ptcpnt-web-service',
BGSServiceCheck.new('VnpPtcpntWebServiceBean', 'VnpPtcpntService')
Original file line number Diff line number Diff line change
@@ -5,6 +5,10 @@

module ClaimsApi
class VeteranRepresentativeService < ClaimsApi::LocalBGS
def bean_name
'VDC/VeteranRepresentativeService'
end

private

def make_request(namespace:, **args)
4 changes: 4 additions & 0 deletions modules/claims_api/lib/bgs_service/vnp_atchms_service.rb
Original file line number Diff line number Diff line change
@@ -2,6 +2,10 @@

module ClaimsApi
class VnpAtchmsService < ClaimsApi::LocalBGS
def bean_name
'VnpAtchmsWebServiceBean/VnpAtchmsService'
end

# Takes an object with a minimum of (other fields are camelized and passed to BGS):
# vnp_proc_id: BGS procID
# atchms_file_nm: File name
4 changes: 4 additions & 0 deletions modules/claims_api/lib/bgs_service/vnp_person_service.rb
Original file line number Diff line number Diff line change
@@ -2,6 +2,10 @@

module ClaimsApi
class VnpPersonService < ClaimsApi::LocalBGS
def bean_name
'VnpPersonWebServiceBean/VnpPersonService'
end

# Takes an object with a minimum of (other fields are camelized and passed to BGS):
# vnp_proc_id: BGS procID
# vnp_ptcpnt_id: Veteran's participant id
4 changes: 4 additions & 0 deletions modules/claims_api/lib/bgs_service/vnp_proc_form_service.rb
Original file line number Diff line number Diff line change
@@ -4,6 +4,10 @@ module ClaimsApi
class VnpProcFormService < ClaimsApi::LocalBGS
FORM_TYPE_CD = '21-22'

def bean_name
'VnpProcFormWebServiceBean/VnpProcFormService'
end

def vnp_proc_form_create(options)
vnp_proc_id = options[:vnp_proc_id]
options.delete(:vnp_proc_id)
4 changes: 4 additions & 0 deletions modules/claims_api/lib/bgs_service/vnp_proc_service_v2.rb
Original file line number Diff line number Diff line change
@@ -4,6 +4,10 @@ module ClaimsApi
class VnpProcServiceV2 < ClaimsApi::LocalBGS
PROC_TYPE_CD = 'POAAUTHZ'

def bean_name
'VnpProcWebServiceBeanV2/VnpProcServiceV2'
end

def vnp_proc_create
body = Nokogiri::XML::DocumentFragment.parse <<~EOXML
<arg0>
Original file line number Diff line number Diff line change
@@ -2,6 +2,10 @@

module ClaimsApi
class VnpPtcpntAddrsService < ClaimsApi::LocalBGS
def bean_name
'VnpPtcpntAddrsWebServiceBean/VnpPtcpntAddrsService'
end

def vnp_ptcpnt_addrs_create(options)
arg_strg = convert_nil_values(options)
body = Nokogiri::XML::DocumentFragment.parse <<~EOXML
Original file line number Diff line number Diff line change
@@ -5,6 +5,10 @@ class VnpPtcpntPhoneService < ClaimsApi::LocalBGS
# vnpPtcpntPhoneCreate - This service is used to create VONAPP participant phone information
DEFAULT_TYPE = 'Daytime' # Daytime and Nighttime are the allowed values

def bean_name
'VnpPtcpntPhoneWebServiceBean/VnpPtcpntPhoneService'
end

def vnp_ptcpnt_phone_create(options)
request_body = construct_body(options)
body = Nokogiri::XML::DocumentFragment.parse <<~EOXML
5 changes: 5 additions & 0 deletions modules/claims_api/lib/bgs_service/vnp_ptcpnt_service.rb
Original file line number Diff line number Diff line change
@@ -3,6 +3,11 @@
module ClaimsApi
class VnpPtcpntService < ClaimsApi::LocalBGS
# vnpPtcpntCreate - This service is used to create VONAPP participant information
#
def bean_name
'VnpPtcpntWebServiceBean/VnpPtcpntService'
end

def vnp_ptcpnt_create(options)
arg_strg = convert_nil_values(options)
body = Nokogiri::XML::DocumentFragment.parse <<~EOXML

0 comments on commit 58d3360

Please sign in to comment.