Class: Dynamoid::AdapterPlugin::AwsSdkV3::Transact
- Inherits:
-
Object
- Object
- Dynamoid::AdapterPlugin::AwsSdkV3::Transact
- Defined in:
- lib/dynamoid/adapter_plugin/aws_sdk_v3/transact.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(client) ⇒ Transact
constructor
A new instance of Transact.
-
#transact_write_items(items) ⇒ Object
Perform all of the item actions in a single transaction.
Constructor Details
#initialize(client) ⇒ Transact
Returns a new instance of Transact.
10 11 12 |
# File 'lib/dynamoid/adapter_plugin/aws_sdk_v3/transact.rb', line 10 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
8 9 10 |
# File 'lib/dynamoid/adapter_plugin/aws_sdk_v3/transact.rb', line 8 def client @client end |
Instance Method Details
#transact_write_items(items) ⇒ Object
Perform all of the item actions in a single transaction.
any other object whose to_h is a transact_item hash
19 20 21 22 23 24 25 26 27 |
# File 'lib/dynamoid/adapter_plugin/aws_sdk_v3/transact.rb', line 19 def transact_write_items(items) transact_items = items.map(&:to_h) params = { transact_items: transact_items, return_consumed_capacity: 'TOTAL', return_item_collection_metrics: 'SIZE' } client.transact_write_items(params) # returns this end |