FarmBot/Farmbot-Web-App

View on GitHub
app/mutations/peripherals/create.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Peripherals
  class Create < Mutations::Command
    required do
      model :device, class: Device
      integer :pin
      string :label
    end

    def execute
      Peripheral.find_or_create_by!(inputs)
    end
  end
end