Sha256: eb806b0a020babe06b2da18af15ec0bf0f3f86edb1b9147c9fd0399001d3fdaf

Contents?: true

Size: 1.14 KB

Versions: 123

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

def modify_query(url, options = {})
  uri = URI(url)
  query_hash = Rack::Utils.parse_query(uri.query)
  query_hash.merge!(options)
  uri.query = Rack::Utils.build_query(query_hash)
  uri.to_s
end

json.links do
  json.prev patients.prev_page && modify_query(request.url, "page" => patients.prev_page)
  json.next patients.next_page && modify_query(request.url, "page" => patients.next_page)
  json.total_pages patients.total_pages
  json.next_page patients.next_page
  json.current_page patients.current_page
  json.prev_page patients.prev_page
end

json.data patients do |patient|
  json.id patient.id
  json.secure_id patient.secure_id
  json.local_patient_id patient.local_patient_id
  json.local_patient_id_2 patient.local_patient_id_2
  json.local_patient_id_3 patient.local_patient_id_3
  json.local_patient_id_4 patient.local_patient_id_4
  json.nhs_number patient.nhs_number
  json.family_name patient.family_name
  json.given_name patient.given_name
  json.title patient.title
  json.born_on patient.born_on
  json.sex patient.sex&.code
  json.send_to_renalreg patient.send_to_renalreg
  json.send_to_rpv patient.send_to_rpv
end

Version data entries

123 entries across 123 versions & 1 rubygems

Version Path
renalware-core-2.1.1 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.1.0 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.167 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.166 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.165 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.164 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.163 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.162 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.161 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.160 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.159 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.158 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.157 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.156 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.155 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.153 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.152 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.151 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.149 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.148 app/views/renalware/api/v1/patients/patients/index.json.jbuilder