lib/a2z/responses/item_search.rb in a2z-0.0.4 vs lib/a2z/responses/item_search.rb in a2z-0.1.0
- old
+ new
@@ -1,8 +1,10 @@
module A2z
module Responses
class ItemSearch
+ include Helpers
+
attr_accessor :operation_request, :items, :total_results, :total_pages, :more_search_results_url
def initialize
@items = []
@total_results = 0
@@ -33,11 +35,10 @@
end
private
def self.items_from_response(data)
- items = data['Items']['Item'] rescue []
- items = [items].compact unless items.kind_of?(Array)
+ items = array_wrap(data['Items']['Item']) rescue []
items.collect { |item| Item.from_response(item) }
end
end
end
end