Class: AWS::SimpleDB::ItemData

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/simple_db/item_data.rb

Overview

Holds the data for a SimpleDB item. While Item only proxies requests to return data, this class actually stores data returned by a query. For example, you can use this to get the list of items whose titles are palindromes using only a single request to SimpleDB (not counting pagination):

items.enum_for(:select).
  select { |data| data.title == data.title.to_s.reverse }.
  map { |data| data.item }

The AWS::SimpleDB::ItemCollection#select call yields instances of ItemData, and the map call in the example above gets the list of corresponding Item instances.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attributesHash (readonly)

Returns A hash of attribute names to arrays of values.

Returns:

  • (Hash)

    A hash of attribute names to arrays of values.



57
58
59
# File 'lib/aws/simple_db/item_data.rb', line 57

def attributes
  @attributes
end

#domainDomain (readonly)

Returns The domain from which the item data was retrieved.

Returns:

  • (Domain)

    The domain from which the item data was retrieved.



60
61
62
# File 'lib/aws/simple_db/item_data.rb', line 60

def domain
  @domain
end

#nameString (readonly)

Returns The item name.

Returns:

  • (String)

    The item name.



54
55
56
# File 'lib/aws/simple_db/item_data.rb', line 54

def name
  @name
end

Instance Method Details

#itemItem

Returns the AWS::SimpleDB::Item corresponding to this ItemData; you can use this to perform further operations on the item, or to fetch its most recent data.

Returns:

  • (Item)

    The item this data belongs to.



66
67
68
# File 'lib/aws/simple_db/item_data.rb', line 66

def item
  domain.items[name]
end