Sha256: ec52fa2b499b912572f42ae8ce9b4a1db6f74057fbf04e4ab291e7b63f53dc1c

Contents?: true

Size: 621 Bytes

Versions: 10

Compression:

Stored size: 621 Bytes

Contents

require_relative "../metric.rb"

module PlaylyfeClient
  module V2
    class PointMetric < PlaylyfeClient::V2::Metric

      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

      private 
      
        def initialize(metric_hash, game)
          super(metric_hash, game)
        end  

    end
  end
end  

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
playlyfe_client-1.1.6 lib/playlyfe_client/v2/metric/point_metric.rb
playlyfe_client-1.1.5 lib/playlyfe_client/v2/metric/point_metric.rb
playlyfe_client-1.1.3 lib/playlyfe_client/v2/metric/point_metric.rb
playlyfe_client-1.1.2 lib/playlyfe_client/v2/metric/point_metric.rb
playlyfe_client-1.1.1 lib/playlyfe_client/v2/metric/point_metric.rb
playlyfe_client-1.1.0 lib/playlyfe_client/v2/metric/point_metric.rb
playlyfe_client-1.0.6 lib/playlyfe_client/v2/metric/point_metric.rb
playlyfe_client-1.0.5 lib/playlyfe_client/v2/metric/point_metric.rb
playlyfe_client-1.0.4 lib/playlyfe_client/v2/metric/point_metric.rb
playlyfe_client-1.0.2 lib/playlyfe_client/v2/metric/point_metric.rb