Class: PlaylyfeClient::V2::PointMetric

Inherits:
Metric show all
Defined in:
lib/playlyfe_client/v2/metric/point_metric.rb

Instance Attribute Summary

Attributes inherited from Metric

#description, #id, #name, #type

Attributes inherited from Metric

#game

Instance Method Summary collapse

Methods inherited from Metric

create_from

Instance Method Details

#apply_reward(reward, scores) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/playlyfe_client/v2/metric/point_metric.rb', line 7

def apply_reward(reward, scores)
  metric_sym=self.id.to_sym
  case reward[:verb]
    when "add"
     scores[:points][metric_sym]+=reward[:value].to_i
    when "remove"
     scores[:points][metric_sym]-=reward[:value].to_i
    when "set"
     scores[:points][metric_sym]=reward[:value].to_i
  end
end