Sha256: 58a501b5c64b24d4d6655cc2e21af5f7dcb5885169ea00a4cc839d1b9a216e57

Contents?: true

Size: 669 Bytes

Versions: 1

Compression:

Stored size: 669 Bytes

Contents

require 'stormwatch/workflows/base'

module Stormwatch
  module Workflows
    class CreateBoard < Base
      include Requirements[
        'storage.boards',
      ]

      def call(payload:)
        payload = Payload.new(payload)

        unless board = boards.create_board(payload.name)
          broadcast(:failure)
          return
        end

        broadcast(
          :success, 
          {
            uuid: board.uuid,
            name: board.name,
          }
        )
      end

      class Payload < Base::Payload
        attribute :name, String
      end

    end

    Registry.register(
      'create_board',
      -> {CreateBoard.new}
    )
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stormwatch-workflows-0.1.3 lib/stormwatch/workflows/create_board.rb