Module: FbGraph::Connections::AdCampaignGroups

Included in:
AdAccount
Defined in:
lib/fb_graph/connections/ad_campaign_groups.rb

Instance Method Summary collapse

Instance Method Details

#ad_campaign_group!(options = {}) ⇒ Object


13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fb_graph/connections/ad_campaign_groups.rb', line 13

def ad_campaign_group!(options = {})
  ad_campaign_group = post options.merge(:connection => :adcampaign_groups)

  ad_campaign_group_id = ad_campaign_group[:id]

  merged_attrs = options.merge(
    :access_token => options[:access_token] || self.access_token
  )

  AdCampaignGroup.new ad_campaign_group_id, merged_attrs
end

#ad_campaign_groups(options = {}) ⇒ Object


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

def ad_campaign_groups(options = {})
  ad_campaign_groups = self.connection :adcampaign_groups, options
  ad_campaign_groups.map! do |ad_campaign_group|
    AdCampaignGroup.new ad_campaign_group[:id], ad_campaign_group.merge(
      :access_token => options[:access_token] || self.access_token
    )
  end
end