Class: Chip::Service
- Inherits:
-
Common::Client::Base
- Object
- Common::Client::Base
- Chip::Service
- Defined in:
- lib/chip/service.rb
Constant Summary collapse
- STATSD_KEY_PREFIX =
'api.chip'
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#redis_client ⇒ Object
readonly
Returns the value of attribute redis_client.
-
#tenant_id ⇒ Object
readonly
Returns the value of attribute tenant_id.
-
#tenant_name ⇒ Object
readonly
Returns the value of attribute tenant_name.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Class Method Summary collapse
-
.build(opts = {}) ⇒ Service
Builds a Service instance.
Instance Method Summary collapse
-
#get_demographics(patient_dfn:, station_no:) ⇒ Faraday::Response
Get the auth demographics data from CHIP.
-
#get_token ⇒ Faraday::Response
Get the auth token from CHIP.
-
#initialize(opts = {}) ⇒ Service
constructor
A new instance of Service.
-
#post_patient_check_in(appointment_ien:, patient_dfn:, station_no:) ⇒ Faraday::Response
Post the check-in status to CHIP.
-
#update_demographics(patient_dfn:, station_no:, demographic_confirmations:) ⇒ Faraday::Response
Post the demographics confirmation data to CHIP.
Methods included from Common::Client::Concerns::Monitoring
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger
Methods inherited from Common::Client::Base
configuration, #raise_backend_exception
Constructor Details
#initialize(opts = {}) ⇒ Service
Returns a new instance of Service.
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/chip/service.rb', line 34 def initialize(opts = {}) @tenant_name = opts[:tenant_name] @tenant_id = opts[:tenant_id] @username = opts[:username] @password = opts[:password] validate_arguments! @redis_client = RedisClient.build(tenant_id) super() end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
17 18 19 |
# File 'lib/chip/service.rb', line 17 def password @password end |
#redis_client ⇒ Object (readonly)
Returns the value of attribute redis_client.
17 18 19 |
# File 'lib/chip/service.rb', line 17 def redis_client @redis_client end |
#tenant_id ⇒ Object (readonly)
Returns the value of attribute tenant_id.
17 18 19 |
# File 'lib/chip/service.rb', line 17 def tenant_id @tenant_id end |
#tenant_name ⇒ Object (readonly)
Returns the value of attribute tenant_name.
17 18 19 |
# File 'lib/chip/service.rb', line 17 def tenant_name @tenant_name end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
17 18 19 |
# File 'lib/chip/service.rb', line 17 def username @username end |
Class Method Details
.build(opts = {}) ⇒ Service
Builds a Service instance
30 31 32 |
# File 'lib/chip/service.rb', line 30 def self.build(opts = {}) new(opts) end |
Instance Method Details
#get_demographics(patient_dfn:, station_no:) ⇒ Faraday::Response
Get the auth demographics data from CHIP
50 51 52 53 54 55 |
# File 'lib/chip/service.rb', line 50 def get_demographics(patient_dfn:, station_no:) with_monitoring_and_error_handling do perform(:get, "/#{config.base_path}/actions/authenticated-demographics", { patientDfn: patient_dfn, stationNo: station_no }, request_headers) end end |
#get_token ⇒ Faraday::Response
Get the auth token from CHIP
75 76 77 78 79 |
# File 'lib/chip/service.rb', line 75 def get_token with_monitoring do perform(:post, "/#{config.base_path}/token", {}, token_headers) end end |
#post_patient_check_in(appointment_ien:, patient_dfn:, station_no:) ⇒ Faraday::Response
Post the check-in status to CHIP
86 87 88 89 90 91 92 |
# File 'lib/chip/service.rb', line 86 def post_patient_check_in(appointment_ien:, patient_dfn:, station_no:) with_monitoring_and_error_handling do perform(:post, "/#{config.base_path}/actions/authenticated-checkin", { appointmentIen: appointment_ien, patientDfn: patient_dfn, stationNo: station_no }, request_headers) end end |
#update_demographics(patient_dfn:, station_no:, demographic_confirmations:) ⇒ Faraday::Response
Post the demographics confirmation data to CHIP
62 63 64 65 66 67 68 |
# File 'lib/chip/service.rb', line 62 def update_demographics(patient_dfn:, station_no:, demographic_confirmations:) with_monitoring_and_error_handling do perform(:post, "/#{config.base_path}/actions/authenticated-demographics", { patientDfn: patient_dfn, stationNo: station_no, demographicConfirmations: demographic_confirmations }, request_headers) end end |