Class: Flox::Score
- Inherits:
-
Object
- Object
- Flox::Score
- Defined in:
- lib/flox/score.rb
Overview
Provides information about the value and origin of one posted score entry.
Instance Attribute Summary collapse
-
#country ⇒ String
readonly
The country from which the score originated, in a two-letter country code.
-
#created_at ⇒ Time
readonly
The date at which the score was posted.
-
#player_id ⇒ String
readonly
The ID of the player who posted the score.
-
#player_name ⇒ String
readonly
The name of the player who posted the score.
-
#value ⇒ Fixnum
readonly
The actual score.
Instance Method Summary collapse
-
#initialize(data) ⇒ Score
constructor
A new instance of Score.
Constructor Details
#initialize(data) ⇒ Score
Returns a new instance of Score.
26 27 28 29 30 31 32 |
# File 'lib/flox/score.rb', line 26 def initialize(data) @player_id = data[:playerId].to_s @player_name = data[:playerName].to_s @value = data[:value].to_i @country = data[:country].to_s @created_at = Time.parse(data[:createdAt].to_s) end |
Instance Attribute Details
#country ⇒ String (readonly)
Returns the country from which the score originated, in a two-letter country code.
20 21 22 |
# File 'lib/flox/score.rb', line 20 def country @country end |
#created_at ⇒ Time (readonly)
Returns the date at which the score was posted.
23 24 25 |
# File 'lib/flox/score.rb', line 23 def created_at @created_at end |
#player_id ⇒ String (readonly)
Returns the ID of the player who posted the score. Note that this could be a guest player unknown to the server.
10 11 12 |
# File 'lib/flox/score.rb', line 10 def player_id @player_id end |
#player_name ⇒ String (readonly)
Returns the name of the player who posted the score.
13 14 15 |
# File 'lib/flox/score.rb', line 13 def player_name @player_name end |
#value ⇒ Fixnum (readonly)
Returns the actual score.
16 17 18 |
# File 'lib/flox/score.rb', line 16 def value @value end |