Class: ApiBucket::Amazon::Response

Inherits:
Base::Response show all
Defined in:
lib/api_bucket/amazon/response.rb

Instance Attribute Summary

Attributes inherited from Base::Response

#count, #page

Instance Method Summary collapse

Methods inherited from Base::Response

#doc, #dump, #initialize

Constructor Details

This class inherits a constructor from ApiBucket::Base::Response

Instance Method Details

#first_itemObject



9
10
11
# File 'lib/api_bucket/amazon/response.rb', line 9

def first_item
  @items[0]
end

#item_pageObject

Return current page no if :item_page option is when initiating the request.



14
15
16
# File 'lib/api_bucket/amazon/response.rb', line 14

def item_page
  @item_page ||= ApiBucket::Base::Element.get(@doc, "//ItemPage").to_i
end

#itemsObject



5
6
7
# File 'lib/api_bucket/amazon/response.rb', line 5

def items
  @items ||= (@doc/"Item").collect { |item| ApiBucket::Amazon::Item.new(item) }
end

#total_pagesObject

Return total pages.



24
25
26
# File 'lib/api_bucket/amazon/response.rb', line 24

def total_pages
  @total_pages ||= ApiBucket::Base::Element.get(@doc, "//TotalPages").to_i
end

#total_resultsObject

Return total results.



19
20
21
# File 'lib/api_bucket/amazon/response.rb', line 19

def total_results
  @total_results ||= ApiBucket::Base::Element.get(@doc, "//TotalResults").to_i
end