buddy 2.1.3 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/buddy/service.rb +5 -1
- data/lib/buddy/session/base.rb +11 -3
- data/lib/buddy/version.rb +1 -1
- metadata +1 -1
data/lib/buddy/service.rb
CHANGED
@@ -17,6 +17,10 @@ module Buddy
|
|
17
17
|
call_graph(:post, resource, params)
|
18
18
|
end
|
19
19
|
|
20
|
+
def delete(resource, params = {})
|
21
|
+
call_graph(:delete, resource, params)
|
22
|
+
end
|
23
|
+
|
20
24
|
private
|
21
25
|
def call_graph(method, resource, params)
|
22
26
|
result = nil
|
@@ -25,7 +29,7 @@ module Buddy
|
|
25
29
|
end
|
26
30
|
Buddy.logger.info("GraphAPI: #{method} #{resource} - #{time}") if Buddy.config['logging_enabled']
|
27
31
|
|
28
|
-
raise OAuthException.new(result["error"]["message"]) if result["error"]
|
32
|
+
raise OAuthException.new(result["error"]["message"]) if result.is_a?(Hash) && result["error"]
|
29
33
|
result
|
30
34
|
end
|
31
35
|
end
|
data/lib/buddy/session/base.rb
CHANGED
@@ -24,13 +24,21 @@ module Buddy
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def get(resource, params = {})
|
27
|
-
|
28
|
-
Buddy::Service.get(resource, params)
|
27
|
+
graph_http_req(:get, resource, params)
|
29
28
|
end
|
30
29
|
|
31
30
|
def post(resource, params = {})
|
31
|
+
graph_http_req(:post, resource, params)
|
32
|
+
end
|
33
|
+
|
34
|
+
def delete(resource, params = {})
|
35
|
+
graph_http_req(:delete, resource, params)
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
def graph_http_req(method, resource, params = {})
|
32
40
|
params.merge!(:access_token => access_token) unless params[:access_token]
|
33
|
-
Buddy::Service.
|
41
|
+
Buddy::Service.send(method, resource, params)
|
34
42
|
end
|
35
43
|
end
|
36
44
|
end
|
data/lib/buddy/version.rb
CHANGED