fb_graph 2.1.6 → 2.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.travis.yml CHANGED
@@ -2,5 +2,4 @@ rvm:
2
2
  - 1.8.7
3
3
  - 1.9.2
4
4
  - 1.9.3
5
- - jruby
6
- - ree
5
+ - jruby
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fb_graph (2.1.5)
4
+ fb_graph (2.1.7)
5
5
  httpclient (>= 2.2.0.2)
6
6
  rack-oauth2 (>= 0.9.4)
7
7
 
@@ -32,7 +32,7 @@ GEM
32
32
  bcrypt-ruby (3.0.1-java)
33
33
  bouncy-castle-java (1.5.0146.1)
34
34
  builder (3.0.0)
35
- crack (0.1.8)
35
+ crack (0.3.1)
36
36
  diff-lcs (1.1.3)
37
37
  erubis (2.7.0)
38
38
  hike (1.2.1)
@@ -40,14 +40,15 @@ GEM
40
40
  i18n (0.6.0)
41
41
  jruby-openssl (0.7.4)
42
42
  bouncy-castle-java
43
- json (1.6.0)
43
+ json (1.6.1)
44
+ json (1.6.1-java)
44
45
  multi_json (1.0.3)
45
- rack (1.3.2)
46
+ rack (1.3.3)
46
47
  rack-cache (1.0.3)
47
48
  rack (>= 0.4)
48
49
  rack-mount (0.8.3)
49
50
  rack (>= 1.0.0)
50
- rack-oauth2 (0.10.1)
51
+ rack-oauth2 (0.11.0)
51
52
  activesupport (>= 2.3)
52
53
  attr_required (>= 0.0.3)
53
54
  httpclient (>= 2.2.0.2)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.6
1
+ 2.1.7
@@ -4,15 +4,20 @@ module FbGraph
4
4
  include Connections::AdGroups
5
5
  include Connections::AdCampaignStats
6
6
  include Connections::AdGroupStats
7
+ include Connections::ReachEstimates
7
8
 
8
9
  attr_accessor :account_id, :name, :account_status, :daily_spend_limit, :users, :currency, :timezone_id, :timezone_name, :capabilities, :account_groups
9
10
 
10
11
  def initialize(identifier, attributes = {})
11
12
  super
12
13
 
13
- %w(account_id name account_status daily_spend_limit currency timezone_id timezone_name).each do |field|
14
+ %w(account_id name account_status daily_spend_limit users currency timezone_id timezone_name).each do |field|
14
15
  send("#{field}=", attributes[field.to_sym])
15
16
  end
17
+
18
+ if attributes[:users]
19
+ self.users = attributes[:users].collect { |u| FbGraph::AdUser.new(u["uid"], u) }
20
+ end
16
21
  end
17
22
  end
18
23
  end
@@ -1,11 +1,12 @@
1
1
  module FbGraph
2
2
  class AdGroup < Node
3
- attr_accessor :ad_id, :campaign_id, :name, :adgroup_status, :bid_type, :max_bid, :adgroup_id, :end_time, :start_time, :updated_time
3
+ attr_accessor :ad_id, :campaign_id, :name, :adgroup_status, :bid_type, :max_bid, :targeting, :creative, :creative_ids, :adgroup_id,
4
+ :end_time, :start_time, :updated_time, :bid_info, :disapprove_reason_descriptions
4
5
 
5
6
  def initialize(identifier, attributes = {})
6
7
  super
7
8
 
8
- %w(ad_id campaign_id name adgroup_status bid_type max_bid adgroup_id).each do |field|
9
+ %w(ad_id campaign_id name adgroup_status bid_type max_bid targeting creative creative_ids adgroup_id bid_info disapprove_reason_descriptions).each do |field|
9
10
  send("#{field}=", attributes[field.to_sym])
10
11
  end
11
12
 
@@ -0,0 +1,20 @@
1
+ module FbGraph
2
+ class AdKeyword < Node
3
+ extend Searchable
4
+
5
+ attr_accessor :name, :description
6
+
7
+ def initialize(identifier, attributes = {})
8
+ super
9
+
10
+ %w(name description).each do |field|
11
+ self.send("#{field}=", attributes[field.to_sym])
12
+ end
13
+ end
14
+
15
+ def topic_keyword?
16
+ (name =~ /^#/) == 0
17
+ end
18
+ end
19
+ end
20
+
@@ -0,0 +1,8 @@
1
+ module FbGraph
2
+ class AdKeywordSuggestion < AdKeyword
3
+ def self.search_query_param
4
+ :keyword_list
5
+ end
6
+ end
7
+ end
8
+
@@ -0,0 +1,23 @@
1
+ module FbGraph
2
+ class AdKeywordValid < Node
3
+ extend Searchable
4
+
5
+ attr_accessor :name, :valid, :suggestions
6
+
7
+ def initialize(identifier, attributes = {})
8
+ super
9
+
10
+ %w(name valid).each do |field|
11
+ self.send("#{field}=", attributes[field.to_sym])
12
+ end
13
+
14
+ self.suggestions = attributes[:suggestions].collect {|s| FbGraph::AdKeyword.new(s['id'], s)} if attributes[:suggestions]
15
+ end
16
+
17
+ alias :valid? :valid
18
+
19
+ def self.search_query_param
20
+ :keyword_list
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,58 @@
1
+ module FbGraph
2
+ class AdUser < User
3
+ attr_accessor :role, :permissions
4
+
5
+ def initialize(identifier, attributes = {})
6
+ super(identifier, attributes)
7
+
8
+ %w(role permissions).each do |field|
9
+ self.send("#{field}=", attributes[field.to_sym])
10
+ end
11
+ end
12
+
13
+ # Level 1001, administrator access
14
+ # Level 1002, general-user (ad manager) access
15
+ # Level 1003, reports-only access
16
+ ROLES = {
17
+ :admin => 1001,
18
+ :general => 1002,
19
+ :reports_only => 1003
20
+ }
21
+ ROLES.each do |key, value|
22
+ define_method "#{key}_access?" do
23
+ self.role == value
24
+ end
25
+ end
26
+
27
+ # 1: ACCOUNT_ADMIN: modify the set of users associated with the given account.
28
+ # 2: ADMANAGER_READ: view campaigns and ads
29
+ # 3: ADMANAGER_WRITE: manage campaigns and ads
30
+ # 4: BILLING_READ: view account billing information
31
+ # 5: BILLING_WRITE: modify the account billing information
32
+ # 7: REPORTS: run reports
33
+ PERMISSIONS = {
34
+ :account_admin => 1,
35
+ :ad_manager_read => 2,
36
+ :ad_manager_write => 3,
37
+ :billing_read => 4,
38
+ :billing_write => 5,
39
+ # what's "6"??
40
+ :reports => 7
41
+ }
42
+ PERMISSIONS.each do |key, value|
43
+ define_method "#{key}_access?" do
44
+ self.permissions.include? value
45
+ end
46
+ end
47
+
48
+ # FbGraph::User#fetch does not retrieve the permissions and roles since they are outside the normal
49
+ # attributes for an FbGraph::User, so we just copy them over from this object before returning
50
+ # the fetched one.
51
+ def fetch(options = {})
52
+ super(options).tap do |fetched|
53
+ fetched.role = role
54
+ fetched.permissions = permissions
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,15 @@
1
+ module FbGraph
2
+ module Connections
3
+ module AdAccounts
4
+ def ad_accounts(options = {})
5
+ ad_accounts = self.connection(:adaccounts, options)
6
+ ad_accounts.map! do |ad_account|
7
+ AdAccount.new(ad_account[:id], ad_account.merge(
8
+ :access_token => options[:access_token] || self.access_token
9
+ ))
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+
@@ -15,7 +15,9 @@ module FbGraph
15
15
  def ad_group!(options = {})
16
16
  ad_group = post(options.merge(:connection => :adgroups))
17
17
  AdGroup.new(ad_group[:id], options.merge(ad_group).merge(
18
- :access_token => options[:access_token] || self.access_token
18
+ :access_token => options[:access_token] || self.access_token,
19
+ :ad_id => ad_group[:id].to_i,
20
+ :adgroup_id => ad_group[:id].to_i
19
21
  ))
20
22
  end
21
23
  end
@@ -0,0 +1,12 @@
1
+ module FbGraph
2
+ module Connections
3
+ module ReachEstimates
4
+ def reach_estimates(options = {})
5
+ reach_estimates = self.get(options.merge!(:connection => :reachestimate))
6
+ ReachEstimate.new(reach_estimates.merge(:access_token => options[:access_token] || self.access_token))
7
+ end
8
+ end
9
+ end
10
+ end
11
+
12
+
@@ -0,0 +1,19 @@
1
+ module FbGraph
2
+ class ReachEstimate < Node
3
+
4
+ attr_accessor :users, :cpc_max, :cpc_median, :cpc_min, :cpm_max, :cpm_median, :cpm_min
5
+
6
+ def initialize(attributes = {})
7
+ super
8
+
9
+ %w(users).each do |field|
10
+ send("#{field}=", attributes[field.to_sym])
11
+ end
12
+
13
+ %w(cpc_min cpc_median cpc_max cpm_min cpm_median cpm_max).each do |field|
14
+ send("#{field}=", attributes[:bid_estimations][0][field.to_sym])
15
+ end
16
+ end
17
+ end
18
+ end
19
+
@@ -2,15 +2,16 @@ module FbGraph
2
2
  module Searchable
3
3
  def self.search(query, options = {})
4
4
  klass = options.delete(:class) || Searchable
5
+ query_param = klass.search_query_param
5
6
  collection = Collection.new(
6
- Node.new(:search).send(:get, options.merge(:q => query))
7
+ Node.new(:search).send(:get, options.merge(query_param.to_sym => query))
7
8
  )
8
9
  yield collection if block_given?
9
10
  Searchable::Result.new(query, klass, options.merge(:collection => collection))
10
11
  end
11
12
 
12
13
  def search(query, options = {})
13
- type = self.to_s.underscore.split('/').last
14
+ type = self.to_s.underscore.split('/').last.gsub("_", "")
14
15
  Searchable.search(query, options.merge(:type => type, :class => self)) do |collection|
15
16
  collection.map! do |obj|
16
17
  self.new(obj[:id], obj.merge(
@@ -19,7 +20,13 @@ module FbGraph
19
20
  end
20
21
  end
21
22
  end
23
+
24
+ # The majority of Graph API searches use 'q' but some, like AdKeywordSuggestion
25
+ # use an alternate search query param
26
+ def search_query_param
27
+ :q
28
+ end
22
29
  end
23
30
  end
24
31
 
25
- require 'fb_graph/searchable/result'
32
+ require 'fb_graph/searchable/result'
data/lib/fb_graph/user.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  module FbGraph
2
2
  class User < Node
3
3
  include Connections::Accounts
4
+ include Connections::AdAccounts
4
5
  include Connections::Activities
5
6
  include Connections::Albums
6
- include Connections::AppRequests
7
+ include Connections::AppRequests
7
8
  include Connections::Books
8
9
  include Connections::Checkins
9
10
  include Connections::Events
data/lib/fb_graph.rb CHANGED
@@ -66,6 +66,10 @@ require 'fb_graph/ad_campaign'
66
66
  require 'fb_graph/ad_campaign_stat'
67
67
  require 'fb_graph/ad_group'
68
68
  require 'fb_graph/ad_group_stat'
69
+ require 'fb_graph/ad_keyword'
70
+ require 'fb_graph/ad_keyword_suggestion'
71
+ require 'fb_graph/ad_keyword_valid'
72
+ require 'fb_graph/reach_estimate.rb'
69
73
  require 'fb_graph/album'
70
74
  require 'fb_graph/app_request'
71
75
  require 'fb_graph/application'
@@ -94,6 +98,7 @@ require 'fb_graph/tab'
94
98
  require 'fb_graph/tag'
95
99
  require 'fb_graph/thread'
96
100
  require 'fb_graph/user'
101
+ require 'fb_graph/ad_user'
97
102
  require 'fb_graph/test_user' # Load after FbGraph::User
98
103
  require 'fb_graph/video'
99
104
 
@@ -0,0 +1,25 @@
1
+ describe FbGraph::AdKeyword, '.search' do
2
+ it 'should perform a search' do
3
+ mock_graph :get, 'search', 'ad_keywords/buffy_search', :params => {:q => 'buffy', :type => 'adkeyword'} do
4
+ ad_keywords = FbGraph::AdKeyword.search('buffy')
5
+
6
+ ad_keywords.size.should == 8
7
+ ad_keywords.each {|kw| kw.should be_instance_of(FbGraph::AdKeyword)}
8
+ ad_keywords.first.should == FbGraph::AdKeyword.new(
9
+ 6003357305127,
10
+ :name => "#Buffy the Vampire Slayer (TV series)",
11
+ :description => "Audience: 1,300,000"
12
+ )
13
+ end
14
+ end
15
+ end
16
+
17
+ describe FbGraph::AdKeyword, '.topic_keyword?' do
18
+ it 'should be true for topic keywords' do
19
+ FbGraph::AdKeyword.new(12345, {:name => "#Topics Have Hashes", :description => "Audience: 1,000"}).topic_keyword?.should be_true
20
+ end
21
+
22
+ it "should be false for non-topic keywords" do
23
+ FbGraph::AdKeyword.new(12345, {:name => "No Hash Here"}).topic_keyword?.should be_false
24
+ end
25
+ end
@@ -0,0 +1,15 @@
1
+ describe FbGraph::AdKeywordSuggestion, '.search' do
2
+ it 'should perform a search' do
3
+ mock_graph :get, 'search', 'ad_keyword_suggestions/buffy_suggestions', :params => {:keyword_list => 'buffy+the+vampire+slayer', :type => 'adkeywordsuggestion'} do
4
+ ad_keywords = FbGraph::AdKeywordSuggestion.search('buffy+the+vampire+slayer')
5
+
6
+ ad_keywords.size.should == 8
7
+ ad_keywords.each {|kw| kw.should be_instance_of(FbGraph::AdKeywordSuggestion)}
8
+ ad_keywords.first.should == FbGraph::AdKeywordSuggestion.new(
9
+ 6003134100700,
10
+ :name => "#Angel (TV series)",
11
+ :description => "Audience: 675,000"
12
+ )
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ describe FbGraph::AdKeywordValid, '.search' do
2
+ it 'should perform a search' do
3
+ mock_graph :get, 'search', 'ad_keyword_valids/tige_search', :params => {:keyword_list => 'tige', :type => 'adkeywordvalid'} do
4
+ valid_results = FbGraph::AdKeywordValid.search('tige')
5
+
6
+ valid_results.size.should == 1
7
+ valid_results.first.should be_instance_of(FbGraph::AdKeywordValid)
8
+ valid_results.first.should_not be_valid
9
+ valid_results.first.name.should == "tige"
10
+
11
+ valid_results.first.suggestions.size.should == 1
12
+ valid_results.first.suggestions.first.should be_instance_of(FbGraph::AdKeyword)
13
+ valid_results.first.suggestions.first.name.should == "#Tigerstyle"
14
+ valid_results.first.suggestions.first.should be_topic_keyword
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,67 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph::AdUser do
4
+ subject { ad_user }
5
+ let(:ad_user) { FbGraph::AdUser.new(attributes[:uid], attributes) }
6
+ let(:role) { FbGraph::AdUser::ROLES[:admin] }
7
+ let(:permissions) { [1,3,4,7] }
8
+ let :attributes do
9
+ {
10
+ :uid => '123456',
11
+ :permissions => permissions,
12
+ :role => role
13
+ }
14
+ end
15
+
16
+ it 'should setup all supported attributes' do
17
+ ad_user.identifier.should == "123456"
18
+ ad_user.permissions.should == permissions
19
+ ad_user.role.should == role
20
+ end
21
+
22
+ describe 'role' do
23
+ FbGraph::AdUser::ROLES.keys.each do |role|
24
+ context "when #{role} role given" do
25
+ let(:role) { FbGraph::AdUser::ROLES[role] }
26
+ its(:"#{role}_access?") { should be_true }
27
+ (FbGraph::AdUser::ROLES.keys - [role]).each do |no_access|
28
+ its(:"#{no_access}_access?") { should be_false }
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ describe 'permissions' do
35
+ FbGraph::AdUser::PERMISSIONS.keys.each do |permission|
36
+ context "when #{permission} permission given" do
37
+ let(:permissions) { [FbGraph::AdUser::PERMISSIONS[permission]] }
38
+ its(:"#{permission}_access?") { should be_true }
39
+ (FbGraph::AdUser::PERMISSIONS.keys - [permission]).each do |no_access|
40
+ its(:"#{no_access}_access?") { should be_false }
41
+ end
42
+ end
43
+ end
44
+ end
45
+
46
+ describe ".fetch" do
47
+ let(:ad_user) do
48
+ FbGraph::AdUser.new(
49
+ "579612276",
50
+ :permissions => permissions,
51
+ :role => role
52
+ )
53
+ end
54
+
55
+ it "should fetch the regular User and add the AdUser attributes" do
56
+ mock_graph :get, '579612276', 'users/me_private', :access_token => 'access_token' do
57
+ fetched_user = ad_user.fetch(:access_token => 'access_token')
58
+
59
+ fetched_user.identifier.should == "579612276"
60
+ fetched_user.first_name = "Nov"
61
+ fetched_user.last_name = "Matake"
62
+ fetched_user.permissions.should == permissions
63
+ fetched_user.role.should == role
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph::Connections::AdAccounts, '#ad_accounts' do
4
+ context 'when included by FbGraph::User' do
5
+ context 'when access_token is given' do
6
+ it 'should return ad_accounts as FbGraph::AdAccount' do
7
+ mock_graph :get, 'me/adaccounts', 'users/ad_accounts/me_ad_accounts', :access_token => 'access_token' do
8
+ ad_accounts = FbGraph::User.me('access_token').ad_accounts
9
+ ad_accounts.size.should == 2
10
+ ad_accounts.each { |ad_account| ad_account.should be_instance_of(FbGraph::AdAccount) }
11
+ ad_accounts.first.should == FbGraph::AdAccount.new(
12
+ "act_108370185937777",
13
+ :account_id => 108370185937777,
14
+ :name => "",
15
+ :account_status => 1,
16
+ :currency => "USD",
17
+ :timezone_id => 1,
18
+ :timezone_name => "America/Los_Angeles",
19
+ :daily_spend_limit => 5000,
20
+ :users => [{"uid" => 10000294098888, :permissions => [1,2,3,4,5,7], :role => 1001}],
21
+ :capabilities => [],
22
+ :access_token => 'access_token'
23
+ )
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -6,21 +6,34 @@ describe FbGraph::Connections::AdGroups, '#ad_groups' do
6
6
  it 'should return ad_groups as FbGraph::AdGroup' do
7
7
  mock_graph :get, '22334455/adgroups', 'ad_campaigns/ad_groups/22334455_ad_groups', :access_token => 'access_token' do
8
8
  ad_groups = FbGraph::AdCampaign.new('22334455', :access_token => 'access_token').ad_groups
9
+ ad_groups.size.should == 2
10
+ ad_groups.each { |ad_group| ad_group.should be_instance_of(FbGraph::AdGroup) }
9
11
  ad_groups.first.should == FbGraph::AdGroup.new(
10
- 44556677,
12
+ "6003570493888",
11
13
  :access_token => 'access_token',
12
- :ad_id => 44556677,
14
+ :ad_id => 6003570493888,
13
15
  :campaign_id => 22334455,
14
- :name => "Test Ad Group 1",
16
+ :name => "My Ad 1",
15
17
  :adgroup_status => 1,
16
18
  :bid_type => 1,
17
- :max_bid => 150,
18
- :adgroup_id => 44556677,
19
- :end_time => Time.parse("2011-09-01T00:00:00+00:00"),
20
- :start_time => Time.parse("2011-09-10T00:00:00+00:00"),
21
- :updated_time => Time.parse("2011-09-05T00:00:00+00:00")
19
+ :max_bid => "120",
20
+ :adgroup_id => 6003570493888,
21
+ :end_time => nil,
22
+ :start_time => nil,
23
+ :updated_time => Time.parse("2011-08-17T20:41:39+0000"),
24
+ :bid_info => {"1" => "120"},
25
+ :creative_ids => [6003570493444],
26
+ :targeting => {
27
+ "age_min" => 18,
28
+ "age_max" => 65,
29
+ "countries" => ["US"],
30
+ "education_statuses" => [3],
31
+ "college_networks" => [
32
+ {"name" => "Emory", "id" => "16777243"},
33
+ {"name" => "Georgia Tech", "id" => "16777345"}
34
+ ]
35
+ }
22
36
  )
23
- ad_groups.each { |ad_group| ad_group.should be_instance_of(FbGraph::AdGroup) }
24
37
  end
25
38
  end
26
39
  end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph::Connections::ReachEstimates, '#reach_estimates' do
4
+ context 'when included by FbGraph::AdAccount' do
5
+ context 'when access_token is given' do
6
+ it 'should return reach_estimates as FbGraph::ReachEstimate' do
7
+ mock_graph :get, 'act_123456789/reachestimate', 'ad_accounts/reach_estimates/test_reach_estimates', :params => {:targeting_spec => {:country => ["US"]}.to_json}, :access_token => 'access_token' do
8
+ ad_account = FbGraph::AdAccount.new('act_123456789')
9
+ reach_estimate = ad_account.reach_estimates(:access_token => 'access_token', :targeting_spec => {:country => ["US"]})
10
+ reach_estimate.should be_instance_of(FbGraph::ReachEstimate)
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph::ReachEstimate, '.new' do
4
+ it 'should setup all supported attributes' do
5
+ attributes = {
6
+ :users => 5503300,
7
+ :bid_estimations => [
8
+ {
9
+ :location => 3,
10
+ :cpc_min => 27,
11
+ :cpc_median => 37,
12
+ :cpc_max => 48,
13
+ :cpm_min => 8,
14
+ :cpm_median => 11,
15
+ :cpm_max => 14
16
+ }
17
+ ],
18
+ :imp_estimates => []
19
+ }
20
+ estimate = FbGraph::ReachEstimate.new(attributes)
21
+ estimate.users.should == 5503300
22
+ estimate.cpc_min.should == 27
23
+ estimate.cpc_median.should == 37
24
+ estimate.cpc_max.should == 48
25
+ estimate.cpm_min.should == 8
26
+ estimate.cpm_median.should == 11
27
+ estimate.cpm_max.should == 14
28
+ end
29
+ end
@@ -0,0 +1,31 @@
1
+ {
2
+ "users":20,
3
+ "bid_estimations":[
4
+ {
5
+ "location":3,
6
+ "cpc_min":106,
7
+ "cpc_median":129,
8
+ "cpc_max":153,
9
+ "cpm_min":31,
10
+ "cpm_median":38,
11
+ "cpm_max":45
12
+ }
13
+ ],
14
+ "imp_estimates":[],
15
+ "data":{
16
+ "users":20,
17
+ "bid_estimations":[
18
+ {
19
+ "location":3,
20
+ "cpc_min":106,
21
+ "cpc_median":129,
22
+ "cpc_max":153,
23
+ "cpm_min":31,
24
+ "cpm_median":38,
25
+ "cpm_max":45
26
+ }
27
+ ],
28
+ "imp_estimates":[]
29
+ }
30
+ }
31
+
@@ -1,23 +1,67 @@
1
1
  {
2
2
  "data":[
3
+ {
4
+ "adgroup_id":6003570493888,
5
+ "ad_id":6003570493888,
6
+ "campaign_id":22334455,
7
+ "name":"My Ad 1",
8
+ "ad_status":1,
9
+ "adgroup_status":1,
10
+ "bid_type":1,
11
+ "max_bid":"120",
12
+ "bid_info":
13
+ {
14
+ "1":"120"
15
+ },
16
+ "account_id":32128444,
17
+ "id":"6003570493888",
18
+ "creative_ids":[6003570493444],
19
+ "targeting":{
20
+ "age_max":65,
21
+ "age_min":18,
22
+ "countries":["US"],
23
+ "college_networks":[
24
+ {"id":"16777243", "name":"Emory"},
25
+ {"id":"16777345", "name":"Georgia Tech"}
26
+ ],
27
+ "education_statuses":[3]
28
+ },
29
+ "start_time":null,
30
+ "end_time":null,
31
+ "updated_time":"2011-08-17T20:41:39+0000"
32
+ },
33
+ {
34
+ "adgroup_id":6003570495666,
35
+ "ad_id":6003570495666,
36
+ "campaign_id":22334455,
37
+ "name":"My Ad 2",
38
+ "ad_status":1,
39
+ "adgroup_status":1,
40
+ "bid_type":1,
41
+ "max_bid":"120",
42
+ "bid_info":
3
43
  {
4
- "id": 44556677,
5
- "adgroup_id": 44556677,
6
- "access_token": "access_token",
7
- "ad_id": 44556677,
8
- "campaign_id": 22334455,
9
- "name": "Test Ad Group 1",
10
- "adgroup_status": 1,
11
- "bid_type": 1,
12
- "max_bid": 150,
13
- "adgroup_id": 44556677,
14
- "end_time": "2011-09-01T00:00:00+0000",
15
- "start_time": "2011-09-10T00:00:00+0000",
16
- "updated_time": "2011-09-05T00:00:00+0000"
17
- }
44
+ "1":"120"
45
+ },
46
+ "account_id":32128444,
47
+ "id":"6003570495666",
48
+ "creative_ids":[6003570495222],
49
+ "targeting":{
50
+ "age_max":65,
51
+ "age_min":18,
52
+ "countries":["US"],
53
+ "college_networks":[
54
+ {"id":"16777243", "name":"Emory"},
55
+ {"id":"16777345", "name":"Georgia Tech"}
56
+ ],
57
+ "education_statuses":[3]},
58
+ "start_time":null,
59
+ "end_time":null,
60
+ "updated_time":"2011-08-17T20:41:39+0000"
61
+ }
18
62
  ],
19
- "count": 1,
20
- "limit": 500,
21
- "offset": 0,
22
- "include_deleted": null
63
+ "count":1037,
64
+ "limit":2,
65
+ "offset":0,
66
+ "include_deleted":null
23
67
  }
@@ -0,0 +1,40 @@
1
+ {
2
+ "data":[
3
+ {
4
+ "name":"#Angel (TV series)",
5
+ "description":"Audience: 675,000",
6
+ "id":6003134100700
7
+ },
8
+ {
9
+ "name":"angel",
10
+ "id":6003663454107
11
+ },
12
+ {
13
+ "name":"#Buffy the Vampire Slayer (film)",
14
+ "description":"Audience: 53,000",
15
+ "id":6003311975811
16
+ },
17
+ {
18
+ "name":"#James Marsters",
19
+ "description":"Audience: 66,000",
20
+ "id":6002950267574
21
+ },
22
+ {
23
+ "name":"charmed",
24
+ "id":6003490750831
25
+ },
26
+ {
27
+ "name":"#Firefly (TV series)",
28
+ "description":"Audience: 1,400,000",
29
+ "id":6003503428425
30
+ },
31
+ {
32
+ "name":"dollhouse",
33
+ "id":6003311716999
34
+ },
35
+ {
36
+ "name":"firefly",
37
+ "id":6003381990404
38
+ }
39
+ ]
40
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "data":[
3
+ {
4
+ "name":"tige",
5
+ "valid":false,
6
+ "suggestions":[
7
+ {
8
+ "name":"#Tigerstyle",
9
+ "id":6003352390519
10
+ }
11
+ ]
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "data":[
3
+ {
4
+ "name":"#Buffy the Vampire Slayer (TV series)",
5
+ "description":"Audience: 1,300,000",
6
+ "id":6003357305127
7
+ },
8
+ {
9
+ "name":"#Buffy Summers",
10
+ "description":"Audience: 103,000",
11
+ "id":6003264438714
12
+ },
13
+ {
14
+ "name":"#Buffy the Vampire Slayer (film)",
15
+ "description":"Audience: 53,000",
16
+ "id":6003311975811
17
+ },
18
+ {
19
+ "name":"#Slayer (Buffy the Vampire Slayer)",
20
+ "description":"Audience: 38,000",
21
+ "id":6003175744633
22
+ },
23
+ {
24
+ "name":"#Buffy Sainte-Marie",
25
+ "description":"Audience: 30,000",
26
+ "id":6003325499957
27
+ },
28
+ {
29
+ "name":"Buffy",
30
+ "id":6003127741217
31
+ },
32
+ {
33
+ "name":"#Buffy (album)",
34
+ "description":"Audience: 1,000",
35
+ "id":6003719185383
36
+ },
37
+ {
38
+ "name":"Buffyangel",
39
+ "id":6003458292944
40
+ }
41
+ ]
42
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "data":[
3
+ {
4
+ "id":"act_108370185937777",
5
+ "account_id":108370185937777,
6
+ "name":"",
7
+ "account_status":1,
8
+ "currency":"USD",
9
+ "timezone_id":1,
10
+ "timezone_name":"America/Los_Angeles",
11
+ "daily_spend_limit":5000,
12
+ "users":[{"uid":10000294098888,"permissions":[1,2,3,4,5,7],"role":1001}],
13
+ "capabilities":[]
14
+ },
15
+ {
16
+ "id":"act_108370185933333",
17
+ "account_id":108370185933333,
18
+ "name":"",
19
+ "account_status":1,
20
+ "currency":"USD",
21
+ "timezone_id":1,
22
+ "timezone_name":"America/Los_Angeles",
23
+ "daily_spend_limit":5000,
24
+ "users":[{"uid":100002940985222,"permissions":[1,2,3,4,5,7],"role":1001}],
25
+ "capabilities":[]
26
+ }
27
+ ]
28
+ }
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: fb_graph
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.1.6
5
+ version: 2.1.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - nov matake
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-09-14 00:00:00 Z
13
+ date: 2011-09-22 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httpclient
@@ -119,6 +119,10 @@ files:
119
119
  - lib/fb_graph/ad_campaign_stat.rb
120
120
  - lib/fb_graph/ad_group.rb
121
121
  - lib/fb_graph/ad_group_stat.rb
122
+ - lib/fb_graph/ad_keyword.rb
123
+ - lib/fb_graph/ad_keyword_suggestion.rb
124
+ - lib/fb_graph/ad_keyword_valid.rb
125
+ - lib/fb_graph/ad_user.rb
122
126
  - lib/fb_graph/album.rb
123
127
  - lib/fb_graph/app_request.rb
124
128
  - lib/fb_graph/application.rb
@@ -133,6 +137,7 @@ files:
133
137
  - lib/fb_graph/connections.rb
134
138
  - lib/fb_graph/connections/accounts.rb
135
139
  - lib/fb_graph/connections/activities.rb
140
+ - lib/fb_graph/connections/ad_accounts.rb
136
141
  - lib/fb_graph/connections/ad_campaign_stats.rb
137
142
  - lib/fb_graph/connections/ad_campaigns.rb
138
143
  - lib/fb_graph/connections/ad_group_stats.rb
@@ -177,6 +182,7 @@ files:
177
182
  - lib/fb_graph/connections/photos.rb
178
183
  - lib/fb_graph/connections/picture.rb
179
184
  - lib/fb_graph/connections/posts.rb
185
+ - lib/fb_graph/connections/reach_estimates.rb
180
186
  - lib/fb_graph/connections/reviews.rb
181
187
  - lib/fb_graph/connections/senders.rb
182
188
  - lib/fb_graph/connections/settings.rb
@@ -216,6 +222,7 @@ files:
216
222
  - lib/fb_graph/project.rb
217
223
  - lib/fb_graph/property.rb
218
224
  - lib/fb_graph/query.rb
225
+ - lib/fb_graph/reach_estimate.rb
219
226
  - lib/fb_graph/review.rb
220
227
  - lib/fb_graph/searchable.rb
221
228
  - lib/fb_graph/searchable/result.rb
@@ -235,6 +242,10 @@ files:
235
242
  - spec/fb_graph/ad_account_spec.rb
236
243
  - spec/fb_graph/ad_campaign_spec.rb
237
244
  - spec/fb_graph/ad_group_spec.rb
245
+ - spec/fb_graph/ad_keyword_spec.rb
246
+ - spec/fb_graph/ad_keyword_suggestion_spec.rb
247
+ - spec/fb_graph/ad_keyword_valid_spec.rb
248
+ - spec/fb_graph/ad_user_spec.rb
238
249
  - spec/fb_graph/album_spec.rb
239
250
  - spec/fb_graph/app_request_spec.rb
240
251
  - spec/fb_graph/application_spec.rb
@@ -247,6 +258,7 @@ files:
247
258
  - spec/fb_graph/connection_spec.rb
248
259
  - spec/fb_graph/connections/accounts_spec.rb
249
260
  - spec/fb_graph/connections/activities_spec.rb
261
+ - spec/fb_graph/connections/ad_accounts_spec.rb
250
262
  - spec/fb_graph/connections/ad_campaign_stat_spec.rb
251
263
  - spec/fb_graph/connections/ad_group_stat_spec.rb
252
264
  - spec/fb_graph/connections/ad_groups_spec.rb
@@ -290,6 +302,7 @@ files:
290
302
  - spec/fb_graph/connections/photos_spec.rb
291
303
  - spec/fb_graph/connections/picture_spec.rb
292
304
  - spec/fb_graph/connections/posts_spec.rb
305
+ - spec/fb_graph/connections/reach_estimates_spec.rb
293
306
  - spec/fb_graph/connections/reviews_spec.rb
294
307
  - spec/fb_graph/connections/senders_spec.rb
295
308
  - spec/fb_graph/connections/settings_spec.rb
@@ -330,6 +343,7 @@ files:
330
343
  - spec/fb_graph/privacy_spec.rb
331
344
  - spec/fb_graph/project_spec.rb
332
345
  - spec/fb_graph/query/core_spec.rb
346
+ - spec/fb_graph/reach_estimate_spec.rb
333
347
  - spec/fb_graph/searchable_spec.rb
334
348
  - spec/fb_graph/seriarization_spec.rb
335
349
  - spec/fb_graph/status_spec.rb
@@ -347,10 +361,14 @@ files:
347
361
  - spec/mock_json/ad_accounts/ad_campaign_stats/test_ad_campaign_stats.json
348
362
  - spec/mock_json/ad_accounts/ad_group_stats/test_ad_group_stats.json
349
363
  - spec/mock_json/ad_accounts/ad_groups/post_with_valid_access_token.json
364
+ - spec/mock_json/ad_accounts/reach_estimates/test_reach_estimates.json
350
365
  - spec/mock_json/ad_accounts/test_ad_account.json
351
366
  - spec/mock_json/ad_campaigns/ad_groups/22334455_ad_groups.json
352
367
  - spec/mock_json/ad_campaigns/test_ad_campaign.json
353
368
  - spec/mock_json/ad_groups/test_ad_group.json
369
+ - spec/mock_json/ad_keyword_suggestions/buffy_suggestions.json
370
+ - spec/mock_json/ad_keyword_valids/tige_search.json
371
+ - spec/mock_json/ad_keywords/buffy_search.json
354
372
  - spec/mock_json/albums/photos/matake_private.json
355
373
  - spec/mock_json/albums/photos/post_with_valid_access_token.json
356
374
  - spec/mock_json/applications/accounts/private.json
@@ -432,6 +450,7 @@ files:
432
450
  - spec/mock_json/users/accounts/matake_public.json
433
451
  - spec/mock_json/users/activities/arjun_private.json
434
452
  - spec/mock_json/users/activities/arjun_public.json
453
+ - spec/mock_json/users/ad_accounts/me_ad_accounts.json
435
454
  - spec/mock_json/users/albums/matake_private.json
436
455
  - spec/mock_json/users/albums/matake_public.json
437
456
  - spec/mock_json/users/albums/post_with_valid_access_token.json
@@ -526,6 +545,10 @@ test_files:
526
545
  - spec/fb_graph/ad_account_spec.rb
527
546
  - spec/fb_graph/ad_campaign_spec.rb
528
547
  - spec/fb_graph/ad_group_spec.rb
548
+ - spec/fb_graph/ad_keyword_spec.rb
549
+ - spec/fb_graph/ad_keyword_suggestion_spec.rb
550
+ - spec/fb_graph/ad_keyword_valid_spec.rb
551
+ - spec/fb_graph/ad_user_spec.rb
529
552
  - spec/fb_graph/album_spec.rb
530
553
  - spec/fb_graph/app_request_spec.rb
531
554
  - spec/fb_graph/application_spec.rb
@@ -538,6 +561,7 @@ test_files:
538
561
  - spec/fb_graph/connection_spec.rb
539
562
  - spec/fb_graph/connections/accounts_spec.rb
540
563
  - spec/fb_graph/connections/activities_spec.rb
564
+ - spec/fb_graph/connections/ad_accounts_spec.rb
541
565
  - spec/fb_graph/connections/ad_campaign_stat_spec.rb
542
566
  - spec/fb_graph/connections/ad_group_stat_spec.rb
543
567
  - spec/fb_graph/connections/ad_groups_spec.rb
@@ -581,6 +605,7 @@ test_files:
581
605
  - spec/fb_graph/connections/photos_spec.rb
582
606
  - spec/fb_graph/connections/picture_spec.rb
583
607
  - spec/fb_graph/connections/posts_spec.rb
608
+ - spec/fb_graph/connections/reach_estimates_spec.rb
584
609
  - spec/fb_graph/connections/reviews_spec.rb
585
610
  - spec/fb_graph/connections/senders_spec.rb
586
611
  - spec/fb_graph/connections/settings_spec.rb
@@ -621,6 +646,7 @@ test_files:
621
646
  - spec/fb_graph/privacy_spec.rb
622
647
  - spec/fb_graph/project_spec.rb
623
648
  - spec/fb_graph/query/core_spec.rb
649
+ - spec/fb_graph/reach_estimate_spec.rb
624
650
  - spec/fb_graph/searchable_spec.rb
625
651
  - spec/fb_graph/seriarization_spec.rb
626
652
  - spec/fb_graph/status_spec.rb
@@ -638,10 +664,14 @@ test_files:
638
664
  - spec/mock_json/ad_accounts/ad_campaign_stats/test_ad_campaign_stats.json
639
665
  - spec/mock_json/ad_accounts/ad_group_stats/test_ad_group_stats.json
640
666
  - spec/mock_json/ad_accounts/ad_groups/post_with_valid_access_token.json
667
+ - spec/mock_json/ad_accounts/reach_estimates/test_reach_estimates.json
641
668
  - spec/mock_json/ad_accounts/test_ad_account.json
642
669
  - spec/mock_json/ad_campaigns/ad_groups/22334455_ad_groups.json
643
670
  - spec/mock_json/ad_campaigns/test_ad_campaign.json
644
671
  - spec/mock_json/ad_groups/test_ad_group.json
672
+ - spec/mock_json/ad_keyword_suggestions/buffy_suggestions.json
673
+ - spec/mock_json/ad_keyword_valids/tige_search.json
674
+ - spec/mock_json/ad_keywords/buffy_search.json
645
675
  - spec/mock_json/albums/photos/matake_private.json
646
676
  - spec/mock_json/albums/photos/post_with_valid_access_token.json
647
677
  - spec/mock_json/applications/accounts/private.json
@@ -723,6 +753,7 @@ test_files:
723
753
  - spec/mock_json/users/accounts/matake_public.json
724
754
  - spec/mock_json/users/activities/arjun_private.json
725
755
  - spec/mock_json/users/activities/arjun_public.json
756
+ - spec/mock_json/users/ad_accounts/me_ad_accounts.json
726
757
  - spec/mock_json/users/albums/matake_private.json
727
758
  - spec/mock_json/users/albums/matake_public.json
728
759
  - spec/mock_json/users/albums/post_with_valid_access_token.json