fb_rails 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fb_rails.rb +3 -0
- data/lib/fb_rails/errors.rb +14 -0
- data/lib/fb_rails/graph.rb +5 -8
- data/test/error_test.rb +7 -0
- data/test/graph_test.rb +9 -0
- data/test/test_helper.rb +1 -4
- metadata +17 -4
data/lib/fb_rails.rb
CHANGED
data/lib/fb_rails/graph.rb
CHANGED
@@ -4,13 +4,6 @@ require 'uri'
|
|
4
4
|
require 'fb_rails/log_subscriber'
|
5
5
|
|
6
6
|
module FbRails
|
7
|
-
class TimeoutError < StandardError
|
8
|
-
def initialize(message)
|
9
|
-
@message = message
|
10
|
-
end
|
11
|
-
def to_s; @message ;end
|
12
|
-
end
|
13
|
-
|
14
7
|
class Graph
|
15
8
|
class << self
|
16
9
|
def facebook_uri
|
@@ -38,7 +31,11 @@ module FbRails
|
|
38
31
|
|
39
32
|
def json_request(http_verb, path, *arguments)
|
40
33
|
response = request(http_verb, path, *arguments)
|
41
|
-
|
34
|
+
begin
|
35
|
+
ActiveSupport::JSON.decode(response.body)
|
36
|
+
rescue => e
|
37
|
+
raise ResponseError.new(e.message)
|
38
|
+
end
|
42
39
|
end
|
43
40
|
|
44
41
|
def http
|
data/test/error_test.rb
ADDED
data/test/graph_test.rb
CHANGED
@@ -14,4 +14,13 @@ class FbRails::GraphTest < ActiveSupport::TestCase
|
|
14
14
|
FbRails::Graph.get 'foo'
|
15
15
|
end
|
16
16
|
end
|
17
|
+
|
18
|
+
test 'rescue response error' do
|
19
|
+
http = stub(get: stub(body: "false"))
|
20
|
+
FbRails::Graph.expects(:http).returns(http)
|
21
|
+
|
22
|
+
assert_raise FbRails::ResponseError do
|
23
|
+
FbRails::Graph.get 'foo'
|
24
|
+
end
|
25
|
+
end
|
17
26
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fb_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-12-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70111865339960 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,18 @@ dependencies:
|
|
21
21
|
version: 3.0.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70111865339960
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: fakeweb
|
27
|
+
requirement: &70111865339500 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70111865339500
|
25
36
|
description: A Rails 3 gem for the latest facebook API
|
26
37
|
email: developer@matthewhiggins.com
|
27
38
|
executables: []
|
@@ -36,6 +47,7 @@ files:
|
|
36
47
|
- lib/fb_rails/connect.rb
|
37
48
|
- lib/fb_rails/cookie.rb
|
38
49
|
- lib/fb_rails/engine.rb
|
50
|
+
- lib/fb_rails/errors.rb
|
39
51
|
- lib/fb_rails/fb.rb
|
40
52
|
- lib/fb_rails/graph.rb
|
41
53
|
- lib/fb_rails/integration/action_controller.rb
|
@@ -48,6 +60,7 @@ files:
|
|
48
60
|
- test/config_test.rb
|
49
61
|
- test/connect_test.rb
|
50
62
|
- test/cookie_test.rb
|
63
|
+
- test/error_test.rb
|
51
64
|
- test/fb_test.rb
|
52
65
|
- test/graph_test.rb
|
53
66
|
- test/helpers/action_controller_test.rb
|