Sha256: 4faf1f5cef73c58747b41971b3a20a64550550341dd4c681ca2e4dafd57c6a84

Contents?: true

Size: 637 Bytes

Versions: 5

Compression:

Stored size: 637 Bytes

Contents

module Kosher

  # The seller offering a book on a venue.
  #
  # A seller may have a location.
  class Seller < Structure
    include Threshold

    key     :id
    key     :name
    key     :rating, :type => Float
    has_one :location

    # Returns whether we blacklist the seller.
    def blacklisted?
      Kosher.seller_blacklist.include? id
    end

    # Returns whether the seller is kosher.
    #
    # A seller is kosher as long as he is not blacklisted and his rating is
    # unknown, 0.0, or above our minimum threshold.
    def kosher?
      !blacklisted? && (rating.to_f == 0.0 || rating >= threshold)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kosher-0.8.0 lib/kosher/seller.rb
kosher-0.7.0 lib/kosher/seller.rb
kosher-0.6.2 lib/kosher/seller.rb
kosher-0.6.1 lib/kosher/seller.rb
kosher-0.6.0 lib/kosher/seller.rb