Class: PlayStationNetwork::Game
- Defined in:
- lib/playstationnetwork/game.rb
Instance Attribute Summary
Attributes inherited from API
Instance Method Summary collapse
- #all(platform: 'all', popular: false) ⇒ Object
- #details ⇒ Object
-
#initialize(npcommid = '') ⇒ Game
constructor
A new instance of Game.
- #trophies ⇒ Object
Methods inherited from API
Constructor Details
#initialize(npcommid = '') ⇒ Game
Returns a new instance of Game.
9 10 11 12 13 14 15 16 |
# File 'lib/playstationnetwork/game.rb', line 9 def initialize(npcommid = '') raise INVALID_NPCOMMID_TYPE unless npcommid.is_a?(String) super unless npcommid.empty? [:npcommid] = npcommid end end |
Instance Method Details
#all(platform: 'all', popular: false) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/playstationnetwork/game.rb', line 26 def all(platform: 'all', popular: false) raise INVALID_PLATFORM_TYPE unless platform.is_a?(String) raise INVALID_PLATFORM_TYPE unless GAMES_PARAMETERS_TYPES.include?(platform) raise INVALID_POPULAR_TYPE unless popular.is_a?(FalseClass) || popular.is_a?(TrueClass) if popular [:list] = platform url = '/psnPopularThisWeek' else [:platform] = platform url = '/psnListGames' end post(url, dig_to: ['psn_api', 'game'], xml: true) end |
#details ⇒ Object
18 19 20 |
# File 'lib/playstationnetwork/game.rb', line 18 def details post('/psnGetGame') end |
#trophies ⇒ Object
22 23 24 |
# File 'lib/playstationnetwork/game.rb', line 22 def trophies post('/psnGetTrophies') end |