Ruby library for connecting to the Claim Evidence API.
Currently, this gem is able to interact with the following endpoints of the Claim Evidence API.
Call document_types
to retrieve available document types:
ExternalApi::ClaimEvidenceService.document_types
Call get_ocr_document(doc.series_id)
to get all of the content for a document:
# Assume use of a VBMS Document model
doc = Document.find_by(criteria: "here")
ExternalApi::ClaimEvidenceService.get_ocr_document(doc.series_id)
Internally, the app uses a Fakes
module to mock API behavior. The required setup steps are as follows:
- Install and configure
devvpn
.- Information re. how to do this is located internally.
- Search "Steps to Set Up DevVPN" in the internal document repository or contact your team lead for assistance in locating these instructions.
- Add files needed by Faraday.
- Access the example certs located here.
- Copy the
.crt
file locally and note the path for later. - Copy the
.key
file locally and note the path for later.
- In your shell, set the following environment variables:
-
JWT_TOKEN
:- NOTE: Some CE API endpoints need correct user roles in order to get a successful response.
- For example, calling the OCR endpoint requires that the user attached to the request's JWT have a specific scanner role.
- More information on available roles can be found by searching for "Policy Description Document" or "PDD" in the project management software.
- For the
Fakes
module, JWT tokens do not auto-generate with each request, so you will need to either manually create one or use an existing token.
- NOTE: Some CE API endpoints need correct user roles in order to get a successful response.
-
BASE_URL
:- This will depend on the environment you're wanting to test.
- For example,
https://vefs-claimevidence-int.dev.bip.va.gov
is the URL for the INT environment.
-
HTTP_PROXY
:- You need to have an AIDE user and password, which you can find more info on here.
- The required format is:
http://aideusername:[email protected]:9443
-
KEY_LOCATION
: Path to.key
file from earlier. -
CERT_LOCATION
: Path to.crt
file from earlier. -
CERT_PASSWORD
: Usevbmsclient
.
-
- Relaunch your shell or source your shell's config file to load the variables you set above.
- In your local Rails console, you can now use
Fakes::ClaimEvidenceService
. For example:Fakes::ClaimEvidenceService.document_types
Fakes::ClaimEvidenceService.get_ocr_document(doc.series_id)
In many UAT environments, the gem is preconfigured and can be used via ExternalApi::ClaimEvidenceService
:
ExternalApi::ClaimEvidenceService.document_types
ExternalApi::ClaimEvidenceService.get_ocr_document(doc.series_id)
This will return all of the documents that contain the search word or phrase inside the document:
match_docs = []
person.documents.each do |doc|
query = ExternalApi::ClaimEvidenceService.get_ocr_document(doc.series_id)
if query.downcase.include("search term here")
match_docs << doc
end
end