Class: Dynamoid::AdapterPlugin::AwsSdkV3::BatchGetItem::Response
- Inherits:
-
Object
- Object
- Dynamoid::AdapterPlugin::AwsSdkV3::BatchGetItem::Response
- Defined in:
- lib/dynamoid/adapter_plugin/aws_sdk_v3/batch_get_item.rb
Overview
Helper class to work with response
Instance Method Summary collapse
-
#initialize(api_response) ⇒ Response
constructor
A new instance of Response.
- #items_grouped_by_table ⇒ Object
- #successful_partially? ⇒ Boolean
- #unprocessed_ids(table) ⇒ Object
Constructor Details
#initialize(api_response) ⇒ Response
Returns a new instance of Response.
75 76 77 |
# File 'lib/dynamoid/adapter_plugin/aws_sdk_v3/batch_get_item.rb', line 75 def initialize(api_response) @api_response = api_response end |
Instance Method Details
#items_grouped_by_table ⇒ Object
89 90 91 92 93 94 |
# File 'lib/dynamoid/adapter_plugin/aws_sdk_v3/batch_get_item.rb', line 89 def items_grouped_by_table # data[:responses] is a Hash[table_name -> items] @api_response.data[:responses].transform_values do |items| items.map(&method(:item_to_hash)) end end |
#successful_partially? ⇒ Boolean
79 80 81 |
# File 'lib/dynamoid/adapter_plugin/aws_sdk_v3/batch_get_item.rb', line 79 def successful_partially? @api_response.unprocessed_keys.present? end |
#unprocessed_ids(table) ⇒ Object
83 84 85 86 87 |
# File 'lib/dynamoid/adapter_plugin/aws_sdk_v3/batch_get_item.rb', line 83 def unprocessed_ids(table) # unprocessed_keys Hash contains as values instances of # Aws::DynamoDB::Types::KeysAndAttributes @api_response.unprocessed_keys[table.name].keys.map { |h| h[table.hash_key.to_s] } end |