Module: GSGraph::Connections::AdGroups
- Included in:
- AdAccount, AdCampaign
- Defined in:
- lib/gs_graph/connections/ad_groups.rb
Instance Method Summary collapse
-
#ad_group!(options = {}) ⇒ Object
Note: AdGroups can only be created via the AdAccount connection.
- #ad_groups(options = {}) ⇒ Object
Instance Method Details
#ad_group!(options = {}) ⇒ Object
Note: AdGroups can only be created via the AdAccount connection. Even though it makes sense, they cannot be created via the AdCampaign connection
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/gs_graph/connections/ad_groups.rb', line 15 def ad_group!( = {}) ad_group = post .merge(:connection => :adgroups) adgroup_id = ad_group[:id] merged_attrs = .merge( :access_token => [:access_token] || self.access_token, :ad_id => adgroup_id.to_i, :adgroup_id => adgroup_id.to_i ) if [:redownload] merged_attrs = merged_attrs.merge(ad_group[:data][:adgroups][adgroup_id]).with_indifferent_access end AdGroup.new ad_group[:id], merged_attrs end |
#ad_groups(options = {}) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/gs_graph/connections/ad_groups.rb', line 4 def ad_groups( = {}) ad_groups = self.connection :adgroups, ad_groups.map! do |ad_group| AdGroup.new ad_group[:id], ad_group.merge( :access_token => [:access_token] || self.access_token ) end end |