Sha256: 54d307e5714b9d8848cb7b8db2171f098913ae5f1a644ac9a3ec00d6e23d8071

Contents?: true

Size: 1.52 KB

Versions: 9

Compression:

Stored size: 1.52 KB

Contents

module Fog
  module AWS
    class DynamoDB
      class Real

        # Update DynamoDB item
        #
        # ==== Parameters
        # * 'table_name'<~String> - name of table for item
        # * 'item'<~Hash>: data to update, must include primary key
        #   * 'AttributeName'<~String> - Attribute to update
        #     * 'Value'<~Hash> - formated as {type => value}
        #     * 'Action'<~String> - action to take if expects matches, in %w{ADD DELETE PUT}, defaults to PUT
        # * 'options'<~Hash>:
        #   * 'Expected'<~Hash>: data to check against
        #     * 'AttributeName'<~String> - name of attribute
        #     * 'Value'<~Hash> - a value to check for the value of
        #     or
        #     * 'Exists'<~Boolean> - set as false to only allow update if attribute doesn't exist
        #   * 'ReturnValues'<~String> - data to return in %w{ALL_NEW ALL_OLD NONE UPDATED_NEW UPDATED_OLD}, defaults to NONE
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     varies based on ReturnValues param, see: http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/API_UpdateItem.html
        def put_item(table_name, item, options = {})
          body = {
            'Item'      => item,
            'TableName' => table_name
          }.merge(options)

          request(
            :body       => MultiJson.encode(body),
            :headers    => {'x-amz-target' => 'DynamoDB_20111205.PutItem'}
          )
        end

      end
    end
  end
end

Version data entries

9 entries across 9 versions & 5 rubygems

Version Path
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/dynamodb/put_item.rb
michiels-fog-1.3.1 lib/fog/aws/requests/dynamodb/put_item.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/aws/requests/dynamodb/put_item.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/dynamodb/put_item.rb
fog-1.3.1 lib/fog/aws/requests/dynamodb/put_item.rb
fog-1.3.0 lib/fog/aws/requests/dynamodb/put_item.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/dynamodb/put_item.rb
fog-1.2.0 lib/fog/aws/requests/dynamodb/put_item.rb
ktheory-fog-1.1.2 lib/fog/aws/requests/dynamodb/put_item.rb