Class: PlayStationNetwork::Profile
- Inherits:
-
Object
- Object
- PlayStationNetwork::Profile
- Defined in:
- lib/playstationnetwork/profile.rb
Instance Attribute Summary collapse
-
#about ⇒ Object
Returns the value of attribute about.
-
#avatar ⇒ Object
Returns the value of attribute avatar.
-
#id ⇒ Object
Returns the value of attribute id.
-
#level ⇒ Object
Returns the value of attribute level.
-
#membership ⇒ Object
Returns the value of attribute membership.
-
#progress ⇒ Object
Returns the value of attribute progress.
-
#trophies ⇒ Object
Returns the value of attribute trophies.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id, avatar, username, about, membership, level, progress, trophies) ⇒ Profile
constructor
A new instance of Profile.
Constructor Details
#initialize(id, avatar, username, about, membership, level, progress, trophies) ⇒ Profile
Returns a new instance of Profile.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/playstationnetwork/profile.rb', line 12 def initialize(id, avatar, username, about, membership, level, progress, trophies) self.id = id self.avatar = avatar self.username = username self.about = about self.membership = membership self.level = level self.progress = progress self.trophies = trophies end |
Instance Attribute Details
#about ⇒ Object
Returns the value of attribute about.
3 4 5 |
# File 'lib/playstationnetwork/profile.rb', line 3 def about @about end |
#avatar ⇒ Object
Returns the value of attribute avatar.
3 4 5 |
# File 'lib/playstationnetwork/profile.rb', line 3 def avatar @avatar end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/playstationnetwork/profile.rb', line 3 def id @id end |
#level ⇒ Object
Returns the value of attribute level.
3 4 5 |
# File 'lib/playstationnetwork/profile.rb', line 3 def level @level end |
#membership ⇒ Object
Returns the value of attribute membership.
3 4 5 |
# File 'lib/playstationnetwork/profile.rb', line 3 def membership @membership end |
#progress ⇒ Object
Returns the value of attribute progress.
3 4 5 |
# File 'lib/playstationnetwork/profile.rb', line 3 def progress @progress end |
#trophies ⇒ Object
Returns the value of attribute trophies.
3 4 5 |
# File 'lib/playstationnetwork/profile.rb', line 3 def trophies @trophies end |
#username ⇒ Object
Returns the value of attribute username.
3 4 5 |
# File 'lib/playstationnetwork/profile.rb', line 3 def username @username end |
Class Method Details
.find(username) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/playstationnetwork/profile.rb', line 23 def self.find(username) response = PlayStationNetwork::API.get("/#{username}") if response.success? self.new( response['npId'], response['avatarUrl'], response['onlineId'], response['aboutMe'], response['plus'], response['trophySummary']['level'], response['trophySummary']['progress'], response['trophySummary']['earnedTrophies'] ) else raise response.response end end |