Sha256: 0d07554997b09a755c74f6117cccb47eae4fa8f3425232e34cb72724b8194138

Contents?: true

Size: 768 Bytes

Versions: 1

Compression:

Stored size: 768 Bytes

Contents

module Commands::Groups::Configuration
  class Update < RestPack::Service::Command
    required do
      array :configurations do
        hash do
          required do
            integer :id
            string :rsvp_url
          end
        end
      end
    end

    def execute
      result = {
        configurations: []
      }

      Models::Groups::Configuration.transaction do
        inputs[:configurations].each do |configuration|
          model = Models::Groups::Configuration.find configuration[:id]
          model.data = {
            rsvp_url: configuration[:rsvp_url]
          }
          model.save!
          result[:configurations] << Serializers::Groups::Configuration.as_json(model)
        end
      end

      return result
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restpack_group_service-0.0.8 lib/restpack_group_service/commands/configuration/update.rb