Class: PlaylyfeClient::Player
- Inherits:
-
Object
- Object
- PlaylyfeClient::Player
- Defined in:
- lib/playlyfe_client/player.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#game ⇒ Object
readonly
Returns the value of attribute game.
Class Method Summary collapse
Instance Method Summary collapse
- #activities(start_time = nil, end_time = nil) ⇒ Object
- #badges ⇒ Object
- #items_from_sets ⇒ Object
- #levels ⇒ Object
- #play(action) ⇒ Object
- #players_leaderboards ⇒ Object
- #points ⇒ Object
- #scores ⇒ Object
- #states ⇒ Object
- #teams ⇒ Object
- #teams_leaderboards ⇒ Object
Instance Attribute Details
#game ⇒ Object (readonly)
Returns the value of attribute game.
6 7 8 |
# File 'lib/playlyfe_client/player.rb', line 6 def game @game end |
Class Method Details
.all(game) ⇒ Object
12 13 14 |
# File 'lib/playlyfe_client/player.rb', line 12 def self.all(game) game.players end |
.create(player_hash, game) ⇒ Object
8 9 10 |
# File 'lib/playlyfe_client/player.rb', line 8 def self.create(player_hash, game) nil end |
Instance Method Details
#activities(start_time = nil, end_time = nil) ⇒ Object
71 72 73 |
# File 'lib/playlyfe_client/player.rb', line 71 def activities(start_time=nil,end_time=nil) [] end |
#badges ⇒ Object
35 36 37 |
# File 'lib/playlyfe_client/player.rb', line 35 def badges self.items_from_sets end |
#items_from_sets ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/playlyfe_client/player.rb', line 24 def items_from_sets items=[] self.scores[:sets].each_pair do | key, value | value.each do |item_h| items << item_h.merge({metric_id: key.to_s}) if item_h[:count] > 0 end end items.sort! {|a,b| a[:name] <=> b[:name]} items end |
#levels ⇒ Object
55 56 57 |
# File 'lib/playlyfe_client/player.rb', line 55 def levels self.states end |
#play(action) ⇒ Object
16 17 18 |
# File 'lib/playlyfe_client/player.rb', line 16 def play(action) false end |
#players_leaderboards ⇒ Object
63 64 65 |
# File 'lib/playlyfe_client/player.rb', line 63 def players_leaderboards [] end |
#points ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/playlyfe_client/player.rb', line 39 def points points=[] self.scores[:points].each_pair do | key, value | points << {count: value, metric_id: key.to_s} end points end |
#scores ⇒ Object
20 21 22 |
# File 'lib/playlyfe_client/player.rb', line 20 def scores {points: {} ,sets: {}, states: {}, compound: {}} end |
#states ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/playlyfe_client/player.rb', line 47 def states states=[] self.scores[:states].each_pair do | key, value | states << {name: value, metric_id: key.to_s} end states end |
#teams ⇒ Object
59 60 61 |
# File 'lib/playlyfe_client/player.rb', line 59 def teams [] end |
#teams_leaderboards ⇒ Object
67 68 69 |
# File 'lib/playlyfe_client/player.rb', line 67 def teams_leaderboards [] end |