Method: Dynamini::TestClient#get_item

Defined in:
lib/dynamini/test_client.rb

#get_item(args = {}) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
# File 'lib/dynamini/test_client.rb', line 60

def get_item(args = {})
  table = get_table(args[:table_name])

  hash_key_value = args[:key][hash_key_attr]
  range_key_value = args[:key][range_key_attr]

  attributes_hash = table[hash_key_value]
  attributes_hash = attributes_hash[range_key_value] if attributes_hash && range_key_value

  OpenStruct.new(item: (attributes_hash ? attributes_hash.deep_dup : nil))
end