Class: SteamDailyDeals::Deal

Inherits:
Object
  • Object
show all
Defined in:
lib/steam_daily_deals/deal.rb

Overview

Deal Class

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(deal) ⇒ Deal

Returns a new instance of Deal.



17
18
19
20
21
22
23
# File 'lib/steam_daily_deals/deal.rb', line 17

def initialize(deal)
  deal.each do |key, value|
    send("#{key}=", value)
  end

  @@all << self
end

Instance Attribute Details

#app_urlObject

Returns the value of attribute app_url.



3
4
5
# File 'lib/steam_daily_deals/deal.rb', line 3

def app_url
  @app_url
end

#availibilityObject

Returns the value of attribute availibility.



3
4
5
# File 'lib/steam_daily_deals/deal.rb', line 3

def availibility
  @availibility
end

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/steam_daily_deals/deal.rb', line 3

def description
  @description
end

#final_priceObject

Returns the value of attribute final_price.



3
4
5
# File 'lib/steam_daily_deals/deal.rb', line 3

def final_price
  @final_price
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/steam_daily_deals/deal.rb', line 3

def name
  @name
end

#overall_ratingObject

Returns the value of attribute overall_rating.



3
4
5
# File 'lib/steam_daily_deals/deal.rb', line 3

def overall_rating
  @overall_rating
end

Returns the value of attribute popular_tags.



3
4
5
# File 'lib/steam_daily_deals/deal.rb', line 3

def popular_tags
  @popular_tags
end

#recent_ratingObject

Returns the value of attribute recent_rating.



3
4
5
# File 'lib/steam_daily_deals/deal.rb', line 3

def recent_rating
  @recent_rating
end

#recent_reviewsObject

Returns the value of attribute recent_reviews.



3
4
5
# File 'lib/steam_daily_deals/deal.rb', line 3

def recent_reviews
  @recent_reviews
end

#release_dateObject

Returns the value of attribute release_date.



3
4
5
# File 'lib/steam_daily_deals/deal.rb', line 3

def release_date
  @release_date
end

#total_reviewsObject

Returns the value of attribute total_reviews.



3
4
5
# File 'lib/steam_daily_deals/deal.rb', line 3

def total_reviews
  @total_reviews
end

Class Method Details

.allObject



39
40
41
# File 'lib/steam_daily_deals/deal.rb', line 39

def self.all
  @@all
end

.create_from_collection(deals) ⇒ Object



25
26
27
# File 'lib/steam_daily_deals/deal.rb', line 25

def self.create_from_collection(deals)
  deals.each { |deal| new(deal) }
end

.find_deal(index) ⇒ Object



29
30
31
# File 'lib/steam_daily_deals/deal.rb', line 29

def self.find_deal(index)
  self.all[index - 1]
end

Instance Method Details

#add_deal_information(deal_info) ⇒ Object



33
34
35
36
37
# File 'lib/steam_daily_deals/deal.rb', line 33

def add_deal_information(deal_info)
  deal_info.each do |key, value|
    send("#{key}=", value)
  end
end