Sha256: 2fb49144d9fea6306a08f301b46c5922bd6ab67dbb90318c63992d25fe4b211b

Contents?: true

Size: 624 Bytes

Versions: 8

Compression:

Stored size: 624 Bytes

Contents

module GnipApi
  module Apis
    module PowerTrack
      class Rule
        attr_accessor :value, :tag

        def initialize params={}
          @value = params[:value] || params['value']
          @tag = params[:tag] || params['tag']
        end

        def to_json
          attributes.to_json
        end

        def attributes
          attrs = {}
          attrs[:value] = @value if @value
          attrs[:tag] = @tag if @tag
          attrs
        end

        def uid
          rule = @value
          rule += "tag:#{@tag}" if @tag
          Digest::SHA2.hexdigest(rule)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gnip_api-0.0.9 lib/gnip_api/apis/power_track/rule.rb
gnip_api-0.0.8 lib/gnip_api/apis/power_track/rule.rb
gnip_api-0.0.7 lib/gnip_api/apis/power_track/rule.rb
gnip_api-0.0.6 lib/gnip_api/apis/power_track/rule.rb
gnip_api-0.0.5 lib/gnip_api/apis/power_track/rule.rb
gnip_api-0.0.4 lib/gnip_api/apis/power_track/rule.rb
gnip_api-0.0.3 lib/gnip_api/apis/power_track/rule.rb
gnip_api-0.0.2 lib/gnip_api/apis/power_track/rule.rb