Class: GSGraph::AdGroup

Inherits:
Node
  • Object
show all
Includes:
Connections::AdCreatives, Connections::ReachEstimates
Defined in:
lib/gs_graph/ad_group.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier, #raw_attributes

Instance Method Summary collapse

Methods included from Connections::ReachEstimates

#reach_estimates

Methods included from Connections::AdCreatives

#ad_creatives

Methods inherited from Node

#connection, #destroy, fetch, #fetch

Methods included from Comparison

#==

Constructor Details

#initialize(identifier, attributes = {}) ⇒ AdGroup

Returns a new instance of AdGroup.



9
10
11
12
# File 'lib/gs_graph/ad_group.rb', line 9

def initialize(identifier, attributes = {})
  super
  set_attrs(attributes)
end

Instance Attribute Details

#ad_idObject

Returns the value of attribute ad_id.



6
7
8
# File 'lib/gs_graph/ad_group.rb', line 6

def ad_id
  @ad_id
end

#adgroup_idObject

Returns the value of attribute adgroup_id.



6
7
8
# File 'lib/gs_graph/ad_group.rb', line 6

def adgroup_id
  @adgroup_id
end

#adgroup_statusObject

Returns the value of attribute adgroup_status.



6
7
8
# File 'lib/gs_graph/ad_group.rb', line 6

def adgroup_status
  @adgroup_status
end

#bid_infoObject

Returns the value of attribute bid_info.



6
7
8
# File 'lib/gs_graph/ad_group.rb', line 6

def bid_info
  @bid_info
end

#bid_typeObject

Returns the value of attribute bid_type.



6
7
8
# File 'lib/gs_graph/ad_group.rb', line 6

def bid_type
  @bid_type
end

#campaign_idObject

Returns the value of attribute campaign_id.



6
7
8
# File 'lib/gs_graph/ad_group.rb', line 6

def campaign_id
  @campaign_id
end

#creativeObject

Returns the value of attribute creative.



6
7
8
# File 'lib/gs_graph/ad_group.rb', line 6

def creative
  @creative
end

#creative_idsObject

Returns the value of attribute creative_ids.



6
7
8
# File 'lib/gs_graph/ad_group.rb', line 6

def creative_ids
  @creative_ids
end

#disapprove_reason_descriptionsObject

Returns the value of attribute disapprove_reason_descriptions.



6
7
8
# File 'lib/gs_graph/ad_group.rb', line 6

def disapprove_reason_descriptions
  @disapprove_reason_descriptions
end

#end_timeObject

Returns the value of attribute end_time.



6
7
8
# File 'lib/gs_graph/ad_group.rb', line 6

def end_time
  @end_time
end

#max_bidObject

Returns the value of attribute max_bid.



6
7
8
# File 'lib/gs_graph/ad_group.rb', line 6

def max_bid
  @max_bid
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/gs_graph/ad_group.rb', line 6

def name
  @name
end

#start_timeObject

Returns the value of attribute start_time.



6
7
8
# File 'lib/gs_graph/ad_group.rb', line 6

def start_time
  @start_time
end

#targetingObject

Returns the value of attribute targeting.



6
7
8
# File 'lib/gs_graph/ad_group.rb', line 6

def targeting
  @targeting
end

#updated_timeObject

Returns the value of attribute updated_time.



6
7
8
# File 'lib/gs_graph/ad_group.rb', line 6

def updated_time
  @updated_time
end

#view_tagsObject

Returns the value of attribute view_tags.



6
7
8
# File 'lib/gs_graph/ad_group.rb', line 6

def view_tags
  @view_tags
end

Instance Method Details

#creatives(fetch = true) ⇒ Object



27
28
29
# File 'lib/gs_graph/ad_group.rb', line 27

def creatives(fetch = true)
  creative_ids.map { |creative_id| fetch ? AdCreative.fetch(creative_id) : AdCreative.new(creative_id) }
end

#update(options) ⇒ Object

We override update to handle the “redownload” parameter If redownload is specified, the GSGraph::AdGroup object will be updated with the data returned from Facebook.



16
17
18
19
20
21
22
23
24
25
# File 'lib/gs_graph/ad_group.rb', line 16

def update(options)
  response = super(options)

  if options[:redownload]
    attributes = options.merge(response[:data][:adgroups][identifier]).with_indifferent_access
    set_attrs(attributes)
  end

  response
end