Module: Dynamini::ClientInterface

Included in:
Base
Defined in:
lib/dynamini/client_interface.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



57
58
59
# File 'lib/dynamini/client_interface.rb', line 57

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#delete_from_dynamoObject



45
46
47
# File 'lib/dynamini/client_interface.rb', line 45

def delete_from_dynamo
  self.class.client.delete_item(table_name: self.class.table_name, key: key)
end

#increment_to_dynamo(attributes, opts = {}) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/dynamini/client_interface.rb', line 49

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_dynamoObject



24
25
26
27
28
29
30
# File 'lib/dynamini/client_interface.rb', line 24

def save_to_dynamo
  self.class.client.update_item(
      table_name: self.class.table_name,
      key: key,
      attribute_updates: attribute_updates
  )
end

#touch_to_dynamoObject



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/dynamini/client_interface.rb', line 32

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