Class: VeteranVerification::Service

Inherits:
Common::Client::Base show all
Defined in:
lib/lighthouse/veteran_verification/service.rb

Constant Summary collapse

STATSD_KEY_PREFIX =
'api.veteran_verification'

Instance Method Summary collapse

Methods inherited from Common::Client::Base

configuration, #raise_backend_exception

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger

Instance Method Details

#get_rated_disabilities(icn, lighthouse_client_id = nil, lighthouse_rsa_key_path = nil, options = {}) ⇒ Object

Parameters:

  • icn: (string)

    the ICN of the target Veteran

  • lighthouse_client_id: (string)

    the lighthouse_client_id requested from Lighthouse

  • lighthouse_rsa_key_path: (string)

    path to the private RSA key used to create the lighthouse_client_id

  • options: (hash)

    options to override aud_claim_url, params, and auth_params

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :params (hash)

    body for the request

  • :aud_claim_url (string)

    option to override the aud_claim_url for LH Veteran Verification APIs

  • :auth_params (hash)

    a hash to send in auth params to create the access token

  • :host (string)

    a base host for the Lighthouse API call



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/lighthouse/veteran_verification/service.rb', line 20

def get_rated_disabilities(icn, lighthouse_client_id = nil, lighthouse_rsa_key_path = nil, options = {})
  endpoint = 'disability_rating'
  config
    .get(
      "#{endpoint}/#{icn}",
      lighthouse_client_id,
      lighthouse_rsa_key_path,
      options
    )
    .body
rescue => e
  handle_error(e, lighthouse_client_id, endpoint)
end

#handle_error(error, lighthouse_client_id, endpoint) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/lighthouse/veteran_verification/service.rb', line 34

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