Module: HealthCards::Exporter
- Defined in:
- lib/health_cards/exporter.rb
Overview
Converts a JWS to formats needed by endpoints (e.g. $issue-health-card, download and qr code)
Class Method Summary collapse
-
.file_download(jws) ⇒ String
Export JWS for file download.
-
.issue(fhir_params) ⇒ String
Export JWS for $issue-health-card endpoint Expects block to return JWS instances for those types.
- .qr_codes(jws) ⇒ Object
Class Method Details
.file_download(jws) ⇒ String
Export JWS for file download
10 11 12 |
# File 'lib/health_cards/exporter.rb', line 10 def file_download(jws) { verifiableCredential: jws.map(&:to_s) }.to_json end |
.issue(fhir_params) ⇒ String
Export JWS for $issue-health-card endpoint Expects block to return JWS instances for those types
19 20 21 22 23 24 25 |
# File 'lib/health_cards/exporter.rb', line 19 def issue(fhir_params) *jws = yield extract_types!(fhir_params) params = jws.compact.map { |j| FHIR::Parameters::Parameter.new(name: 'verifiableCredential', valueString: j) } FHIR::Parameters.new(parameter: params).to_json end |