Module: Dynamini::ClientInterface
- Included in:
- Base
- Defined in:
- lib/dynamini/testing.rb,
lib/dynamini/client_interface.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #delete_from_dynamo ⇒ Object
- #increment_to_dynamo(attributes, opts = {}) ⇒ Object
- #save_to_dynamo(attribute_updates) ⇒ Object
- #touch_to_dynamo ⇒ Object
Class Method Details
.included(base) ⇒ Object
46 47 48 |
# File 'lib/dynamini/client_interface.rb', line 46 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#delete_from_dynamo ⇒ Object
34 35 36 |
# 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 = {}) ⇒ Object
38 39 40 41 42 43 44 |
# 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) ⇒ Object
13 14 15 16 17 18 19 |
# 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 ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# 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 |