Sha256: e182a1958d77256ed73ac715cdc6cad8d9807be0b7872b60e2d74092720f2bb4

Contents?: true

Size: 800 Bytes

Versions: 4

Compression:

Stored size: 800 Bytes

Contents

require 'happymapper'

module Cafepress
  module Search
    class SearchResultSet
      include HappyMapper
      tag 'searchResultSet'

      attribute :size, Integer, :tag => 'resultLength'
      attribute :total_designs, Integer, :tag => 'totalDesigns'
      attribute :total_products, Integer, :tag => 'totalProducts'
      attribute :start_index, Integer, :tag => 'startResult'
      attribute :sort, String

      element :subtopics, String
      element :searchQuery, String
    
      has_many :results, SearchResult
    
      def topics
        @topics ||= subtopics.split("\n").inject([]) do |groomed, topic|
          groomed << topic.strip unless topic.strip == ""
          groomed
        end
      end

      def query
        @query ||= searchQuery.strip
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cafepress-search-1.1.0 lib/cafepress/search/search_result_set.rb
cafepress-search-1.0.2 lib/cafepress/search/search_result_set.rb
cafepress-search-1.0.1 lib/cafepress/search/search_result_set.rb
cafepress-search-1.0.0 lib/cafepress/search/search_result_set.rb