Class: PHRMgr::Client

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

Overview

Core class responsible for PHR Manager 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(icn) ⇒ Client

Initialize the client

Parameters:

  • icn (String)

    MHV patient ICN

Raises:



18
19
20
21
22
23
# File 'lib/medical_records/phr_mgr/client.rb', line 18

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

  @icn = icn
end

Instance Method Details

#get_military_service(edipi) ⇒ Object

Get military service record

Parameters:

  • edipi

Returns:

    • military service record in text format



51
52
53
54
55
# File 'lib/medical_records/phr_mgr/client.rb', line 51

def get_military_service(edipi)
  headers = self.class.configuration.x_auth_key_headers.merge({ 'Accept' => 'text/plain' })
  response = perform(:get, "dod/vaprofile/#{edipi}", nil, headers)
  response.body
end

#get_phrmgr_statusHash

Run a PHR Manager refresh on the patient.

Returns:

  • (Hash)

    Patient status



41
42
43
44
# File 'lib/medical_records/phr_mgr/client.rb', line 41

def get_phrmgr_status
  response = perform(:get, "status/#{@icn}", nil, self.class.configuration.x_auth_key_headers)
  response.body
end

#post_phrmgr_refreshFixnum

Run a PHR Manager refresh on the patient.

Returns:

  • (Fixnum)

    Call status



30
31
32
33
34
# File 'lib/medical_records/phr_mgr/client.rb', line 30

def post_phrmgr_refresh
  response = perform(:post, "refresh/#{@icn}", nil, self.class.configuration.x_auth_key_headers)
  # response_hash = JSON.parse(response.body)
  response&.status
end