Module: FbGraph::Connections::Insights

Included in:
Application, Page
Defined in:
lib/fb_graph/connections/insights.rb

Instance Method Summary collapse

Instance Method Details

#insights(options = {}) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/fb_graph/connections/insights.rb', line 4

def insights(options = {})
  options[:access_token] ||= self.access_token
  options[:access_token] ||= get_access_token(options[:secret]) if respond_to?(:get_access_token)
  insights = self.connection(:insights, options.merge(:connection_scope => connection_scope(options)))
  insights.map! do |insight|
    Insight.new(insight.delete(:id), insight.merge(:access_token => options[:access_token]))
  end
end