Sha256: 333ef7253e8f1bad222c5f9331aef3d2033c90eba4b2d1508028cfc0fbfec68e

Contents?: true

Size: 641 Bytes

Versions: 3

Compression:

Stored size: 641 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
    key :location, :type => Structure

    # 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

3 entries across 3 versions & 1 rubygems

Version Path
kosher-0.5.0 lib/kosher/seller.rb
kosher-0.4.0 lib/kosher/seller.rb
kosher-0.3.0 lib/kosher/seller.rb