FarmBot/Farmbot-Web-App

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

Summary

Maintainability
A
0 mins
Test Coverage
module Peripherals
  class Update < Mutations::Command
    required do
      model :peripheral, class: Peripheral
      model :device, class: Device
    end

    optional do
      integer :pin
      integer :mode
      string :label
    end

    def execute
      peripheral.update!(inputs.except(:peripheral, :device))
      peripheral
    end
  end
end