sanger/sequencescape

View on GitHub
app/api/model_extensions/stamp.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true
# Included in {Stamp}
# Handles the translation of V1 API input to more standard rails attributes
module ModelExtensions::Stamp
  def stamp_details=(details)
    stamp_qcables.build(details.map { |d| locate_qcable(d) })
  end

  private

  def locate_qcable(d)
    d['qcable'] = Uuid.find_by(external_id: d['qcable']).resource
    d
  end
end