Sha256: 3a547e13b6e6c2838f2417e85f072443a973808bb3619e1c00a3a8448eef59e0
Contents?: true
Size: 1.69 KB
Versions: 3
Compression:
Stored size: 1.69 KB
Contents
module CampusBooks class Offer < Base SUPPORTED_PARAMS = [ :isbn, # The ISBN for this offer :isbn13, # The thirteen digit ISBN for this offer :isbn10, # The ten digit ISBN for this offer :merchant_id, # A numeric merchant ID (Note, this value may be signed) :merchant_name, # The Name of the merchant (looked up from the defined constants) :price, # The price that this merchant is listing this item for :shipping_ground, # The cost to ship to an address in the US via ground services :total_price, # Seller price plus the ground shipping price :link, # Link to purchase the book :condition_id, # Numeric representation of the condition (see constants) :condition_text, # Text representation of the condition :availability_id, # Numeric representation of the availability (how long it takes for the seller to ship it) :availability_text, # Text representation of the availability :location, # Geographic location where this item ships from (not always present) :their_id, # The merchant's id for this offer (not always present) :comments, # Comments about this offering :condition_text # Text representation of the condition ] attr_reader *SUPPORTED_PARAMS def initialize(params = {}) SUPPORTED_PARAMS.each do |param| instance_variable_set("@#{param}", params[param.to_s]) if params.key?(param.to_s) end end # Fall back on ISBN13 or ISBN10 if @isbn isn't set def isbn @isbn || @isbn13 || @isbn10 end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
mroch-campusbooks-0.1.0 | lib/campusbooks/offer.rb |
mroch-campusbooks-0.2.0 | lib/campusbooks/offer.rb |
campusbooks-0.2.0 | lib/campusbooks/offer.rb |