Sha256: ad2c3ac17f2c04d9ec6c084f3396239cb74232bc818f6c889afaf3f8c8d4f8b3
Contents?: true
Size: 1.09 KB
Versions: 36
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true require_dependency "renalware" module Renalware module API module UKRDC class PatientsController < BaseController respond_to :xml def show respond_to do |format| format.xml { render xml: patient_ukrdc_xml } end end private def patient_ukrdc_xml result = attempt_to_generate_patient_ukrdc_xml if result.failure? result.validation_errors.to_xml else result.xml end end def attempt_to_generate_patient_ukrdc_xml Renalware::UKRDC::XmlRenderer.new( schema: Renalware::UKRDC::XsdSchema.new, locals: { patient: patient_presenter } ).call end def patient_presenter patient = Renalware::Patient.find_by!(secure_id: params[:id]) authorize patient changes_since = params.fetch(:changes_since, "2018-01-01") Renalware::UKRDC::PatientPresenter.new(patient, changes_since: changes_since) end end end end end
Version data entries
36 entries across 36 versions & 1 rubygems