buddy 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/buddy/service.rb +22 -6
- metadata +4 -10
data/lib/buddy/service.rb
CHANGED
@@ -12,13 +12,13 @@ module Buddy
|
|
12
12
|
def get(resource, params = {})
|
13
13
|
result = GraphApiClient.get(resource, :query => params).parsed_response
|
14
14
|
raise OAuthException.new(result["error"]["message"]) if result["error"]
|
15
|
-
|
15
|
+
result
|
16
16
|
end
|
17
17
|
|
18
18
|
def post(resource, params = {})
|
19
19
|
result = GraphApiClient.post(resource, :query => params).parsed_response
|
20
20
|
raise OAuthException.new(result["error"]["message"]) if result["error"]
|
21
|
-
|
21
|
+
result
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -39,12 +39,28 @@ module Buddy
|
|
39
39
|
changed
|
40
40
|
notify_observers(api_method, params, options)
|
41
41
|
|
42
|
+
fun = case api_method
|
43
|
+
when 'fql.query'
|
44
|
+
lambda { MiniFB.fql(params[:access_token], params[:query], options) }
|
45
|
+
when 'fql.multiquery'
|
46
|
+
lambda { MiniFB.multifql(params[:access_token], params[:queries], options) }
|
47
|
+
else
|
48
|
+
lambda do
|
49
|
+
if params[:access_token]
|
50
|
+
options[:params] = params
|
51
|
+
MiniFB.rest(params[:access_token], api_method, options)
|
52
|
+
else
|
53
|
+
MiniFB.call(Buddy.buddy_config[application]["api_key"],
|
54
|
+
Buddy.buddy_config[application]["secret"],
|
55
|
+
api_method,
|
56
|
+
params.stringify_keys)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
42
61
|
result = nil
|
43
62
|
time = Benchmark.realtime do
|
44
|
-
result =
|
45
|
-
Buddy.buddy_config[application]["secret"],
|
46
|
-
api_method,
|
47
|
-
params.stringify_keys)
|
63
|
+
result = fun.call
|
48
64
|
end
|
49
65
|
Buddy.logger.info("Calling #{api_method} (#{params.inspect}) - #{time}")
|
50
66
|
result
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buddy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 9
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
8
|
+
- 2
|
9
|
+
version: 0.5.2
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Ole Riesenberg
|
@@ -26,7 +25,6 @@ dependencies:
|
|
26
25
|
requirements:
|
27
26
|
- - ">="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 19
|
30
28
|
segments:
|
31
29
|
- 0
|
32
30
|
- 2
|
@@ -42,7 +40,6 @@ dependencies:
|
|
42
40
|
requirements:
|
43
41
|
- - ">="
|
44
42
|
- !ruby/object:Gem::Version
|
45
|
-
hash: 3
|
46
43
|
segments:
|
47
44
|
- 0
|
48
45
|
version: "0"
|
@@ -56,7 +53,6 @@ dependencies:
|
|
56
53
|
requirements:
|
57
54
|
- - ">="
|
58
55
|
- !ruby/object:Gem::Version
|
59
|
-
hash: 3
|
60
56
|
segments:
|
61
57
|
- 0
|
62
58
|
version: "0"
|
@@ -88,8 +84,8 @@ homepage: http://buddybrand.de
|
|
88
84
|
licenses: []
|
89
85
|
|
90
86
|
post_install_message:
|
91
|
-
rdoc_options:
|
92
|
-
|
87
|
+
rdoc_options:
|
88
|
+
- --charset=UTF-8
|
93
89
|
require_paths:
|
94
90
|
- lib
|
95
91
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -97,7 +93,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
93
|
requirements:
|
98
94
|
- - ">="
|
99
95
|
- !ruby/object:Gem::Version
|
100
|
-
hash: 3
|
101
96
|
segments:
|
102
97
|
- 0
|
103
98
|
version: "0"
|
@@ -106,7 +101,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
101
|
requirements:
|
107
102
|
- - ">="
|
108
103
|
- !ruby/object:Gem::Version
|
109
|
-
hash: 3
|
110
104
|
segments:
|
111
105
|
- 0
|
112
106
|
version: "0"
|