-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API-42927-veteran-rep-service-standardization #19872
Open
stiehlrod
wants to merge
24
commits into
master
Choose a base branch
from
API-42927-veteran-rep-service-standardization
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+133
−881
Open
Changes from 5 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
ad123e1
Removes extra methods from definitions file.
stiehlrod e241095
Merge branch 'master' into API-42927-veteran-rep-service-standardization
stiehlrod 86534d9
Removes extra methods. Adds method to veteran_representative_service.…
stiehlrod 2076350
Merge branch 'master' into API-42927-veteran-rep-service-standardization
stiehlrod 79f1c4b
Combines vet rep service methods to one file, removes extra service f…
stiehlrod 03845cb
Merge branch 'master' into API-42927-veteran-rep-service-standardization
stiehlrod 28b3baf
Reverts change that will happen in another PR.
stiehlrod c52c416
Reverts change that will happen in another PR.
stiehlrod a84d15c
Reverts change that will happen in another PR.
stiehlrod 4bc92fc
Corrects the namespace in the create_veteran_representative method. R…
stiehlrod 5c9b445
Resolves merge conflict
stiehlrod 7d6fb6c
Merge branch 'master' into API-42927-veteran-rep-service-standardization
stiehlrod f2ba537
Merge branch 'master' into API-42927-veteran-rep-service-standardization
stiehlrod e31632e
Merge branch 'master' into API-42927-veteran-rep-service-standardization
stiehlrod 620b0fb
Merge branch 'master' into API-42927-veteran-rep-service-standardization
stiehlrod db364b4
Replaces nso with data.
stiehlrod 9819bf9
Merge branch 'API-42927-veteran-rep-service-standardization' of githu…
stiehlrod 59ae114
Merge branch 'master' into API-42927-veteran-rep-service-standardization
stiehlrod 653e370
Resolves merge conflict
stiehlrod 2ee9eb6
Merge branch 'master' of github.com:department-of-veterans-affairs/ve…
stiehlrod e9896fb
Merge branch 'API-42927-veteran-rep-service-standardization' of githu…
stiehlrod 24601c9
Resolves merge conflict
stiehlrod c6c845c
removes deprecated test file
stiehlrod 82135c2
Merge branch 'master' into API-42927-veteran-rep-service-standardization
stiehlrod File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 49 additions & 10 deletions
59
modules/claims_api/lib/bgs_service/veteran_representative_service.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,58 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'veteran_representative_service/create_veteran_representative_request' | ||
require_relative 'veteran_representative_service/read_all_veteran_representatives' | ||
|
||
module ClaimsApi | ||
class VeteranRepresentativeService < ClaimsApi::LocalBGS | ||
private | ||
def bean_name | ||
'VDC/VeteranRepresentativeService' | ||
end | ||
|
||
def create_veteran_representative(options) | ||
# error VetRep cannot be null | ||
injected = convert_nil_values(options) | ||
|
||
def make_request(namespace:, **args) | ||
super( | ||
endpoint: 'VDC/VeteranRepresentativeService', | ||
namespaces: { namespace => '/data' }, | ||
transform_response: false, | ||
**args | ||
body = Nokogiri::XML::DocumentFragment.parse <<~EOXML | ||
<data:VetRepresentative> | ||
#{injected} | ||
</data:VetRepresentative> | ||
EOXML | ||
|
||
make_request( | ||
endpoint: bean_name, | ||
namespaces: { 'data' => '/data' }, | ||
action: 'createVeteranRepresentative', | ||
body: body.to_s, | ||
key: 'VeteranRepresentativeReturn', | ||
transform_response: false | ||
) | ||
end | ||
|
||
# type_code: form type (I.E. 21-22 vs 21-22A) | ||
# ptcpnt_id: participant ID | ||
def read_all_veteran_representatives(type_code:, ptcpnt_id:) | ||
validate! type_code, ptcpnt_id | ||
|
||
body = Nokogiri::XML::DocumentFragment.parse <<~EOXML | ||
<ns0:CorpPtcpntIdFormTypeCode> | ||
<veteranCorpPtcpntId>#{ptcpnt_id}</veteranCorpPtcpntId> | ||
<formTypeCode>#{type_code}</formTypeCode> | ||
</ns0:CorpPtcpntIdFormTypeCode> | ||
EOXML | ||
ret = make_request(endpoint: bean_name, namespaces: { 'data' => '/data' }, | ||
action: 'readAllVeteranRepresentatives', body:, | ||
key: 'VeteranRepresentativeReturnList', | ||
transform_response: false) || [] | ||
|
||
[ret].flatten | ||
end | ||
|
||
private | ||
|
||
def validate!(type_code, ptcpnt_id) | ||
errors = [] | ||
errors << 'type_code is required' if type_code.nil? | ||
errors << 'ptcpnt_id must be 1-15 digits and > 0' if ptcpnt_id.length > 15 || ptcpnt_id.to_i < 1 | ||
|
||
raise ArgumentError, "Errors: #{errors.join(', ')}" if errors.any? | ||
end | ||
end | ||
end |
21 changes: 0 additions & 21 deletions
21
...i/lib/bgs_service/veteran_representative_service/create_veteran_representative_request.rb
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
...ms_api/lib/bgs_service/veteran_representative_service/read_all_veteran_representatives.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't append an
ns0
namespace to our outgoing request so this fails with theThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is still throwing this error. We don't have ns0, we'd need this to be
data
or the namespaces to includens0
.