Sha256: 6fb938c00fa1a61f3c58f97b28dae64f615e625f4b724932610a13c01de7d217

Contents?: true

Size: 512 Bytes

Versions: 3

Compression:

Stored size: 512 Bytes

Contents

# frozen_string_literal: true

module ROM
  module HTTP
    module Commands
      #  HTTP Create command
      #
      #  @api public
      class Create < ROM::Commands::Create
        adapter :http

        # Submits each of the provided tuples over HTTP post
        #
        # @api public
        def execute(tuples)
          Array([tuples]).flatten.map do |tuple|
            attributes = input[tuple]
            relation.insert(attributes.to_h)
          end.to_a
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rom-http-0.10.0 lib/rom/http/commands/create.rb
rom-http-0.9.0 lib/rom/http/commands/create.rb
rom-http-0.8.0 lib/rom/http/commands/create.rb