Class: AwsSdb::Response::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/aws_sdb_bare/response.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(doc) ⇒ Base

Returns a new instance of Base.



60
61
62
# File 'lib/aws_sdb_bare/response.rb', line 60

def initialize(doc)
  @doc = doc
end

Class Method Details

.has_itemsObject



47
48
49
50
51
52
53
54
55
56
# File 'lib/aws_sdb_bare/response.rb', line 47

def has_items
  define_method :items do
    @items ||= begin
      (@doc / 'Item').inject({}) do |items_hash, item|
        items_hash[item.at('Name').inner_html] = attributes_hash(item)
        items_hash
      end
    end
  end
end

.registerObject



43
44
45
# File 'lib/aws_sdb_bare/response.rb', line 43

def register
  Response::MEMBERS[to_s.split(':').pop + 'Response'] = self 
end

Instance Method Details

#metadataObject



64
65
66
# File 'lib/aws_sdb_bare/response.rb', line 64

def 
  @metadata ||= Metadata.new(@doc.at('ResponseMetadata'))
end

#tokenObject

the token to get the following chunk of response in case the response is broken in parts due to the size limit being exceeded



70
71
72
73
74
# File 'lib/aws_sdb_bare/response.rb', line 70

def token
  if token_element = @doc.at('NextToken')
    token_element.inner_html
  end
end