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

configuration, #raise_backend_exception

Methods included from SentryLogging

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

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_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