Class: GameRocket::Player

Inherits:
Object
  • Object
show all
Includes:
BaseModule
Defined in:
lib/gamerocket/player.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BaseModule

included

Methods included from BaseModule::Methods

#copy_instance_variables_from_object, #return_object_or_raise, #set_instance_variables_from_hash, #singleton_class

Constructor Details

#initialize(gateway, attributes) ⇒ Player

Returns a new instance of Player.



7
8
9
10
# File 'lib/gamerocket/player.rb', line 7

def initialize(gateway, attributes)
  @gateway = gateway
  set_instance_variables_from_hash(attributes) unless attributes.nil?
end

Instance Attribute Details

#dynPropObject

Returns the value of attribute dynProp.



5
6
7
# File 'lib/gamerocket/player.rb', line 5

def dynProp
  @dynProp
end

#emailHashObject

Returns the value of attribute emailHash.



5
6
7
# File 'lib/gamerocket/player.rb', line 5

def emailHash
  @emailHash
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/gamerocket/player.rb', line 5

def id
  @id
end

#localeObject

Returns the value of attribute locale.



5
6
7
# File 'lib/gamerocket/player.rb', line 5

def locale
  @locale
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/gamerocket/player.rb', line 5

def name
  @name
end

#totalPointsAchievementsObject

Returns the value of attribute totalPointsAchievements.



5
6
7
# File 'lib/gamerocket/player.rb', line 5

def totalPointsAchievements
  @totalPointsAchievements
end

Class Method Details

._attributesObject



45
46
47
48
49
# File 'lib/gamerocket/player.rb', line 45

def self._attributes
  [
    :id, :name, :emailHash, :totalPointsAchievements, :locale, :dynProp
  ]
end

._new(*args) ⇒ Object



41
42
43
# File 'lib/gamerocket/player.rb', line 41

def self._new(*args)
  self.new *args
end

.create(attributes = {}) ⇒ Object



12
13
14
# File 'lib/gamerocket/player.rb', line 12

def self.create(attributes = {})
  Configuration.gateway.player.create(attributes)
end

.delete(id) ⇒ Object



24
25
26
# File 'lib/gamerocket/player.rb', line 24

def self.delete(id)
  Configuration.gateway.player.delete(id)
end

.find(id) ⇒ Object



16
17
18
# File 'lib/gamerocket/player.rb', line 16

def self.find(id)
  Configuration.gateway.player.find(id)
end

.update(id, attributes) ⇒ Object



20
21
22
# File 'lib/gamerocket/player.rb', line 20

def self.update(id, attributes)
  Configuration.gateway.player.update(id, attributes)
end

Instance Method Details

#==(other) ⇒ Object



32
33
34
35
# File 'lib/gamerocket/player.rb', line 32

def ==(other)
  return false unless other.is_a?(Player)
  id == other.id
end

#deleteObject



28
29
30
# File 'lib/gamerocket/player.rb', line 28

def delete
  @gateway.player.delete(id)
end