Class: FacebookTopics::Insight

Inherits:
Object
  • Object
show all
Defined in:
lib/facebook_topics/results/insight.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(results = {}) ⇒ Insight

Returns a new instance of Insight.



5
6
7
8
9
# File 'lib/facebook_topics/results/insight.rb', line 5

def initialize(results = {})
  raise RuntimeError.new results["error"]["message"] if results.has_key? "error"
  @volume = results["data"].first["mentions"]["data"].shift["count"].to_i rescue 0
  @breakdown = results["data"].first["mentions"]["data"] rescue []
end

Instance Attribute Details

#breakdownObject

Returns the value of attribute breakdown.



3
4
5
# File 'lib/facebook_topics/results/insight.rb', line 3

def breakdown
  @breakdown
end

#volumeObject

Returns the value of attribute volume.



3
4
5
# File 'lib/facebook_topics/results/insight.rb', line 3

def volume
  @volume
end