-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
find_dependents_by_ptcpnt_id
to local bgs
* Create PersonWebService class * Add `FindDependentsByPtcpntId` to BGSClient Definitions for WSDL caching * Add test and cassette
- Loading branch information
Showing
4 changed files
with
120 additions
and
0 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
module ClaimsApi | ||
class PersonWebService < ClaimsApi::LocalBGS | ||
def bean_name | ||
'PersonWebServiceBean/PersonWebService' | ||
end | ||
|
||
def find_dependents_by_ptcpnt_id(id) | ||
body = Nokogiri::XML::DocumentFragment.parse <<~EOXML | ||
<ptcpntId /> | ||
EOXML | ||
|
||
{ ptcpntId: id }.each do |k, v| | ||
body.xpath("./*[local-name()='#{k}']").first.content = v | ||
end | ||
|
||
make_request(endpoint: bean_name, action: 'findDependentsByPtcpntId', body:, key: 'DependentDTO') | ||
end | ||
end | ||
end |
20 changes: 20 additions & 0 deletions
20
modules/claims_api/spec/lib/claims_api/person_web_service_spec.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
require 'bgs_service/person_web_service' | ||
|
||
describe ClaimsApi::PersonWebService do | ||
subject { described_class.new external_uid: 'xUid', external_key: 'xKey' } | ||
|
||
describe '#find_dependents_by_ptcpnt_id' do | ||
it 'responds as expected' do | ||
VCR.use_cassette('claims_api/bgs/person_web_service/find_dependents_by_ptcpnt_id') do | ||
# rubocop:disable Style/NumericLiterals | ||
result = subject.find_dependents_by_ptcpnt_id(600052699) | ||
# rubocop:enable Style/NumericLiterals | ||
expect(result).to be_a Hash | ||
expect(result[:dependent][:first_nm]).to eq 'MARGIE' | ||
end | ||
end | ||
end | ||
end |
70 changes: 70 additions & 0 deletions
70
.../support/vcr_cassettes/claims_api/bgs/person_web_service/find_dependents_by_ptcpnt_id.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.