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