Class: IHub::Appointments::Service

Inherits:
Service show all
Includes:
Common::Client::Concerns::Monitoring
Defined in:
lib/ihub/appointments/service.rb

Constant Summary

Constants inherited from Service

Service::STATSD_KEY_PREFIX

Instance Method Summary collapse

Methods included from Common::Client::Concerns::Monitoring

#with_monitoring

Methods inherited from Service

#initialize

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

This class inherits a constructor from IHub::Service

Instance Method Details

#appointmentsIHub::Appointments::Response

Fetches a collection of veteran appointment data from iHub.

Per iHub docs, requires a service parameter of noFilter=true, in non-production environments.

Returns:

  • (IHub::Appointments::Response)

    Sample response: {

    :status       => 200,
    :appointments => [
      {
        "clinic_code"             => "409",
        "clinic_name"             => "ZZCHY WID BACK",
        "start_time"              => "1996-01-12T08:12:00",
        "type_name"               => "REGULAR",
        "status_name"             => "CHECKED OUT",
        "status_code"             => "2",
        "other_information"       => "",
        "type_code"               => "9",
        "appointment_status_code" => nil,
        "local_id"                => "2960112.0812",
        "appointment_status_name" => nil,
        "assigning_facility"      => nil,
        "facility_name"           => "CHEYENNE VAMC",
        "facility_code"           => "442"
      },
      ...
    ]
    

    }



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/ihub/appointments/service.rb', line 45

def appointments
  icn_present!

  with_monitoring do
    response = perform(:get, appointments_url, nil)

    report_error!(response)

    IHub::Appointments::Response.from(response)
  end
rescue => e
  Raven.extra_context(
    message: e.message,
    url: config.base_path
  )
  Raven.tags_context(ihub: 'appointments')

  raise e
end