Class: Shoppr::GeneralSearchResponse
- Inherits:
-
Object
- Object
- Shoppr::GeneralSearchResponse
- Defined in:
- lib/shoppr/general_search_response.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ GeneralSearchResponse
constructor
A new instance of GeneralSearchResponse.
Constructor Details
#initialize(options = {}) ⇒ GeneralSearchResponse
Returns a new instance of GeneralSearchResponse.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/shoppr/general_search_response.rb', line 4 def initialize(={}) response = Shoppr::Client.get('/GeneralSearch', :query => ) h = Hashie::Mash.new(response["GeneralSearchResponse"]) Shoppr.map_mash_attrs(self, h) if self.categories.category.is_a?(Array) @categories = self.categories.category.map {|category| Category.new(category) } else @categories = [Category.new(self.categories.category)] end if self.exceptions.exception.is_a?(Array) @exceptions = self.exceptions.exception.map {|exception| APIException.new(exception) } else @exceptions = [APIException.new(self.exceptions.exception)] end @server_detail = ServerDetail.new(self.server_detail) @client_tracking = ClientTracking.new(self.client_tracking) @related_terms = self. ? self..term : [] @search_history = SearchHistory.new(self.search_history) end |