class PopularDeals::NewDeals

Attributes

deal_rating[RW]
discription[RW]
name[RW]
number[RW]
posted[RW]
price[RW]
purchase[RW]
title[RW]
url[RW]

Public Class Methods

all() click to toggle source
# File lib/popular_deals/newdeals.rb, line 11
def self.all
  @@all
end
deals() click to toggle source
# File lib/popular_deals/newdeals.rb, line 22
def self.deals
  all_deals = @@all
  deals = []
  all_deals.collect do |deal_info|
    deal_info.number = all_deals.index(deal_info).to_i + 1
    deals << deal_info
  end
  deals
end
open_deal_page(base_url, input) click to toggle source
# File lib/popular_deals/newdeals.rb, line 15
def self.open_deal_page(base_url, input)
  index = input.to_i - 1
  deals = self.all
  product_url = "#{deals[index].url}"
  product_url
end

Public Instance Methods

save() click to toggle source
# File lib/popular_deals/newdeals.rb, line 7
def save
  @@all << self
end