Class: PlayStationNetwork::U::Games
- Inherits:
-
Object
- Object
- PlayStationNetwork::U::Games
- Defined in:
- lib/playstationnetwork/u/games.rb
Instance Attribute Summary collapse
-
#games ⇒ Object
Returns the value of attribute games.
-
#total_games ⇒ Object
Returns the value of attribute total_games.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(total_games, games) ⇒ Games
constructor
A new instance of Games.
Constructor Details
#initialize(total_games, games) ⇒ Games
Returns a new instance of Games.
7 8 9 10 |
# File 'lib/playstationnetwork/u/games.rb', line 7 def initialize(total_games, games) self.total_games = total_games self.games = games end |
Instance Attribute Details
#games ⇒ Object
Returns the value of attribute games.
5 6 7 |
# File 'lib/playstationnetwork/u/games.rb', line 5 def games @games end |
#total_games ⇒ Object
Returns the value of attribute total_games.
5 6 7 |
# File 'lib/playstationnetwork/u/games.rb', line 5 def total_games @total_games end |
Class Method Details
.all(psn_user_id) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/playstationnetwork/u/games.rb', line 12 def self.all(psn_user_id) = PlayStationNetwork::API.config.merge({ user_id: psn_user_id }) response = PlayStationNetwork::API.post('/psnGetUserGames', body: ) if response.success? parsed = JSON.parse(response) new( parsed['games'].size, parsed['games'] ) else raise response.response end end |