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
- #badges ⇒ Object
- #events(start_time = nil, end_time = nil) ⇒ Object
- #items_from_sets ⇒ Object
- #levels ⇒ Object
- #play(action) ⇒ Object
- #players_leaderboards ⇒ Object
- #points ⇒ Object
- #reload! ⇒ 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
#badges ⇒ Object
39 40 41 |
# File 'lib/playlyfe_client/player.rb', line 39 def badges self.items_from_sets end |
#events(start_time = nil, end_time = nil) ⇒ Object
75 76 77 |
# File 'lib/playlyfe_client/player.rb', line 75 def events(start_time=nil,end_time=nil) [] end |
#items_from_sets ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/playlyfe_client/player.rb', line 28 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
59 60 61 |
# File 'lib/playlyfe_client/player.rb', line 59 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
67 68 69 |
# File 'lib/playlyfe_client/player.rb', line 67 def players_leaderboards [] end |
#points ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/playlyfe_client/player.rb', line 43 def points points=[] self.scores[:points].each_pair do | key, value | points << {count: value, metric_id: key.to_s} end points end |
#reload! ⇒ Object
20 21 22 |
# File 'lib/playlyfe_client/player.rb', line 20 def reload! nil end |
#scores ⇒ Object
24 25 26 |
# File 'lib/playlyfe_client/player.rb', line 24 def scores {points: {} ,sets: {}, states: {}, compound: {}} end |
#states ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/playlyfe_client/player.rb', line 51 def states states=[] self.scores[:states].each_pair do | key, value | states << {name: value, metric_id: key.to_s} end states end |
#teams ⇒ Object
63 64 65 |
# File 'lib/playlyfe_client/player.rb', line 63 def teams [] end |
#teams_leaderboards ⇒ Object
71 72 73 |
# File 'lib/playlyfe_client/player.rb', line 71 def teams_leaderboards [] end |