Class: Gnip::GnipData
Constant Summary
Constants inherited from Message
Instance Attribute Summary collapse
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#matching_rules ⇒ Object
readonly
Returns the value of attribute matching_rules.
-
#urls ⇒ Object
readonly
Returns the value of attribute urls.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ GnipData
constructor
A new instance of GnipData.
- #original_attributes ⇒ Object
- #to_json ⇒ Object
Methods inherited from Message
#activity?, build, #error?, #generate_json, #info?, #system_message?, #warn?
Constructor Details
permalink #initialize(params = {}) ⇒ GnipData
Returns a new instance of GnipData.
5 6 7 8 9 |
# File 'lib/gnip_api/gnip/gnip_data.rb', line 5 def initialize params={} @matching_rules = params['matching_rules'].map{|r| GnipApi::Apis::PowerTrack::Rule.new(r)} if params['matching_rules'] @urls = (params['urls'] ? params['urls'].map{|u| Gnip::Url.new(u)} : []) @language = params['language'] end |
Instance Attribute Details
permalink #language ⇒ Object (readonly)
Returns the value of attribute language.
3 4 5 |
# File 'lib/gnip_api/gnip/gnip_data.rb', line 3 def language @language end |
permalink #matching_rules ⇒ Object (readonly)
Returns the value of attribute matching_rules.
3 4 5 |
# File 'lib/gnip_api/gnip/gnip_data.rb', line 3 def matching_rules @matching_rules end |
permalink #urls ⇒ Object (readonly)
Returns the value of attribute urls.
3 4 5 |
# File 'lib/gnip_api/gnip/gnip_data.rb', line 3 def urls @urls end |
Instance Method Details
permalink #original_attributes ⇒ Object
[View source]
11 12 13 14 15 16 17 |
# File 'lib/gnip_api/gnip/gnip_data.rb', line 11 def original_attributes { :matching_rules => @matching_rules.map(&:attributes), :urls => @urls.map(&:original_attributes), :language => @language }.delete_if{|k,v| v.nil?} end |
permalink #to_json ⇒ Object
[View source]
19 20 21 |
# File 'lib/gnip_api/gnip/gnip_data.rb', line 19 def to_json generate_json(original_attributes) end |