Class: GnipApi::Apis::PowerTrack::Rule
- Inherits:
-
Object
- Object
- GnipApi::Apis::PowerTrack::Rule
- Defined in:
- lib/gnip_api/apis/power_track/rule.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#tag ⇒ Object
Returns the value of attribute tag.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(params = {}) ⇒ Rule
constructor
A new instance of Rule.
- #to_json ⇒ Object
- #uid ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Rule
Returns a new instance of Rule.
7 8 9 10 11 |
# File 'lib/gnip_api/apis/power_track/rule.rb', line 7 def initialize params={} @value = params[:value] || params['value'] @tag = params[:tag] || params['tag'] @id = params[:id] || params['id'] end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/gnip_api/apis/power_track/rule.rb', line 5 def id @id end |
#tag ⇒ Object
Returns the value of attribute tag.
5 6 7 |
# File 'lib/gnip_api/apis/power_track/rule.rb', line 5 def tag @tag end |
#value ⇒ Object
Returns the value of attribute value.
5 6 7 |
# File 'lib/gnip_api/apis/power_track/rule.rb', line 5 def value @value end |
Instance Method Details
#attributes ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/gnip_api/apis/power_track/rule.rb', line 17 def attributes attrs = {} attrs[:value] = @value if @value attrs[:tag] = @tag if @tag attrs[:id] = @id if @id attrs end |
#to_json ⇒ Object
13 14 15 |
# File 'lib/gnip_api/apis/power_track/rule.rb', line 13 def to_json attributes.to_json end |
#uid ⇒ Object
25 26 27 28 29 |
# File 'lib/gnip_api/apis/power_track/rule.rb', line 25 def uid rule = @value rule += "tag:#{@tag}" if @tag Digest::SHA2.hexdigest(rule) end |