Class: FbGraph::ReachEstimate

Inherits:
Node
  • Object
show all
Defined in:
lib/fb_graph/reach_estimate.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#access_token, #endpoint, #identifier, #raw_attributes

Instance Method Summary collapse

Methods inherited from Node

#connection, #destroy, fetch, #fetch, #update

Methods included from Comparison

#==

Constructor Details

#initialize(attributes = {}) ⇒ ReachEstimate

Returns a new instance of ReachEstimate.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fb_graph/reach_estimate.rb', line 6

def initialize(attributes = {})
  super

  # everything in a data node when getting reach estimate through an AdGroup
  attributes = attributes[:data] if attributes[:data]

  %w(users).each do |field|
    send("#{field}=", attributes[field.to_sym])
  end

  %w(cpc_min cpc_median cpc_max cpm_min cpm_median cpm_max).each do |field|
    send("#{field}=", attributes[:bid_estimations][0][field.to_sym])
  end
end

Instance Attribute Details

#cpc_maxObject

Returns the value of attribute cpc_max.



4
5
6
# File 'lib/fb_graph/reach_estimate.rb', line 4

def cpc_max
  @cpc_max
end

#cpc_medianObject

Returns the value of attribute cpc_median.



4
5
6
# File 'lib/fb_graph/reach_estimate.rb', line 4

def cpc_median
  @cpc_median
end

#cpc_minObject

Returns the value of attribute cpc_min.



4
5
6
# File 'lib/fb_graph/reach_estimate.rb', line 4

def cpc_min
  @cpc_min
end

#cpm_maxObject

Returns the value of attribute cpm_max.



4
5
6
# File 'lib/fb_graph/reach_estimate.rb', line 4

def cpm_max
  @cpm_max
end

#cpm_medianObject

Returns the value of attribute cpm_median.



4
5
6
# File 'lib/fb_graph/reach_estimate.rb', line 4

def cpm_median
  @cpm_median
end

#cpm_minObject

Returns the value of attribute cpm_min.



4
5
6
# File 'lib/fb_graph/reach_estimate.rb', line 4

def cpm_min
  @cpm_min
end

#usersObject

Returns the value of attribute users.



4
5
6
# File 'lib/fb_graph/reach_estimate.rb', line 4

def users
  @users
end