Class: MysteryShopper::Game

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/mystery_shopper/game.rb

Instance Method Summary collapse

Methods included from Utils

#to_bool

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

Returns:

  • (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

Returns:

  • (Boolean)


74
75
76
# File 'lib/mystery_shopper/game.rb', line 74

def buy_online?
  @buy_online ||= to_bool(data.fetch('buyonline'))
end

#categoriesObject



14
15
16
# File 'lib/mystery_shopper/game.rb', line 14

def categories
  @categories ||= Array(data.dig('categories', 'category'))
end

#digital_download?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/mystery_shopper/game.rb', line 30

def digital_download?
  @digital_download ||= to_bool(data.fetch('digitaldownload'))
end

#discount_priceObject



82
83
84
# File 'lib/mystery_shopper/game.rb', line 82

def discount_price
  price_details.discount_price
end

#free_to_start?Boolean

Returns:

  • (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_artObject



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_codeObject



70
71
72
# File 'lib/mystery_shopper/game.rb', line 70

def game_code
  @game_code ||= data.fetch('game_code')
end

#idObject



50
51
52
# File 'lib/mystery_shopper/game.rb', line 50

def id
  @id ||= data.fetch('id')
end

#nsuidObject



58
59
60
# File 'lib/mystery_shopper/game.rb', line 58

def nsuid
  @nsuid ||= data['nsuid']
end

#number_of_playersObject



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_priceObject



78
79
80
# File 'lib/mystery_shopper/game.rb', line 78

def regular_price
  price_details.regular_price
end

#release_dateObject



26
27
28
# File 'lib/mystery_shopper/game.rb', line 26

def release_date
  @release_date ||= Date.parse(data.fetch('release_date'))
end

#sale_endObject



94
95
96
# File 'lib/mystery_shopper/game.rb', line 94

def sale_end
  price_details.sale_end
end

#sale_startObject



90
91
92
# File 'lib/mystery_shopper/game.rb', line 90

def sale_start
  price_details.sale_start
end

#sales_statusObject



86
87
88
# File 'lib/mystery_shopper/game.rb', line 86

def sales_status
  price_details.sales_status
end

#slugObject



42
43
44
# File 'lib/mystery_shopper/game.rb', line 42

def slug
  @slug ||= data.fetch('slug')
end

#systemObject



46
47
48
# File 'lib/mystery_shopper/game.rb', line 46

def system
  @system ||= data.fetch('system')
end

#titleObject



38
39
40
# File 'lib/mystery_shopper/game.rb', line 38

def title
  @title ||= data.fetch('title')
end

#urlObject



18
19
20
# File 'lib/mystery_shopper/game.rb', line 18

def url
  @url ||= "https://www.nintendo.com/games/detail/#{slug}"
end


62
63
64
# File 'lib/mystery_shopper/game.rb', line 62

def video_link
  @video_link ||= data['video_link']
end