class Dynamoid::AdapterPlugin::AwsSdkV3::BatchGetItem::Response
Helper class to work with response
Public Class Methods
new(api_response)
click to toggle source
# File lib/dynamoid/adapter_plugin/aws_sdk_v3/batch_get_item.rb, line 78 def initialize(api_response) @api_response = api_response end
Public Instance Methods
items_grouped_by_table()
click to toggle source
# File lib/dynamoid/adapter_plugin/aws_sdk_v3/batch_get_item.rb, line 101 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?()
click to toggle source
# File lib/dynamoid/adapter_plugin/aws_sdk_v3/batch_get_item.rb, line 82 def successful_partially? @api_response.unprocessed_keys.present? end
unprocessed_ids(table)
click to toggle source
# File lib/dynamoid/adapter_plugin/aws_sdk_v3/batch_get_item.rb, line 86 def unprocessed_ids(table) # unprocessed_keys Hash contains as values instances of # Aws::DynamoDB::Types::KeysAndAttributes @api_response.unprocessed_keys[table.name].keys.map do |h| # If a table has a composite primary key then we need to return an array # of [hash key, range key]. Otherwise just return hash key's # value. if table.range_key.nil? h[table.hash_key.to_s] else [h[table.hash_key.to_s], h[table.range_key.to_s]] end end end
Private Instance Methods
item_to_hash(item)
click to toggle source
# File lib/dynamoid/adapter_plugin/aws_sdk_v3/batch_get_item.rb, line 110 def item_to_hash(item) item.symbolize_keys end