Class: Api::V2::Heron::PlatesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Api::V2::Heron::PlatesController
- Defined in:
- app/controllers/api/v2/heron/plates_controller.rb
Overview
Endpoint to create Plates inside Sequencescape for Heron
Constant Summary
Constants included from FlashTruncation
FlashTruncation::STRING_OVERHEAD
Instance Method Summary collapse
Methods inherited from ApplicationController
#block_api_access, #evil_parameter_hack!, #extract_header_info, #set_cache_disabled!
Methods included from FlashTruncation
#max_flash_size, #truncate_flash, #truncate_flash_array
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/api/v2/heron/plates_controller.rb', line 11 def create factory = ::Heron::Factories::Plate.new(params_for_plate) if factory.valid? && factory.save render json: { data: { attributes: { uuid: factory.plate.uuid, purpose_name: factory.purpose.name, study_names: factory.sample_study_names }, links: { self: api_v2_plate_url(factory.plate) } } }, status: :created else render json: { errors: factory.errors. }, status: :unprocessable_entity end end |