module Dynamini::ClientInterface

Public Class Methods

included(base) click to toggle source
# File lib/dynamini/client_interface.rb, line 46
def self.included(base)
  base.extend ClassMethods
end

Public Instance Methods

delete_from_dynamo() click to toggle source
# File lib/dynamini/client_interface.rb, line 34
def delete_from_dynamo
  self.class.client.delete_item(table_name: self.class.table_name, key: key)
end
increment_to_dynamo(attributes, opts = {}) click to toggle source
# File lib/dynamini/client_interface.rb, line 38
def increment_to_dynamo(attributes, opts = {})
  self.class.client.update_item(
      table_name: self.class.table_name,
      key: key,
      attribute_updates: increment_updates(attributes, opts)
  )
end
save_to_dynamo(attribute_updates) click to toggle source
# File lib/dynamini/client_interface.rb, line 13
def save_to_dynamo(attribute_updates)
  self.class.client.update_item(
      table_name: self.class.table_name,
      key: key,
      attribute_updates: attribute_updates
  )
end
touch_to_dynamo() click to toggle source
# File lib/dynamini/client_interface.rb, line 21
def touch_to_dynamo
  self.class.client.update_item(
      table_name: self.class.table_name,
      key: key,
      attribute_updates:
          { updated_at:
                { value: Time.now.to_f,
                  action: 'PUT'
                }
          }
  )
end