Sha256: 08f52072f7604a1814a12937a64de4d691fc3a4174f9d14dbda4e4ade9d2f282

Contents?: true

Size: 708 Bytes

Versions: 59

Compression:

Stored size: 708 Bytes

Contents

module FbGraph
  module Connections
    module Insights
      def insights(options = {})
        options[:access_token] ||= self.access_token
        insights = self.connection :insights, options.merge(
          :connection_scope => connection_scope(options)
        )
        insights.map! do |insight|
          Insight.new insight[:id], insight.merge(
            :access_token => options[:access_token]
          )
        end
      end

      private

      def connection_scope(options)
        if metrics = options.delete(:metrics)
          File.join [metrics, options.delete(:period)].compact.collect(&:to_s)
        else
          options[:connection_scope]
        end
      end
    end
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
fb_graph-2.7.17 lib/fb_graph/connections/insights.rb
fb_graph-2.7.16 lib/fb_graph/connections/insights.rb
fb_graph-2.7.15 lib/fb_graph/connections/insights.rb
fb_graph-2.7.14 lib/fb_graph/connections/insights.rb
fb_graph-2.7.13 lib/fb_graph/connections/insights.rb
fb_graph-2.7.12 lib/fb_graph/connections/insights.rb
fb_graph-2.7.11 lib/fb_graph/connections/insights.rb
fb_graph-2.7.10 lib/fb_graph/connections/insights.rb
fb_graph-2.7.9 lib/fb_graph/connections/insights.rb
fb_graph-2.7.8 lib/fb_graph/connections/insights.rb
fb_graph-2.7.7 lib/fb_graph/connections/insights.rb
fb_graph-2.7.6 lib/fb_graph/connections/insights.rb
fb_graph-2.7.5 lib/fb_graph/connections/insights.rb
fb_graph-2.7.4 lib/fb_graph/connections/insights.rb
fb_graph-2.7.3 lib/fb_graph/connections/insights.rb
fb_graph-2.7.2 lib/fb_graph/connections/insights.rb
fb_graph-2.7.1 lib/fb_graph/connections/insights.rb
fb_graph-2.7.0 lib/fb_graph/connections/insights.rb
fb_graph-2.6.7 lib/fb_graph/connections/insights.rb
fb_graph-2.6.6 lib/fb_graph/connections/insights.rb