Skip to content

Commit

Permalink
Add find_dependents_by_ptcpnt_id to local bgs
Browse files Browse the repository at this point in the history
* Create PersonWebService class
* Add `FindDependentsByPtcpntId` to BGSClient Definitions for WSDL
  caching
* Add test and cassette
  • Loading branch information
tycol7 committed Sep 4, 2024
1 parent 84d3cf1 commit bed8adc
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,15 @@ module PersonWebService
path: 'PersonWebService'
)

module FindDependentsByPtcpntId
DEFINITION =
Action.new(
service: PersonWebService::DEFINITION,
name: 'findDependentsByPtcpntId',
key: 'DependentDTO'
)
end

module FindPersonBySSN
DEFINITION =
Action.new(
Expand Down
21 changes: 21 additions & 0 deletions modules/claims_api/lib/bgs_service/person_web_service.rb
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 modules/claims_api/spec/lib/claims_api/person_web_service_spec.rb
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bed8adc

Please sign in to comment.