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