lib/dynamoid/adapter_plugin/aws_sdk_v2.rb
# Persists an item on DynamoDB.
#
# @param [String] table_name the name of the table
# @param [Object] object a hash or Dynamoid object to persist
#
# @since 1.0.0
#
# @todo: Provide support for various options http://docs.aws.amazon.com/sdkforruby/api/Aws/DynamoDB/Client.html#put_item-instance_method
Persists an item on DynamoDB.
Persists an item on DynamoDB .
def put_item(table_name, object, options = nil)
        item = {}
        object.each do |k, v|
          next if v.nil? || (v.respond_to?(:empty?) && v.empty?)
          item[k.to_s] = v
        end
        begin
          client.put_item(table_name: table_name,
            item: item,
            expected: expected_stanza(options)
          )
        rescue Aws::DynamoDB::Errors::ConditionalCheckFailedException => e
          raise Dynamoid::Errors::ConditionalCheckFailedException, e
        end
      end
def put_item ( table_name , object , options = nil ) item = { } object . each do | k , v | next if v . nil? || ( v . respond_to? ( :empty? ) && v . empty? ) item [ k . to_s ] = v end begin client . put_item ( table_name : table_name , item : item , expected : expected_stanza ( options ) ) rescue Aws :: DynamoDB :: Errors :: ConditionalCheckFailedException => e raise Dynamoid :: Errors :: ConditionalCheckFailedException , e end end
Persists an item on DynamoDB.
Persists an item on DynamoDB .
table_name
object
options
object a hash or Dynamoid object to persist
object a hash or Dynamoid object to persist
since
None
todo:
None