Class: MysteryShopper::Game
- Inherits:
-
Object
- Object
- MysteryShopper::Game
- Includes:
- Utils
- Defined in:
- lib/mystery_shopper/game.rb
Instance Method Summary collapse
- #buy_it_now? ⇒ Boolean
- #buy_online? ⇒ Boolean
- #categories ⇒ Object
- #digital_download? ⇒ Boolean
- #discount_price ⇒ Object
- #free_to_start? ⇒ Boolean
- #front_box_art ⇒ Object
- #game_code ⇒ Object
- #id ⇒ Object
-
#initialize(data) ⇒ Game
constructor
A new instance of Game.
- #nsuid ⇒ Object
- #number_of_players ⇒ Object
- #regular_price ⇒ Object
- #release_date ⇒ Object
- #sale_end ⇒ Object
- #sale_start ⇒ Object
- #sales_status ⇒ Object
- #slug ⇒ Object
- #system ⇒ Object
- #title ⇒ Object
- #url ⇒ Object
- #video_link ⇒ Object
Methods included from Utils
Constructor Details
#initialize(data) ⇒ Game
Returns a new instance of Game.
10 11 12 |
# File 'lib/mystery_shopper/game.rb', line 10 def initialize(data) @data = data end |
Instance Method Details
#buy_it_now? ⇒ Boolean
22 23 24 |
# File 'lib/mystery_shopper/game.rb', line 22 def buy_it_now? @buy_it_now ||= to_bool(data.fetch('buyitnow')) end |
#buy_online? ⇒ Boolean
74 75 76 |
# File 'lib/mystery_shopper/game.rb', line 74 def buy_online? @buy_online ||= to_bool(data.fetch('buyonline')) end |
#categories ⇒ Object
14 15 16 |
# File 'lib/mystery_shopper/game.rb', line 14 def categories @categories ||= Array(data.dig('categories', 'category')) end |
#digital_download? ⇒ Boolean
30 31 32 |
# File 'lib/mystery_shopper/game.rb', line 30 def digital_download? @digital_download ||= to_bool(data.fetch('digitaldownload')) end |
#discount_price ⇒ Object
82 83 84 |
# File 'lib/mystery_shopper/game.rb', line 82 def discount_price price_details.discount_price end |
#free_to_start? ⇒ Boolean
34 35 36 |
# File 'lib/mystery_shopper/game.rb', line 34 def free_to_start? @free_to_start ||= to_bool(data.fetch('free_to_start')) end |
#front_box_art ⇒ Object
66 67 68 |
# File 'lib/mystery_shopper/game.rb', line 66 def front_box_art @front_box_art ||= data.fetch('front_box_art') end |
#game_code ⇒ Object
70 71 72 |
# File 'lib/mystery_shopper/game.rb', line 70 def game_code @game_code ||= data.fetch('game_code') end |
#id ⇒ Object
50 51 52 |
# File 'lib/mystery_shopper/game.rb', line 50 def id @id ||= data.fetch('id') end |
#nsuid ⇒ Object
58 59 60 |
# File 'lib/mystery_shopper/game.rb', line 58 def nsuid @nsuid ||= data['nsuid'] end |
#number_of_players ⇒ Object
54 55 56 |
# File 'lib/mystery_shopper/game.rb', line 54 def number_of_players @number_of_players ||= data.fetch('number_of_players') end |
#regular_price ⇒ Object
78 79 80 |
# File 'lib/mystery_shopper/game.rb', line 78 def regular_price price_details.regular_price end |
#release_date ⇒ Object
26 27 28 |
# File 'lib/mystery_shopper/game.rb', line 26 def release_date @release_date ||= Date.parse(data.fetch('release_date')) end |
#sale_end ⇒ Object
94 95 96 |
# File 'lib/mystery_shopper/game.rb', line 94 def sale_end price_details.sale_end end |
#sale_start ⇒ Object
90 91 92 |
# File 'lib/mystery_shopper/game.rb', line 90 def sale_start price_details.sale_start end |
#sales_status ⇒ Object
86 87 88 |
# File 'lib/mystery_shopper/game.rb', line 86 def sales_status price_details.sales_status end |
#slug ⇒ Object
42 43 44 |
# File 'lib/mystery_shopper/game.rb', line 42 def slug @slug ||= data.fetch('slug') end |
#system ⇒ Object
46 47 48 |
# File 'lib/mystery_shopper/game.rb', line 46 def system @system ||= data.fetch('system') end |
#title ⇒ Object
38 39 40 |
# File 'lib/mystery_shopper/game.rb', line 38 def title @title ||= data.fetch('title') end |
#url ⇒ Object
18 19 20 |
# File 'lib/mystery_shopper/game.rb', line 18 def url @url ||= "https://www.nintendo.com/games/detail/#{slug}" end |
#video_link ⇒ Object
62 63 64 |
# File 'lib/mystery_shopper/game.rb', line 62 def video_link @video_link ||= data['video_link'] end |