fb_graph 2.0.2 → 2.1.0.alpha
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 +7 -0
- data/Gemfile.lock +41 -30
- data/README.rdoc +12 -0
- data/VERSION +1 -1
- data/lib/fb_graph/{adaccount.rb → ad_account.rb} +2 -0
- data/lib/fb_graph/{adcampaign.rb → ad_campaign.rb} +5 -1
- data/lib/fb_graph/auth.rb +15 -2
- data/lib/fb_graph/connections/ad_campaign.rb +21 -0
- data/lib/fb_graph/debugger.rb +20 -0
- data/lib/fb_graph/exception.rb +33 -0
- data/lib/fb_graph/node.rb +9 -3
- data/lib/fb_graph/query.rb +1 -1
- data/lib/fb_graph.rb +26 -30
- data/spec/fb_graph/{adaccount_spec.rb → ad_account_spec.rb} +1 -1
- data/spec/fb_graph/{adcampaign_spec.rb → ad_campaign_spec.rb} +18 -1
- data/spec/fb_graph/auth_spec.rb +24 -0
- data/spec/fb_graph/debugger_spec.rb +29 -0
- data/spec/fb_graph_spec.rb +31 -0
- data/spec/mock_json/{adaccounts → ad_accounts}/test_ad_account.json +0 -0
- data/spec/mock_json/{adcampaigns → ad_campaigns}/test_ad_campaign.json +0 -0
- data/spec/mock_json/exchange_sessions_null_response.json +1 -0
- data/spec/mock_json/exchange_sessions_response.json +5 -0
- metadata +28 -59
data/.travis.yml
ADDED
data/Gemfile.lock
CHANGED
@@ -1,45 +1,52 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fb_graph (2.0.
|
4
|
+
fb_graph (2.0.2)
|
5
5
|
httpclient (>= 2.2.0.2)
|
6
6
|
rack-oauth2 (>= 0.8.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
rack (~> 1.
|
19
|
-
rack-mount (~> 0.
|
20
|
-
rack-test (~> 0.
|
21
|
-
|
22
|
-
activemodel (3.0
|
23
|
-
activesupport (= 3.0
|
24
|
-
|
25
|
-
|
26
|
-
|
11
|
+
actionpack (3.1.0)
|
12
|
+
activemodel (= 3.1.0)
|
13
|
+
activesupport (= 3.1.0)
|
14
|
+
builder (~> 3.0.0)
|
15
|
+
erubis (~> 2.7.0)
|
16
|
+
i18n (~> 0.6)
|
17
|
+
rack (~> 1.3.2)
|
18
|
+
rack-cache (~> 1.0.3)
|
19
|
+
rack-mount (~> 0.8.2)
|
20
|
+
rack-test (~> 0.6.1)
|
21
|
+
sprockets (~> 2.0.0)
|
22
|
+
activemodel (3.1.0)
|
23
|
+
activesupport (= 3.1.0)
|
24
|
+
bcrypt-ruby (~> 3.0.0)
|
25
|
+
builder (~> 3.0.0)
|
26
|
+
i18n (~> 0.6)
|
27
|
+
activesupport (3.1.0)
|
28
|
+
multi_json (~> 1.0)
|
27
29
|
addressable (2.2.6)
|
28
30
|
attr_required (0.0.3)
|
31
|
+
bcrypt-ruby (3.0.0)
|
32
|
+
bcrypt-ruby (3.0.0-java)
|
29
33
|
bouncy-castle-java (1.5.0146.1)
|
30
|
-
builder (
|
34
|
+
builder (3.0.0)
|
31
35
|
crack (0.1.8)
|
32
|
-
diff-lcs (1.1.
|
33
|
-
erubis (2.
|
34
|
-
|
36
|
+
diff-lcs (1.1.3)
|
37
|
+
erubis (2.7.0)
|
38
|
+
hike (1.2.1)
|
35
39
|
httpclient (2.2.1)
|
36
|
-
i18n (0.
|
40
|
+
i18n (0.6.0)
|
37
41
|
jruby-openssl (0.7.4)
|
38
42
|
bouncy-castle-java
|
39
|
-
json (1.5.
|
40
|
-
json (1.5.
|
41
|
-
|
42
|
-
rack
|
43
|
+
json (1.5.4)
|
44
|
+
json (1.5.4-java)
|
45
|
+
multi_json (1.0.3)
|
46
|
+
rack (1.3.2)
|
47
|
+
rack-cache (1.0.3)
|
48
|
+
rack (>= 0.4)
|
49
|
+
rack-mount (0.8.3)
|
43
50
|
rack (>= 1.0.0)
|
44
51
|
rack-oauth2 (0.9.2)
|
45
52
|
activesupport (>= 2.3)
|
@@ -48,7 +55,7 @@ GEM
|
|
48
55
|
i18n
|
49
56
|
json (>= 1.4.3)
|
50
57
|
rack (>= 1.1)
|
51
|
-
rack-test (0.
|
58
|
+
rack-test (0.6.1)
|
52
59
|
rack (>= 1.0)
|
53
60
|
rake (0.9.2)
|
54
61
|
rcov (0.9.10)
|
@@ -61,9 +68,13 @@ GEM
|
|
61
68
|
rspec-expectations (2.6.0)
|
62
69
|
diff-lcs (~> 1.1.2)
|
63
70
|
rspec-mocks (2.6.0)
|
64
|
-
|
65
|
-
|
66
|
-
|
71
|
+
sprockets (2.0.0)
|
72
|
+
hike (~> 1.2)
|
73
|
+
rack (~> 1.0)
|
74
|
+
tilt (~> 1.1, != 1.3.0)
|
75
|
+
tilt (1.3.3)
|
76
|
+
webmock (1.7.5)
|
77
|
+
addressable (~> 2.2, > 2.2.5)
|
67
78
|
crack (>= 0.1.7)
|
68
79
|
|
69
80
|
PLATFORMS
|
data/README.rdoc
CHANGED
@@ -203,6 +203,10 @@ Both Facebook JavaScript SDK and normal OAuth2 flow is supported.
|
|
203
203
|
Below I show simple sample code.
|
204
204
|
You can also see https://github.com/nov/fb_graph_sample for more details Rails3 sample application.
|
205
205
|
|
206
|
+
In addition, if you are migrating an application that uses old-style session keys you can exchange
|
207
|
+
the keys for access tokens.
|
208
|
+
See more here: http://developers.facebook.com/docs/authentication/fb_sig/
|
209
|
+
|
206
210
|
==== JavaScript SDK
|
207
211
|
|
208
212
|
fb_auth = FbGraph::Auth.new(YOUR_APP_ID, YOUR_APPLICATION_SECRET)
|
@@ -230,6 +234,14 @@ You can also see https://github.com/nov/fb_graph_sample for more details Rails3
|
|
230
234
|
access_token = client.access_token! # => Rack::OAuth2::AccessToken
|
231
235
|
FbGraph::User.me(access_token).fetch # => FbGraph::User
|
232
236
|
|
237
|
+
==== Session Key Exchange
|
238
|
+
|
239
|
+
# setup client
|
240
|
+
fb_auth = FbGraph::Auth.new(YOUR_APP_ID, YOUR_APPLICATION_SECRET)
|
241
|
+
fb_auth.from_session_key('my-old-session-key')
|
242
|
+
fb_auth.access_token # => Rack::OAuth2::AccessToken
|
243
|
+
|
244
|
+
|
233
245
|
=== Analytics
|
234
246
|
|
235
247
|
app = FbGraph::Application.new(YOUR_APP_ID, :secret => YOUR_APPLICATION_SECRET)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.1.0.alpha
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module FbGraph
|
2
2
|
class AdAccount < Node
|
3
|
+
include Connections::AdCampaigns
|
4
|
+
|
3
5
|
attr_accessor :account_id, :name, :account_status, :daily_spend_limit, :users, :currency, :timezone_id, :timezone_name, :capabilities, :account_groups
|
4
6
|
|
5
7
|
def initialize(identifier, attributes = {})
|
@@ -10,7 +10,11 @@ module FbGraph
|
|
10
10
|
end
|
11
11
|
|
12
12
|
%w(start_time end_time).each do |field|
|
13
|
-
|
13
|
+
if val = attributes[field.to_sym]
|
14
|
+
# Handles integer timestamps and ISO8601 strings
|
15
|
+
time = Time.parse(val) rescue Time.at(val.to_i)
|
16
|
+
send("#{field}=", time)
|
17
|
+
end
|
14
18
|
end
|
15
19
|
end
|
16
20
|
end
|
data/lib/fb_graph/auth.rb
CHANGED
@@ -50,6 +50,19 @@ module FbGraph
|
|
50
50
|
self
|
51
51
|
end
|
52
52
|
|
53
|
+
def from_session_key(session_key)
|
54
|
+
response = HTTPClient.new.post "#{ROOT_URL}/oauth/exchange_sessions", {:client_id => @client.identifier, :client_secret => @client.secret, :sessions => session_key}
|
55
|
+
if response.body && self.data = JSON.parse(response.body)
|
56
|
+
if self.data[0]
|
57
|
+
self.access_token = build_access_token(self.data[0].with_indifferent_access)
|
58
|
+
else
|
59
|
+
# If the session key is unknown or there's an error, Facebook returns null
|
60
|
+
self.access_token = nil
|
61
|
+
end
|
62
|
+
end
|
63
|
+
self
|
64
|
+
end
|
65
|
+
|
53
66
|
private
|
54
67
|
|
55
68
|
def get_access_token!(code)
|
@@ -62,7 +75,7 @@ module FbGraph
|
|
62
75
|
end
|
63
76
|
|
64
77
|
def build_access_token(data)
|
65
|
-
expires_in = unless data[:expires].zero?
|
78
|
+
expires_in = unless data[:expires].nil? || data[:expires].zero?
|
66
79
|
data[:expires] - Time.now.to_i
|
67
80
|
end
|
68
81
|
Rack::OAuth2::AccessToken::Legacy.new(
|
@@ -74,4 +87,4 @@ module FbGraph
|
|
74
87
|
end
|
75
88
|
|
76
89
|
require 'fb_graph/auth/cookie'
|
77
|
-
require 'fb_graph/auth/signed_request'
|
90
|
+
require 'fb_graph/auth/signed_request'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module FbGraph
|
2
|
+
module Connections
|
3
|
+
module AdCampaigns
|
4
|
+
def ad_campaigns(options = {})
|
5
|
+
ad_campaigns = self.connection(:adcampaigns, options)
|
6
|
+
ad_campaigns.map! do |ad_campaign|
|
7
|
+
AdCampaign.new(ad_campaign[:id], ad_campaign.merge(
|
8
|
+
:access_token => options[:access_token] || self.access_token
|
9
|
+
))
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def ad_campaign!(options = {})
|
14
|
+
ad_campaign = post(options.merge(:connection => :adcampaigns))
|
15
|
+
AdCampaign.new(ad_campaign[:id], options.merge(ad_campaign).merge(
|
16
|
+
:access_token => options[:access_token] || self.access_token
|
17
|
+
))
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module FbGraph
|
2
|
+
module Debugger
|
3
|
+
class RequestFilter
|
4
|
+
# Callback called in HTTPClient (before sending a request)
|
5
|
+
# request:: HTTP::Message
|
6
|
+
def filter_request(request)
|
7
|
+
started = "======= [FbGraph] API REQUEST STARTED ======="
|
8
|
+
FbGraph.logger.info [started, request.dump].join("\n")
|
9
|
+
end
|
10
|
+
|
11
|
+
# Callback called in HTTPClient (after received a response)
|
12
|
+
# request:: HTTP::Message
|
13
|
+
# response:: HTTP::Message
|
14
|
+
def filter_response(request, response)
|
15
|
+
finished = "======= [FbGraph] API REQUEST FINISHED ======="
|
16
|
+
FbGraph.logger.info ['-' * 50, response.dump, finished].join("\n")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module FbGraph
|
2
|
+
class Exception < StandardError
|
3
|
+
attr_accessor :code, :type, :message
|
4
|
+
def initialize(code, message, body = '')
|
5
|
+
@code = code
|
6
|
+
if body.blank?
|
7
|
+
@message = message
|
8
|
+
else
|
9
|
+
response = JSON.parse(body).with_indifferent_access
|
10
|
+
@message = response[:error][:message]
|
11
|
+
@type = response[:error][:type]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class BadRequest < Exception
|
17
|
+
def initialize(message, body = '')
|
18
|
+
super 400, message, body
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class Unauthorized < Exception
|
23
|
+
def initialize(message, body = '')
|
24
|
+
super 401, message, body
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class NotFound < Exception
|
29
|
+
def initialize(message, body = '')
|
30
|
+
super 404, message, body
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/fb_graph/node.rb
CHANGED
@@ -40,13 +40,13 @@ module FbGraph
|
|
40
40
|
|
41
41
|
def get(params = {})
|
42
42
|
handle_response do
|
43
|
-
|
43
|
+
http_client.get build_endpoint(params), build_params(params)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
def post(params = {})
|
48
48
|
handle_response do
|
49
|
-
|
49
|
+
http_client.post build_endpoint(params), build_params(params)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -54,10 +54,16 @@ module FbGraph
|
|
54
54
|
_endpoint_, _params_ = build_endpoint(params), build_params(params)
|
55
55
|
_endpoint_ = [_endpoint_, _params_.try(:to_query)].compact.join('?')
|
56
56
|
handle_response do
|
57
|
-
|
57
|
+
http_client.delete _endpoint_
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
def http_client
|
62
|
+
_http_client_ = HTTPClient.new
|
63
|
+
_http_client_.request_filter << Debugger::RequestFilter.new if FbGraph.debugging?
|
64
|
+
_http_client_
|
65
|
+
end
|
66
|
+
|
61
67
|
private
|
62
68
|
|
63
69
|
def build_endpoint(params = {})
|
data/lib/fb_graph/query.rb
CHANGED
data/lib/fb_graph.rb
CHANGED
@@ -5,40 +5,37 @@ require 'patch/rack/oauth2/util'
|
|
5
5
|
module FbGraph
|
6
6
|
ROOT_URL = "https://graph.facebook.com"
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
def initialize(code, message, body = '')
|
11
|
-
@code = code
|
12
|
-
if body.blank?
|
13
|
-
@message = message
|
14
|
-
else
|
15
|
-
response = JSON.parse(body).with_indifferent_access
|
16
|
-
@message = response[:error][:message]
|
17
|
-
@type = response[:error][:type]
|
18
|
-
end
|
19
|
-
end
|
8
|
+
def self.logger
|
9
|
+
@@logger
|
20
10
|
end
|
21
|
-
|
22
|
-
|
23
|
-
def initialize(message, body = '')
|
24
|
-
super 400, message, body
|
25
|
-
end
|
11
|
+
def self.logger=(logger)
|
12
|
+
@@logger = logger
|
26
13
|
end
|
14
|
+
self.logger = Logger.new(STDOUT)
|
15
|
+
self.logger.progname = 'Paypal::Express'
|
27
16
|
|
28
|
-
|
29
|
-
|
30
|
-
super 401, message, body
|
31
|
-
end
|
17
|
+
def self.debugging?
|
18
|
+
@@debugging
|
32
19
|
end
|
33
|
-
|
34
|
-
|
35
|
-
def initialize(message, body = '')
|
36
|
-
super 404, message, body
|
37
|
-
end
|
20
|
+
def self.debugging=(boolean)
|
21
|
+
@@debugging = boolean
|
38
22
|
end
|
39
|
-
|
23
|
+
def self.debug!
|
24
|
+
self.debugging = true
|
25
|
+
end
|
26
|
+
def self.debug(&block)
|
27
|
+
original = self.debugging?
|
28
|
+
self.debugging = true
|
29
|
+
yield
|
30
|
+
ensure
|
31
|
+
self.debugging = original
|
32
|
+
end
|
33
|
+
self.debugging = false
|
40
34
|
end
|
41
35
|
|
36
|
+
require 'fb_graph/exception'
|
37
|
+
require 'fb_graph/debugger'
|
38
|
+
|
42
39
|
require 'fb_graph/auth'
|
43
40
|
require 'fb_graph/comparison'
|
44
41
|
require 'fb_graph/serialization'
|
@@ -57,6 +54,8 @@ require 'fb_graph/venue'
|
|
57
54
|
require 'fb_graph/work'
|
58
55
|
|
59
56
|
require 'fb_graph/node'
|
57
|
+
require 'fb_graph/ad_account'
|
58
|
+
require 'fb_graph/ad_campaign'
|
60
59
|
require 'fb_graph/album'
|
61
60
|
require 'fb_graph/app_request'
|
62
61
|
require 'fb_graph/application'
|
@@ -87,9 +86,6 @@ require 'fb_graph/user'
|
|
87
86
|
require 'fb_graph/test_user' # Load after FbGraph::User
|
88
87
|
require 'fb_graph/video'
|
89
88
|
|
90
|
-
require 'fb_graph/adaccount'
|
91
|
-
require 'fb_graph/adcampaign'
|
92
|
-
|
93
89
|
require 'fb_graph/klass'
|
94
90
|
require 'fb_graph/project'
|
95
91
|
|
@@ -27,7 +27,7 @@ end
|
|
27
27
|
|
28
28
|
describe FbGraph::AdAccount, '.fetch' do
|
29
29
|
it 'should get the ad account' do
|
30
|
-
mock_graph :get, 'act_12345566', '
|
30
|
+
mock_graph :get, 'act_12345566', 'ad_accounts/test_ad_account', :access_token => 'access_token' do
|
31
31
|
ad_account = FbGraph::AdAccount.fetch('act_12345566', :access_token => 'access_token')
|
32
32
|
|
33
33
|
ad_account.identifier.should == "act_12345566"
|
@@ -23,12 +23,29 @@ describe FbGraph::AdCampaign, '.new' do
|
|
23
23
|
ad_campaign.campaign_status.should == 1
|
24
24
|
ad_campaign.lifetime_budget.should == 100000
|
25
25
|
end
|
26
|
+
|
27
|
+
it 'should handle integer, string, or iso8601 timestamps' do
|
28
|
+
t = Time.parse("2011-09-01T00:00:00Z")
|
29
|
+
attributes = {
|
30
|
+
:id => '6003266501234',
|
31
|
+
:campaign_id => 6003266501234,
|
32
|
+
:account_id => 12345566,
|
33
|
+
:name => "Test Ad Campaign",
|
34
|
+
:end_time => "2011-09-10T00:00:00Z",
|
35
|
+
:daily_budget => 20000,
|
36
|
+
:campaign_status => 1,
|
37
|
+
:lifetime_budget => 100000
|
38
|
+
}
|
39
|
+
FbGraph::AdCampaign.new(attributes[:id], attributes.merge(:start_time => t.to_i)).start_time.should == t
|
40
|
+
FbGraph::AdCampaign.new(attributes[:id], attributes.merge(:start_time => t.to_i.to_s)).start_time.should == t
|
41
|
+
FbGraph::AdCampaign.new(attributes[:id], attributes.merge(:start_time => t.iso8601)).start_time.should == t
|
42
|
+
end
|
26
43
|
end
|
27
44
|
|
28
45
|
|
29
46
|
describe FbGraph::AdCampaign, '.fetch' do
|
30
47
|
it 'should get the ad campaign' do
|
31
|
-
mock_graph :get, '16003266501234', '
|
48
|
+
mock_graph :get, '16003266501234', 'ad_campaigns/test_ad_campaign', :access_token => 'access_token' do
|
32
49
|
ad_campaign = FbGraph::AdCampaign.fetch('16003266501234', :access_token => 'access_token')
|
33
50
|
|
34
51
|
ad_campaign.identifier.should == "6003266501234"
|
data/spec/fb_graph/auth_spec.rb
CHANGED
@@ -140,5 +140,29 @@ describe FbGraph::Auth do
|
|
140
140
|
end
|
141
141
|
end
|
142
142
|
end
|
143
|
+
|
144
|
+
describe "#from_session_key" do
|
145
|
+
let(:session_key) { 'my_session_key'}
|
146
|
+
|
147
|
+
it "should exchange the session key for an oauth token" do
|
148
|
+
mock_graph :post, '/oauth/exchange_sessions', 'exchange_sessions_response' do
|
149
|
+
auth.access_token.should be_nil
|
150
|
+
|
151
|
+
auth.from_session_key(session_key)
|
152
|
+
auth.access_token.should be_a Rack::OAuth2::AccessToken::Legacy
|
153
|
+
auth.access_token.access_token.should == "my_oauth_token"
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
|
158
|
+
it "should handle null responses" do
|
159
|
+
mock_graph :post, '/oauth/exchange_sessions', 'exchange_sessions_null_response' do
|
160
|
+
auth.access_token.should be_nil
|
161
|
+
|
162
|
+
auth.from_session_key(session_key)
|
163
|
+
auth.access_token.should be_nil
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
143
167
|
end
|
144
168
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FbGraph::Debugger::RequestFilter do
|
4
|
+
let(:resource_endpoint) { 'https://graph.facebook.com/matake' }
|
5
|
+
let(:request) { HTTP::Message.new_request(:get, URI.parse(resource_endpoint)) }
|
6
|
+
let(:response) { HTTP::Message.new_response({:hello => 'world'}.to_json) }
|
7
|
+
let(:request_filter) { FbGraph::Debugger::RequestFilter.new }
|
8
|
+
|
9
|
+
describe '#filter_request' do
|
10
|
+
it 'should log request' do
|
11
|
+
FbGraph.logger.should_receive(:info).with(
|
12
|
+
"======= [FbGraph] API REQUEST STARTED =======\n" +
|
13
|
+
request.dump
|
14
|
+
)
|
15
|
+
request_filter.filter_request(request)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#filter_response' do
|
20
|
+
it 'should log response' do
|
21
|
+
FbGraph.logger.should_receive(:info).with(
|
22
|
+
"--------------------------------------------------\n" +
|
23
|
+
response.dump +
|
24
|
+
"\n======= [FbGraph] API REQUEST FINISHED ======="
|
25
|
+
)
|
26
|
+
request_filter.filter_response(request, response)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FbGraph do
|
4
|
+
subject { FbGraph }
|
5
|
+
after { FbGraph.debugging = false }
|
6
|
+
|
7
|
+
its(:logger) { should be_a Logger }
|
8
|
+
its(:debugging?) { should be_false }
|
9
|
+
|
10
|
+
describe '.debug!' do
|
11
|
+
before { FbGraph.debug! }
|
12
|
+
its(:debugging?) { should be_true }
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '.debug' do
|
16
|
+
it 'should enable debugging within given block' do
|
17
|
+
FbGraph.debug do
|
18
|
+
FbGraph.debugging?.should be_true
|
19
|
+
end
|
20
|
+
FbGraph.debugging?.should be_false
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should not force disable debugging' do
|
24
|
+
FbGraph.debug!
|
25
|
+
FbGraph.debug do
|
26
|
+
FbGraph.debugging?.should be_true
|
27
|
+
end
|
28
|
+
FbGraph.debugging?.should be_true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
[null]
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fb_graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 2
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
version: 2.0.2
|
4
|
+
prerelease: 6
|
5
|
+
version: 2.1.0.alpha
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- nov matake
|
@@ -15,7 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-09-
|
13
|
+
date: 2011-09-03 00:00:00 Z
|
19
14
|
dependencies:
|
20
15
|
- !ruby/object:Gem::Dependency
|
21
16
|
name: httpclient
|
@@ -25,12 +20,6 @@ dependencies:
|
|
25
20
|
requirements:
|
26
21
|
- - ">="
|
27
22
|
- !ruby/object:Gem::Version
|
28
|
-
hash: 123
|
29
|
-
segments:
|
30
|
-
- 2
|
31
|
-
- 2
|
32
|
-
- 0
|
33
|
-
- 2
|
34
23
|
version: 2.2.0.2
|
35
24
|
type: :runtime
|
36
25
|
version_requirements: *id001
|
@@ -42,11 +31,6 @@ dependencies:
|
|
42
31
|
requirements:
|
43
32
|
- - ">="
|
44
33
|
- !ruby/object:Gem::Version
|
45
|
-
hash: 63
|
46
|
-
segments:
|
47
|
-
- 0
|
48
|
-
- 8
|
49
|
-
- 0
|
50
34
|
version: 0.8.0
|
51
35
|
type: :runtime
|
52
36
|
version_requirements: *id002
|
@@ -58,10 +42,6 @@ dependencies:
|
|
58
42
|
requirements:
|
59
43
|
- - ">="
|
60
44
|
- !ruby/object:Gem::Version
|
61
|
-
hash: 27
|
62
|
-
segments:
|
63
|
-
- 0
|
64
|
-
- 8
|
65
45
|
version: "0.8"
|
66
46
|
type: :development
|
67
47
|
version_requirements: *id003
|
@@ -73,10 +53,6 @@ dependencies:
|
|
73
53
|
requirements:
|
74
54
|
- - ">="
|
75
55
|
- !ruby/object:Gem::Version
|
76
|
-
hash: 25
|
77
|
-
segments:
|
78
|
-
- 0
|
79
|
-
- 9
|
80
56
|
version: "0.9"
|
81
57
|
type: :development
|
82
58
|
version_requirements: *id004
|
@@ -88,9 +64,6 @@ dependencies:
|
|
88
64
|
requirements:
|
89
65
|
- - ">="
|
90
66
|
- !ruby/object:Gem::Version
|
91
|
-
hash: 7
|
92
|
-
segments:
|
93
|
-
- 2
|
94
67
|
version: "2"
|
95
68
|
type: :development
|
96
69
|
version_requirements: *id005
|
@@ -102,11 +75,6 @@ dependencies:
|
|
102
75
|
requirements:
|
103
76
|
- - ">="
|
104
77
|
- !ruby/object:Gem::Version
|
105
|
-
hash: 11
|
106
|
-
segments:
|
107
|
-
- 1
|
108
|
-
- 6
|
109
|
-
- 2
|
110
78
|
version: 1.6.2
|
111
79
|
type: :development
|
112
80
|
version_requirements: *id006
|
@@ -118,11 +86,6 @@ dependencies:
|
|
118
86
|
requirements:
|
119
87
|
- - ">="
|
120
88
|
- !ruby/object:Gem::Version
|
121
|
-
hash: 11
|
122
|
-
segments:
|
123
|
-
- 3
|
124
|
-
- 0
|
125
|
-
- 6
|
126
89
|
version: 3.0.6
|
127
90
|
type: :development
|
128
91
|
version_requirements: *id007
|
@@ -139,6 +102,7 @@ files:
|
|
139
102
|
- .document
|
140
103
|
- .gitignore
|
141
104
|
- .rspec
|
105
|
+
- .travis.yml
|
142
106
|
- Gemfile
|
143
107
|
- Gemfile.lock
|
144
108
|
- LICENSE
|
@@ -150,8 +114,8 @@ files:
|
|
150
114
|
- fb_graph.gemspec
|
151
115
|
- lib/fb_graph.rb
|
152
116
|
- lib/fb_graph/action.rb
|
153
|
-
- lib/fb_graph/
|
154
|
-
- lib/fb_graph/
|
117
|
+
- lib/fb_graph/ad_account.rb
|
118
|
+
- lib/fb_graph/ad_campaign.rb
|
155
119
|
- lib/fb_graph/album.rb
|
156
120
|
- lib/fb_graph/app_request.rb
|
157
121
|
- lib/fb_graph/application.rb
|
@@ -166,6 +130,7 @@ files:
|
|
166
130
|
- lib/fb_graph/connections.rb
|
167
131
|
- lib/fb_graph/connections/accounts.rb
|
168
132
|
- lib/fb_graph/connections/activities.rb
|
133
|
+
- lib/fb_graph/connections/ad_campaign.rb
|
169
134
|
- lib/fb_graph/connections/albums.rb
|
170
135
|
- lib/fb_graph/connections/app_requests.rb
|
171
136
|
- lib/fb_graph/connections/attending.rb
|
@@ -216,10 +181,12 @@ files:
|
|
216
181
|
- lib/fb_graph/connections/test_users.rb
|
217
182
|
- lib/fb_graph/connections/threads.rb
|
218
183
|
- lib/fb_graph/connections/videos.rb
|
184
|
+
- lib/fb_graph/debugger.rb
|
219
185
|
- lib/fb_graph/doc.rb
|
220
186
|
- lib/fb_graph/domain.rb
|
221
187
|
- lib/fb_graph/education.rb
|
222
188
|
- lib/fb_graph/event.rb
|
189
|
+
- lib/fb_graph/exception.rb
|
223
190
|
- lib/fb_graph/friend_list.rb
|
224
191
|
- lib/fb_graph/group.rb
|
225
192
|
- lib/fb_graph/image.rb
|
@@ -256,8 +223,8 @@ files:
|
|
256
223
|
- lib/fb_graph/video.rb
|
257
224
|
- lib/fb_graph/work.rb
|
258
225
|
- lib/patch/rack/oauth2/util.rb
|
259
|
-
- spec/fb_graph/
|
260
|
-
- spec/fb_graph/
|
226
|
+
- spec/fb_graph/ad_account_spec.rb
|
227
|
+
- spec/fb_graph/ad_campaign_spec.rb
|
261
228
|
- spec/fb_graph/album_spec.rb
|
262
229
|
- spec/fb_graph/app_request_spec.rb
|
263
230
|
- spec/fb_graph/application_spec.rb
|
@@ -320,6 +287,7 @@ files:
|
|
320
287
|
- spec/fb_graph/connections/test_users_spec.rb
|
321
288
|
- spec/fb_graph/connections/threads_spec.rb
|
322
289
|
- spec/fb_graph/connections/videos_spec.rb
|
290
|
+
- spec/fb_graph/debugger_spec.rb
|
323
291
|
- spec/fb_graph/doc_spec.rb
|
324
292
|
- spec/fb_graph/domain_spec.rb
|
325
293
|
- spec/fb_graph/education_spec.rb
|
@@ -359,9 +327,10 @@ files:
|
|
359
327
|
- spec/fb_graph/venue_spec.rb
|
360
328
|
- spec/fb_graph/video_spec.rb
|
361
329
|
- spec/fb_graph/work_spec.rb
|
330
|
+
- spec/fb_graph_spec.rb
|
362
331
|
- spec/helpers/webmock_helper.rb
|
363
|
-
- spec/mock_json/
|
364
|
-
- spec/mock_json/
|
332
|
+
- spec/mock_json/ad_accounts/test_ad_account.json
|
333
|
+
- spec/mock_json/ad_campaigns/test_ad_campaign.json
|
365
334
|
- spec/mock_json/albums/photos/matake_private.json
|
366
335
|
- spec/mock_json/albums/photos/post_with_valid_access_token.json
|
367
336
|
- spec/mock_json/applications/accounts/private.json
|
@@ -382,6 +351,8 @@ files:
|
|
382
351
|
- spec/mock_json/events/maybe/post_with_valid_access_token.json
|
383
352
|
- spec/mock_json/events/maybe/smartday_private.json
|
384
353
|
- spec/mock_json/events/noreply/smartday_private.json
|
354
|
+
- spec/mock_json/exchange_sessions_null_response.json
|
355
|
+
- spec/mock_json/exchange_sessions_response.json
|
385
356
|
- spec/mock_json/groups/docs/private.json
|
386
357
|
- spec/mock_json/groups/members/emacs_private.json
|
387
358
|
- spec/mock_json/pages/blocked/create.json
|
@@ -514,29 +485,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
514
485
|
requirements:
|
515
486
|
- - ">="
|
516
487
|
- !ruby/object:Gem::Version
|
517
|
-
hash: 3
|
518
|
-
segments:
|
519
|
-
- 0
|
520
488
|
version: "0"
|
521
489
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
522
490
|
none: false
|
523
491
|
requirements:
|
524
|
-
- - "
|
492
|
+
- - ">"
|
525
493
|
- !ruby/object:Gem::Version
|
526
|
-
|
527
|
-
segments:
|
528
|
-
- 0
|
529
|
-
version: "0"
|
494
|
+
version: 1.3.1
|
530
495
|
requirements: []
|
531
496
|
|
532
497
|
rubyforge_project:
|
533
|
-
rubygems_version: 1.8.
|
498
|
+
rubygems_version: 1.8.10
|
534
499
|
signing_key:
|
535
500
|
specification_version: 3
|
536
501
|
summary: A full-stack Facebook Graph API wrapper in Ruby.
|
537
502
|
test_files:
|
538
|
-
- spec/fb_graph/
|
539
|
-
- spec/fb_graph/
|
503
|
+
- spec/fb_graph/ad_account_spec.rb
|
504
|
+
- spec/fb_graph/ad_campaign_spec.rb
|
540
505
|
- spec/fb_graph/album_spec.rb
|
541
506
|
- spec/fb_graph/app_request_spec.rb
|
542
507
|
- spec/fb_graph/application_spec.rb
|
@@ -599,6 +564,7 @@ test_files:
|
|
599
564
|
- spec/fb_graph/connections/test_users_spec.rb
|
600
565
|
- spec/fb_graph/connections/threads_spec.rb
|
601
566
|
- spec/fb_graph/connections/videos_spec.rb
|
567
|
+
- spec/fb_graph/debugger_spec.rb
|
602
568
|
- spec/fb_graph/doc_spec.rb
|
603
569
|
- spec/fb_graph/domain_spec.rb
|
604
570
|
- spec/fb_graph/education_spec.rb
|
@@ -638,9 +604,10 @@ test_files:
|
|
638
604
|
- spec/fb_graph/venue_spec.rb
|
639
605
|
- spec/fb_graph/video_spec.rb
|
640
606
|
- spec/fb_graph/work_spec.rb
|
607
|
+
- spec/fb_graph_spec.rb
|
641
608
|
- spec/helpers/webmock_helper.rb
|
642
|
-
- spec/mock_json/
|
643
|
-
- spec/mock_json/
|
609
|
+
- spec/mock_json/ad_accounts/test_ad_account.json
|
610
|
+
- spec/mock_json/ad_campaigns/test_ad_campaign.json
|
644
611
|
- spec/mock_json/albums/photos/matake_private.json
|
645
612
|
- spec/mock_json/albums/photos/post_with_valid_access_token.json
|
646
613
|
- spec/mock_json/applications/accounts/private.json
|
@@ -661,6 +628,8 @@ test_files:
|
|
661
628
|
- spec/mock_json/events/maybe/post_with_valid_access_token.json
|
662
629
|
- spec/mock_json/events/maybe/smartday_private.json
|
663
630
|
- spec/mock_json/events/noreply/smartday_private.json
|
631
|
+
- spec/mock_json/exchange_sessions_null_response.json
|
632
|
+
- spec/mock_json/exchange_sessions_response.json
|
664
633
|
- spec/mock_json/groups/docs/private.json
|
665
634
|
- spec/mock_json/groups/members/emacs_private.json
|
666
635
|
- spec/mock_json/pages/blocked/create.json
|