fb_graph 2.5.1 → 2.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.5.1
1
+ 2.5.2
@@ -1,6 +1,7 @@
1
1
  module FbGraph
2
2
  class AdGroup < Node
3
3
  include Connections::AdCreatives
4
+ include Connections::ReachEstimates
4
5
 
5
6
  attr_accessor :ad_id, :campaign_id, :name, :adgroup_status, :bid_type, :max_bid, :targeting, :creative, :creative_ids, :adgroup_id,
6
7
  :end_time, :start_time, :updated_time, :bid_info, :disapprove_reason_descriptions
@@ -6,6 +6,9 @@ module FbGraph
6
6
  def initialize(attributes = {})
7
7
  super
8
8
 
9
+ # everything in a data node when getting reach estimate through an AdGroup
10
+ attributes = attributes[:data] if attributes[:data]
11
+
9
12
  %w(users).each do |field|
10
13
  send("#{field}=", attributes[field.to_sym])
11
14
  end
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe FbGraph::ReachEstimate, '.new' do
4
- it 'should setup all supported attributes' do
5
- attributes = {
4
+ let(:attributes) {
5
+ {
6
6
  :users => 5503300,
7
7
  :bid_estimations => [
8
8
  {
@@ -17,6 +17,14 @@ describe FbGraph::ReachEstimate, '.new' do
17
17
  ],
18
18
  :imp_estimates => []
19
19
  }
20
+ }
21
+
22
+ let(:attributes_through_ad_group) {
23
+ {
24
+ :data => attributes
25
+ }
26
+ }
27
+ it 'should setup all supported attributes' do
20
28
  estimate = FbGraph::ReachEstimate.new(attributes)
21
29
  estimate.users.should == 5503300
22
30
  estimate.cpc_min.should == 27
@@ -26,4 +34,15 @@ describe FbGraph::ReachEstimate, '.new' do
26
34
  estimate.cpm_median.should == 11
27
35
  estimate.cpm_max.should == 14
28
36
  end
37
+
38
+ it 'should setup all supported attributes through AdGroup' do
39
+ estimate = FbGraph::ReachEstimate.new(attributes_through_ad_group)
40
+ estimate.users.should == 5503300
41
+ estimate.cpc_min.should == 27
42
+ estimate.cpc_median.should == 37
43
+ estimate.cpc_max.should == 48
44
+ estimate.cpm_min.should == 8
45
+ estimate.cpm_median.should == 11
46
+ estimate.cpm_max.should == 14
47
+ end
29
48
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fb_graph
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-28 00:00:00.000000000 Z
12
+ date: 2012-10-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httpclient