class SuperEHR::BaseEHR

Public Class Methods

new(default_params={}) click to toggle source

initialize necessary components

# File lib/super_ehr.rb, line 20
def initialize(default_params={})
  @default_params = default_params
end

Public Instance Methods

get_changed_patients(ts) click to toggle source

Get a list of patients changed since ts

# File lib/super_ehr.rb, line 89
def get_changed_patients(ts)
  SuperEHR.not_implemented(__callee__)
end
get_changed_patients_ids(ts) click to toggle source

Get a list of patients changed since ts

# File lib/super_ehr.rb, line 94
def get_changed_patients_ids(ts)
  SuperEHR.not_implemented(__callee__)
end
get_default_params() click to toggle source
# File lib/super_ehr.rb, line 24
def get_default_params
  return {}
end
get_patient(patient_id) click to toggle source

Get details for a specific patient

# File lib/super_ehr.rb, line 79
def get_patient(patient_id)
  SuperEHR.not_implemented(__callee__)
end
get_patients() click to toggle source

Gets a list of patients

# File lib/super_ehr.rb, line 84
def get_patients
  SuperEHR.not_implemented(__callee__)
end
get_request_body() click to toggle source
# File lib/super_ehr.rb, line 32
def get_request_body
  return {}
end
get_request_headers() click to toggle source
# File lib/super_ehr.rb, line 28
def get_request_headers
  return {}
end
get_request_url(endpoint) click to toggle source
# File lib/super_ehr.rb, line 36
def get_request_url(endpoint)
  return "/#{endpoint}"
end
get_scheduled_patients(day) click to toggle source

Get patients scheduled for a specific day

# File lib/super_ehr.rb, line 99
def get_scheduled_patients(day)
  SuperEHR.not_implemented(__callee__)
end
make_request(request_type, endpoint, request_params={}, use_default_params=true, to_json=true) click to toggle source

make a HTTP request

# File lib/super_ehr.rb, line 45
def make_request(request_type, endpoint, request_params={}, use_default_params=true, to_json=true)
  if use_default_params
    params = get_default_params
    params = params.merge(request_params)
  else
    params = request_params
  end

  headers = get_request_headers
  url = get_request_url(endpoint)

  if request_type == "GET"
    response = HTTParty.get(url, :query => params, :headers => headers)
  elsif request_type == "POST"
    if headers.key?("Content-Type") and headers["Content-Type"] == "application/json"
      params = JSON.generate(params)
    end
    response = HTTParty.post(url, :body => params, :headers => headers)
  else
    puts "Request Type #{request_type} unsupported"
    return
  end

  if to_json
    return JSON.parse(response.body)
  else
    return response.body
  end
end
refresh_token() click to toggle source
# File lib/super_ehr.rb, line 40
def refresh_token
  SuperEHR.not_implemented(__callee__)
end
upload_document(patient_id, filepath, description) click to toggle source

upload a pdf

# File lib/super_ehr.rb, line 104
def upload_document(patient_id, filepath, description)
  SuperEHR.not_implemented(__callee__)
end