fb_graph 2.7.15 → 2.7.16

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 368ca9c527e97ab552c51958ff0614ea86dd0d8b
4
- data.tar.gz: 5ff8b37a4ea646ccb4a912848ba0cf7e782fee28
3
+ metadata.gz: bda72efaff0004ee7daccc5a29e6ad397bacd0d3
4
+ data.tar.gz: 5b6f5ff706c85f843f3eeb0cc5d0149426e5fac2
5
5
  SHA512:
6
- metadata.gz: 6ad52e162c283b9e57293a7d351fcd6e5ff8af8896cae381bc3e55674221fda4607d5c7a349b53f61765c2284647e7a8cba091c64c37aea5b72cf0ef7be560e0
7
- data.tar.gz: eda16eacf3f3aeac3dc05e038a45e26e6517c6eb5c31bf1fa19f7d313a9f978b641f4eeb391a75fe2f1bcbda56fe672e48de83f1f37c8c1d4795db688ca837bc
6
+ metadata.gz: 7a9fef74257e349ba146189cff5f28ce97f5c5f3f60bde65da2401e5fbdb264b3d2b1dcb23b913c263c84f50597dacaa5d764d387907896ec4d12d6f8eebec26
7
+ data.tar.gz: ae68d9b9e64f5b6e08d31b94d30d9f553aaf632bfc74970527f332cf4849236cfb9efaacd3d846d85a2ab58d5d87cd42c61b64eb7bd12bd6ee9f483bedbc63be
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.7.15
1
+ 2.7.16
data/lib/fb_graph.rb CHANGED
@@ -106,6 +106,7 @@ require 'fb_graph/node'
106
106
  require 'fb_graph/open_graph'
107
107
  require 'fb_graph/achievement'
108
108
  require 'fb_graph/ad_account'
109
+ require 'fb_graph/ad_campaign_group'
109
110
  require 'fb_graph/ad_campaign'
110
111
  require 'fb_graph/ad_campaign_stat'
111
112
  require 'fb_graph/ad_connection_object'
@@ -113,6 +114,7 @@ require 'fb_graph/ad_creative'
113
114
  require 'fb_graph/ad_group'
114
115
  require 'fb_graph/ad_group_stat'
115
116
  require 'fb_graph/ad_keyword'
117
+ require 'fb_graph/ad_image'
116
118
  require 'fb_graph/ad_keyword_suggestion'
117
119
  require 'fb_graph/ad_keyword_valid'
118
120
  require 'fb_graph/broad_targeting_category'
@@ -1,5 +1,6 @@
1
1
  module FbGraph
2
2
  class AdAccount < Node
3
+ include Connections::AdCampaignGroups
3
4
  include Connections::AdCampaigns
4
5
  include Connections::AdGroups
5
6
  include Connections::AdCampaignStats
@@ -8,6 +9,8 @@ module FbGraph
8
9
  include Connections::ReachEstimates
9
10
  include Connections::AdConnectionObjects
10
11
  include Connections::AdPreviews
12
+ include Connections::AdImages
13
+ include Connections::AdCreditLine
11
14
 
12
15
  ATTRS = [
13
16
  :account_id,
@@ -2,7 +2,7 @@ module FbGraph
2
2
  class AdCampaign < Node
3
3
  include Connections::AdGroups
4
4
 
5
- attr_accessor :campaign_id, :account_id, :name, :start_time, :end_time, :updated_time, :daily_budget, :daily_imps, :campaign_status, :lifetime_budget, :lifetime_imps
5
+ attr_accessor :campaign_group_id, :account_id, :name, :start_time, :end_time, :updated_time, :daily_budget, :daily_imps, :campaign_status, :lifetime_budget, :lifetime_imps
6
6
 
7
7
  def initialize(identifier, attributes = {})
8
8
  super
@@ -23,7 +23,7 @@ module FbGraph
23
23
  protected
24
24
 
25
25
  def set_attrs(attributes)
26
- %w(campaign_id account_id name daily_budget daily_imps campaign_status lifetime_budget lifetime_imps).each do |field|
26
+ %w(campaign_group_id account_id name daily_budget daily_imps campaign_status lifetime_budget lifetime_imps).each do |field|
27
27
  send("#{field}=", attributes[field.to_sym])
28
28
  end
29
29
 
@@ -0,0 +1,23 @@
1
+ module FbGraph
2
+ class AdCampaignGroup < Node
3
+ include Connections::AdCampaigns
4
+ include Connections::AdGroups
5
+
6
+ ATTRS = [
7
+ :account_id,
8
+ :name,
9
+ :objective,
10
+ :campaign_group_status,
11
+ :buying_type
12
+ ]
13
+
14
+ attr_accessor *ATTRS
15
+ def initialize(identifier, attributes = {})
16
+ super
17
+
18
+ ATTRS.each do |field|
19
+ send("#{field}=", attributes[field.to_sym])
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ module FbGraph
2
+ class AdImage < Node
3
+
4
+ ATTRS = [
5
+ :hash,
6
+ :url
7
+ ]
8
+
9
+ attr_accessor *ATTRS
10
+ def initialize(identifier, attributes = {})
11
+ super
12
+ set_attrs(attributes)
13
+ end
14
+
15
+ protected
16
+
17
+ def set_attrs(attributes)
18
+ ATTRS.each do |field|
19
+ send("#{field}=", attributes[field.to_sym])
20
+ end
21
+ end
22
+ end
23
+ end
@@ -8,6 +8,11 @@ module FbGraph
8
8
  {:data => collection, :count => collection.size}
9
9
  when Hash
10
10
  collection[:data] ||= []
11
+
12
+ # Fix for AdImage response data: field not being an array
13
+ if collection[:data].is_a? Hash
14
+ collection[:data] = collection[:data].values
15
+ end
11
16
  collection
12
17
  when nil
13
18
  collection = {:data => [], :count => 0}
@@ -9,6 +9,22 @@ module FbGraph
9
9
  )
10
10
  end
11
11
  end
12
+
13
+ def ad_account!(options = {})
14
+ ad_account = post options.merge(:connection => :adaccounts)
15
+
16
+ ad_account_id = ad_account[:id]
17
+
18
+ merged_attrs = options.merge(
19
+ :access_token => options[:access_token] || self.access_token
20
+ )
21
+
22
+ if options[:redownload]
23
+ merged_attrs = merged_attrs.merge(ad_account[:data][:adaccounts][ad_account_id]).with_indifferent_access
24
+ end
25
+
26
+ AdAccount.new ad_account_id, merged_attrs
27
+ end
12
28
  end
13
29
  end
14
30
  end
@@ -0,0 +1,26 @@
1
+ module FbGraph
2
+ module Connections
3
+ module AdCampaignGroups
4
+ def ad_campaign_groups(options = {})
5
+ ad_campaign_groups = self.connection :adcampaign_groups, options
6
+ ad_campaign_groups.map! do |ad_campaign_group|
7
+ AdCampaignGroup.new ad_campaign_group[:id], ad_campaign_group.merge(
8
+ :access_token => options[:access_token] || self.access_token
9
+ )
10
+ end
11
+ end
12
+
13
+ def ad_campaign_group!(options = {})
14
+ ad_campaign_group = post options.merge(:connection => :adcampaign_groups)
15
+
16
+ ad_campaign_group_id = ad_campaign_group[:id]
17
+
18
+ merged_attrs = options.merge(
19
+ :access_token => options[:access_token] || self.access_token
20
+ )
21
+
22
+ AdCampaignGroup.new ad_campaign_group_id, merged_attrs
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,10 @@
1
+ module FbGraph
2
+ module Connections
3
+ module AdCreditLine
4
+ def ad_credit_line!(options={})
5
+ response = post options.merge(:connection => :adcreditline)
6
+ response && response[:success]
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,36 @@
1
+ module FbGraph
2
+ module Connections
3
+ module AdImages
4
+ def ad_images(options = {})
5
+ ad_images = self.connection :adimages, options
6
+ ad_images.map! do |ad_image|
7
+ AdImage.new ad_image[:id], ad_image.merge(
8
+ :access_token => options[:access_token] || self.access_token
9
+ )
10
+ end
11
+ end
12
+
13
+ def ad_image!(options = {})
14
+ ad_image = post options.merge(:connection => :adimages)
15
+
16
+ # No ID is contained in the response.
17
+ adimage_id = ad_image[:images].keys.first
18
+ hash = ad_image[:images].values.first[:hash]
19
+ url = ad_image[:images].values.first[:url]
20
+
21
+ merged_attrs = options.merge(
22
+ :access_token => options[:access_token] || self.access_token,
23
+ :hash => hash,
24
+ :url => url
25
+ )
26
+
27
+ if options[:redownload]
28
+ merged_attrs = merged_attrs.merge(ad_image[:data][:adimages][adimage_id]).with_indifferent_access
29
+ end
30
+
31
+ # The first argument is the identifier, which is appended to the endpoint
32
+ AdImage.new adimage_id, merged_attrs
33
+ end
34
+ end
35
+ end
36
+ end
@@ -11,11 +11,11 @@ module FbGraph
11
11
  end
12
12
 
13
13
  def member!(user, options = {})
14
- post options.merge(:connection => :members, :connection_scope => user.identifier)
14
+ post options.merge(:connection => :members, :member => user.identifier)
15
15
  end
16
16
 
17
17
  def unmember!(user, options = {})
18
- delete options.merge(:connection => :members, :connection_scope => user.identifier)
18
+ delete options.merge(:connection => :members, :member => user.identifier)
19
19
  end
20
20
  end
21
21
  end
@@ -40,7 +40,9 @@ describe FbGraph::Connections::Members do
40
40
 
41
41
  describe '#member!' do
42
42
  it 'should return true' do
43
- mock_graph :post, 'list_id/members/member_id', 'true', :access_token => 'access_token' do
43
+ mock_graph :post, 'list_id/members', 'true', :access_token => 'access_token', :params => {
44
+ :member => 'member_id'
45
+ } do
44
46
  FbGraph::FriendList.new('list_id', :access_token => 'access_token').member!(member).should be_true
45
47
  end
46
48
  end
@@ -48,7 +50,9 @@ describe FbGraph::Connections::Members do
48
50
 
49
51
  describe '#unmember!' do
50
52
  it 'should return true' do
51
- mock_graph :delete, 'list_id/members/member_id', 'true', :access_token => 'access_token' do
53
+ mock_graph :delete, 'list_id/members', 'true', :access_token => 'access_token', :params => {
54
+ :member => 'member_id'
55
+ } do
52
56
  FbGraph::FriendList.new('list_id', :access_token => 'access_token').unmember!(member).should be_true
53
57
  end
54
58
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fb_graph
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.15
4
+ version: 2.7.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov matake
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-10 00:00:00.000000000 Z
11
+ date: 2014-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
@@ -161,11 +161,13 @@ files:
161
161
  - lib/fb_graph/action.rb
162
162
  - lib/fb_graph/ad_account.rb
163
163
  - lib/fb_graph/ad_campaign.rb
164
+ - lib/fb_graph/ad_campaign_group.rb
164
165
  - lib/fb_graph/ad_campaign_stat.rb
165
166
  - lib/fb_graph/ad_connection_object.rb
166
167
  - lib/fb_graph/ad_creative.rb
167
168
  - lib/fb_graph/ad_group.rb
168
169
  - lib/fb_graph/ad_group_stat.rb
170
+ - lib/fb_graph/ad_image.rb
169
171
  - lib/fb_graph/ad_keyword.rb
170
172
  - lib/fb_graph/ad_keyword_suggestion.rb
171
173
  - lib/fb_graph/ad_keyword_valid.rb
@@ -189,12 +191,15 @@ files:
189
191
  - lib/fb_graph/connections/achievements.rb
190
192
  - lib/fb_graph/connections/activities.rb
191
193
  - lib/fb_graph/connections/ad_accounts.rb
194
+ - lib/fb_graph/connections/ad_campaign_groups.rb
192
195
  - lib/fb_graph/connections/ad_campaign_stats.rb
193
196
  - lib/fb_graph/connections/ad_campaigns.rb
194
197
  - lib/fb_graph/connections/ad_connection_objects.rb
195
198
  - lib/fb_graph/connections/ad_creatives.rb
199
+ - lib/fb_graph/connections/ad_credit_line.rb
196
200
  - lib/fb_graph/connections/ad_group_stats.rb
197
201
  - lib/fb_graph/connections/ad_groups.rb
202
+ - lib/fb_graph/connections/ad_images.rb
198
203
  - lib/fb_graph/connections/ad_previews.rb
199
204
  - lib/fb_graph/connections/admins.rb
200
205
  - lib/fb_graph/connections/albums.rb