Skip to content

Commit

Permalink
placeholder for looking up user and rubocop fix
Browse files Browse the repository at this point in the history
  • Loading branch information
micahaspyr committed Apr 23, 2024
1 parent afc14d4 commit 855b639
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 27 deletions.
2 changes: 2 additions & 0 deletions app/controllers/claims_base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@ def stats_key
def service
@service ||= VeteranVerification::Service.new
end

def find_by_icn; end
end
54 changes: 27 additions & 27 deletions lib/lighthouse/veteran_verification/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,31 @@ class Service < Common::Client::Base
# @option options [string] :aud_claim_url option to override the aud_claim_url for LH Veteran Verification APIs
# @option options [hash] :auth_params a hash to send in auth params to create the access token
# @option options [string] :host a base host for the Lighthouse API call
def get_rated_disabilities(icn, lighthouse_client_id = nil, lighthouse_rsa_key_path = nil, options = {})
process_request('disability_rating', icn, lighthouse_client_id, lighthouse_rsa_key_path, options)
rescue => e
handle_error(e, lighthouse_client_id, 'disability_rating')
end

def get_service_history(icn, lighthouse_client_id = nil, lighthouse_rsa_key_path = nil, options = {})
process_request('service_history', icn, lighthouse_client_id, lighthouse_rsa_key_path, options)
rescue => e
handle_error(e, lighthouse_client_id, 'service_history')
end

private

def process_request(endpoint, icn, lighthouse_client_id, lighthouse_rsa_key_path, options)
config.get(endpoint + '/' + icn.to_s, lighthouse_client_id, lighthouse_rsa_key_path, options).body
end

def handle_error(error, lighthouse_client_id, endpoint)
Lighthouse::ServiceException.send_error(
error,
self.class.to_s.underscore,
lighthouse_client_id,
"#{config.base_api_path}/#{endpoint}"
)
end
def get_rated_disabilities(icn, lighthouse_client_id = nil, lighthouse_rsa_key_path = nil, options = {})
process_request('disability_rating', icn, lighthouse_client_id, lighthouse_rsa_key_path, options)
rescue => e
handle_error(e, lighthouse_client_id, 'disability_rating')
end

def get_service_history(icn, lighthouse_client_id = nil, lighthouse_rsa_key_path = nil, options = {})
process_request('service_history', icn, lighthouse_client_id, lighthouse_rsa_key_path, options)
rescue => e
handle_error(e, lighthouse_client_id, 'service_history')
end

private

def process_request(endpoint, icn, lighthouse_client_id, lighthouse_rsa_key_path, options)
config.get("#{endpoint}/#{icn}", lighthouse_client_id, lighthouse_rsa_key_path, options).body
end

def handle_error(error, lighthouse_client_id, endpoint)
Lighthouse::ServiceException.send_error(
error,
self.class.to_s.underscore,
lighthouse_client_id,
"#{config.base_api_path}/#{endpoint}"
)
end
end

end

0 comments on commit 855b639

Please sign in to comment.