Sha256: 08935952038741f89387ba042560a7645b29d2005cf694caf1924a6b4f768649

Contents?: true

Size: 896 Bytes

Versions: 23

Compression:

Stored size: 896 Bytes

Contents

module FbGraph
  class AdCampaignStat < Node
    attr_accessor :start_time, :end_time, :campaign_id, :impressions, :clicks, :spent, :social_impressions, :social_clicks, :social_spent,
      :unique_impressions, :social_unique_impressions, :unique_clicks, :social_unique_clicks, :connections

    def initialize(identifier, attributes = {})
      super

      %w(campaign_id impressions clicks spent social_impressions social_clicks social_spent unique_impressions social_unique_impressions unique_clicks social_unique_clicks connections).each do |field|
        send("#{field}=", attributes[field.to_sym])
      end

      %w(start_time end_time).each do |field|
        if val = attributes[field.to_sym]
          # Handles integer timestamps and ISO8601 strings
          time = Time.parse(val) rescue Time.at(val.to_i)
          send("#{field}=", time)
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
fb_graph-2.4.0 lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.3.2 lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.3.1 lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.3.0 lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.2.6 lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.2.5 lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.2.4 lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.2.3 lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.2.2 lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.2.1 lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.2.0 lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.2.0.beta lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.2.0.alpha2 lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.2.0.alpha lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.1.13 lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.1.12 lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.1.11 lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.1.10 lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.1.9 lib/fb_graph/ad_campaign_stat.rb
fb_graph-2.1.8 lib/fb_graph/ad_campaign_stat.rb