Class: UserEligibility::Client

Inherits:
Common::Client::Base show all
Defined in:
lib/medical_records/user_eligibility/client.rb

Overview

Core class responsible for User Eligibility API interface operations

Instance Method Summary collapse

Methods inherited from Common::Client::Base

#config, configuration, #connection, #delete, #get, #perform, #post, #put, #raise_backend_exception, #raise_not_authenticated, #request, #sanitize_headers!, #service_name

Methods included from SentryLogging

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

Constructor Details

#initialize(user_id, icn) ⇒ Client

Initialize the client

Parameters:

  • user_id (String)

    MHV correlation ID

  • icn (String)

    MHV patient ICN

Raises:



19
20
21
22
23
24
25
26
# File 'lib/medical_records/user_eligibility/client.rb', line 19

def initialize(user_id, icn)
  super()
  raise Common::Exceptions::ParameterMissing, 'User ID' if user_id.blank?
  raise Common::Exceptions::ParameterMissing, 'ICN' if icn.blank?

  @icn = icn
  @user_id = user_id
end

Instance Method Details

#get_is_valid_sm_userHash

Run a user eligibility check on the patient

Returns:

  • (Hash)

    Patient eligibility status



33
34
35
36
# File 'lib/medical_records/user_eligibility/client.rb', line 33

def get_is_valid_sm_user
  response = perform(:get, "isValidSMUser/#{@user_id}/#{@icn}", nil, self.class.configuration.x_headers)
  response.body
end