class BookDeals::Book

book on the deal

Attributes

author[RW]
categories[RW]
deal[RW]
description[RW]
purchase_url[RW]
title[RW]

Public Class Methods

new(deal, title, author, purchase_url, description = nil) click to toggle source
# File lib/book_deals/book.rb, line 7
def initialize(deal, title, author, purchase_url, description = nil)
  self.title = title
  self.author = author
  self.purchase_url = purchase_url
  self.description = description
  self.categories = []
  self.deal = deal
end

Public Instance Methods

to_s() click to toggle source
# File lib/book_deals/book.rb, line 16
    def to_s
      <<-DETAILS.gsub /^ */, ''
      #{"Book Title:".colorize(:yellow)} #{self.title} \n
      #{"Author:".colorize(:yellow)}  #{self.author} \n
      #{"Description:".colorize(:yellow)} #{self.description} \n
      #{"Deal Price:".colorize(:yellow)} #{self.deal.price} \n
      #{"Original Price:".colorize(:yellow)} #{self.deal.original_price} \n
      #{"Expires in:".colorize(:yellow)} #{self.deal.expires_in} \n
      #{"This book can be purchased on:".colorize(:yellow)} #{self.purchase_url.colorize(:magenta)} \n
      ==============================================================================
      DETAILS
    end