class PlaylyfeClient::V2::PointMetric

Public Class Methods

new(metric_hash, game) click to toggle source
Calls superclass method PlaylyfeClient::V2::Metric::new
# File lib/playlyfe_client/v2/metric/point_metric.rb, line 21
def initialize(metric_hash, game)
  super(metric_hash, game)
end

Public Instance Methods

apply_reward(reward, scores) click to toggle source
# 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