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.0.84 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.83 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.82 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.81 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.80 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.79 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.78 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.77 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.76 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.75 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.74 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.73 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.72 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.71 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.70 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.69 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.68 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.67 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.64 app/views/renalware/api/v1/patients/patients/index.json.jbuilder
renalware-core-2.0.63 app/views/renalware/api/v1/patients/patients/index.json.jbuilder