Sha256: 06ddafe5607482ee9dbb0e4bedbd6d589ecac461c111650c55e245ac1ddba1c0

Contents?: true

Size: 684 Bytes

Versions: 7

Compression:

Stored size: 684 Bytes

Contents

module FbGraph
  class AdGroup < Node
    attr_accessor :ad_id, :campaign_id, :name, :adgroup_status, :bid_type, :max_bid, :adgroup_id, :end_time, :start_time, :updated_time

    def initialize(identifier, attributes = {})
      super

      %w(ad_id campaign_id name adgroup_status bid_type max_bid adgroup_id).each do |field|
        send("#{field}=", attributes[field.to_sym])
      end

      %w(start_time end_time updated_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

7 entries across 7 versions & 1 rubygems

Version Path
fb_graph-2.1.6 lib/fb_graph/ad_group.rb
fb_graph-2.1.5 lib/fb_graph/ad_group.rb
fb_graph-2.1.4 lib/fb_graph/ad_group.rb
fb_graph-2.1.3 lib/fb_graph/ad_group.rb
fb_graph-2.1.2 lib/fb_graph/ad_group.rb
fb_graph-2.1.1 lib/fb_graph/ad_group.rb
fb_graph-2.1.0 lib/fb_graph/ad_group.rb