koala 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +10 -0
- data/Manifest +15 -0
- data/Rakefile +1 -1
- data/examples/oauth_playground/Capfile +2 -0
- data/examples/oauth_playground/LICENSE +22 -0
- data/examples/oauth_playground/Rakefile +4 -0
- data/examples/oauth_playground/config.ru +27 -0
- data/examples/oauth_playground/config/deploy.rb +39 -0
- data/examples/oauth_playground/config/facebook.yml +13 -0
- data/examples/oauth_playground/lib/load_facebook.rb +3 -0
- data/examples/oauth_playground/lib/oauth_playground.rb +187 -0
- data/examples/oauth_playground/readme.md +8 -0
- data/examples/oauth_playground/spec/oauth_playground_spec.rb +35 -0
- data/examples/oauth_playground/spec/spec_helper.rb +36 -0
- data/examples/oauth_playground/tmp/restart.txt +0 -0
- data/examples/oauth_playground/views/index.erb +206 -0
- data/examples/oauth_playground/views/layout.erb +39 -0
- data/koala.gemspec +3 -3
- data/lib/koala.rb +36 -6
- data/lib/koala/graph_api.rb +63 -2
- data/lib/koala/http_services.rb +3 -2
- data/readme.md +37 -12
- data/spec/facebook_data.yml +17 -5
- data/spec/koala/api_base_tests.rb +15 -0
- data/spec/koala/graph_api/graph_api_no_access_token_tests.rb +13 -4
- data/spec/koala/graph_api/graph_api_with_access_token_tests.rb +14 -3
- data/spec/koala/graph_api/graph_collection_tests.rb +104 -0
- data/spec/koala/net_http_service_tests.rb +1 -1
- data/spec/koala/oauth/oauth_tests.rb +245 -113
- data/spec/koala_spec_helper.rb +1 -0
- data/spec/mock_facebook_responses.yml +39 -26
- data/spec/mock_http_service.rb +1 -1
- metadata +18 -3
data/spec/koala_spec_helper.rb
CHANGED
@@ -11,6 +11,7 @@ require 'koala/live_testing_data_helper'
|
|
11
11
|
# API tests
|
12
12
|
require 'koala/api_base_tests'
|
13
13
|
|
14
|
+
require 'koala/graph_api/graph_collection_tests'
|
14
15
|
require 'koala/graph_api/graph_api_no_access_token_tests'
|
15
16
|
require 'koala/graph_api/graph_api_with_access_token_tests'
|
16
17
|
|
@@ -14,7 +14,7 @@
|
|
14
14
|
rest_api:
|
15
15
|
|
16
16
|
# -- Stubbed Responses --
|
17
|
-
method/fql.query:
|
17
|
+
/method/fql.query:
|
18
18
|
query=select first_name from user where uid = 216743:
|
19
19
|
get:
|
20
20
|
no_token: '[{"first_name":"Chris"}]'
|
@@ -53,7 +53,7 @@ graph_api:
|
|
53
53
|
get:
|
54
54
|
with_token: '[{}, {}]'
|
55
55
|
no_token: '[{}, {}]'
|
56
|
-
me:
|
56
|
+
/me:
|
57
57
|
no_args:
|
58
58
|
get:
|
59
59
|
<<: *token_required
|
@@ -62,7 +62,7 @@ graph_api:
|
|
62
62
|
get:
|
63
63
|
with_token: '{"id": "216743"}'
|
64
64
|
|
65
|
-
me/feed:
|
65
|
+
/me/feed:
|
66
66
|
message=Hello, world, from the test suite!:
|
67
67
|
post:
|
68
68
|
with_token: '{"id": "MOCK_FEED_ITEM"}'
|
@@ -79,31 +79,31 @@ graph_api:
|
|
79
79
|
post:
|
80
80
|
with_token: '{"id": "FEED_ITEM_CONTEXT"}'
|
81
81
|
|
82
|
-
koppel:
|
82
|
+
/koppel:
|
83
83
|
no_args:
|
84
84
|
get:
|
85
85
|
with_token: '{"id": 1, "name": 1, "updated_time": 1}'
|
86
86
|
no_token: '{"id": 1, "name": 1}'
|
87
87
|
|
88
|
-
contextoptional:
|
88
|
+
/contextoptional:
|
89
89
|
no_args:
|
90
90
|
get:
|
91
91
|
with_token: '{"id": 1, "name": 1}'
|
92
92
|
no_token: '{"id": 1, "name": 1}'
|
93
93
|
|
94
|
-
contextoptional/
|
94
|
+
/contextoptional/photos:
|
95
95
|
no_args:
|
96
96
|
get:
|
97
|
-
with_token: '{"data": [{}]}'
|
98
|
-
no_token: '{"data": [{}]}'
|
99
|
-
|
100
|
-
lukeshepard/likes:
|
97
|
+
with_token: '{"data": [{}], "paging": {"previous": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000", "next": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000"}}'
|
98
|
+
no_token: '{"data": [{}], "paging": {"previous": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000", "next": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000"}}'
|
99
|
+
|
100
|
+
/lukeshepard/likes:
|
101
101
|
no_args:
|
102
102
|
get:
|
103
103
|
<<: *token_required
|
104
104
|
with_token: '{"data": [{}]}'
|
105
105
|
|
106
|
-
chris.baclig/picture:
|
106
|
+
/chris.baclig/picture:
|
107
107
|
no_args:
|
108
108
|
get:
|
109
109
|
no_token:
|
@@ -126,19 +126,23 @@ graph_api:
|
|
126
126
|
Location: http://facebook.com/large
|
127
127
|
|
128
128
|
|
129
|
-
search:
|
129
|
+
/search:
|
130
130
|
q=facebook:
|
131
131
|
get:
|
132
|
-
with_token: '{"data": [{"id": "507731521_100412693339488"}]}'
|
133
|
-
no_token: '{"data": [{"id": "507731521_100412693339488"}]}'
|
134
|
-
|
135
|
-
|
132
|
+
with_token: '{"data": [{"id": "507731521_100412693339488"}], "paging": {"previous": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000", "next": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000"}}'
|
133
|
+
no_token: '{"data": [{"id": "507731521_100412693339488"}], "paging": {"previous": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000", "next": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000"}}'
|
134
|
+
"limit=25&q=facebook&until=2010-09-23T21:17:33+0000":
|
135
|
+
get:
|
136
|
+
with_token: '{"data": [{"id": "507731521_100412693339488"}], "paging": {"previous": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000", "next": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000"}}'
|
137
|
+
no_token: '{"data": [{"id": "507731521_100412693339488"}], "paging": {"previous": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000", "next": "https:\/\/graph.facebook.com\/7204941866\/photos?limit=25&until=2008-09-15T18%3A30%3A25%2B0000"}}'
|
138
|
+
|
139
|
+
'/115349521819193_113815981982767':
|
136
140
|
no_args:
|
137
141
|
delete:
|
138
142
|
<<: *token_required
|
139
143
|
|
140
144
|
# -- OAuth responses --
|
141
|
-
oauth/access_token:
|
145
|
+
/oauth/access_token:
|
142
146
|
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&code=<%= OAUTH_CODE %>&redirect_uri=<%= OAUTH_DATA["callback_url"] %>:
|
143
147
|
get:
|
144
148
|
no_token: access_token=<%= ACCESS_TOKEN %>
|
@@ -148,18 +152,27 @@ graph_api:
|
|
148
152
|
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&type=client_cred:
|
149
153
|
post:
|
150
154
|
no_token: access_token=<%= ACCESS_TOKEN %>
|
151
|
-
oauth/exchange_sessions:
|
155
|
+
/oauth/exchange_sessions:
|
152
156
|
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=<%= OAUTH_DATA["session_key"] %>&type=client_cred:
|
153
157
|
post:
|
154
158
|
no_token: '[{"access_token":"<%= ACCESS_TOKEN %>","expires":4315}]'
|
155
159
|
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=<%= OAUTH_DATA["multiple_session_keys"].join(",") %>&type=client_cred:
|
156
160
|
post:
|
157
161
|
no_token: '[{"access_token":"<%= ACCESS_TOKEN %>","expires":4315}, {"access_token":"<%= ACCESS_TOKEN %>","expires":4315}]'
|
162
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=<%= ["foo"].concat(OAUTH_DATA["multiple_session_keys"]).join(",") %>&type=client_cred:
|
163
|
+
post:
|
164
|
+
no_token: '[null, {"access_token":"<%= ACCESS_TOKEN %>","expires":4315}, {"access_token":"<%= ACCESS_TOKEN %>","expires":4315}]'
|
165
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=foo,bar&type=client_cred:
|
166
|
+
post:
|
167
|
+
no_token: '[null, null]'
|
168
|
+
client_id=<%= APP_ID %>&client_secret=<%= SECRET %>&sessions=foo&type=client_cred:
|
169
|
+
post:
|
170
|
+
no_token: '[null]'
|
158
171
|
|
159
172
|
|
160
173
|
|
161
174
|
# -- Subscription Responses --
|
162
|
-
|
175
|
+
/<%= APP_ID %>/subscriptions:
|
163
176
|
callback_url=<%= SUBSCRIPTION_DATA["subscription_path"] %>&fields=name&object=user&verify_token=<%= SUBSCRIPTION_DATA["verify_token"] %>:
|
164
177
|
post:
|
165
178
|
with_token:
|
@@ -191,37 +204,37 @@ graph_api:
|
|
191
204
|
|
192
205
|
# -- Mock Item Responses --
|
193
206
|
|
194
|
-
MOCK_FEED_ITEM/likes:
|
207
|
+
/MOCK_FEED_ITEM/likes:
|
195
208
|
no_args:
|
196
209
|
post:
|
197
210
|
with_token: '{"id": "MOCK_LIKE"}'
|
198
211
|
|
199
|
-
MOCK_FEED_ITEM/comments:
|
212
|
+
/MOCK_FEED_ITEM/comments:
|
200
213
|
message=it's my comment!:
|
201
214
|
post:
|
202
215
|
with_token: '{"id": "MOCK_COMMENT"}'
|
203
216
|
|
204
|
-
MOCK_FEED_ITEM:
|
217
|
+
/MOCK_FEED_ITEM:
|
205
218
|
no_args:
|
206
219
|
<<: *item_deleted
|
207
220
|
|
208
|
-
FEED_ITEM_CONTEXT:
|
221
|
+
/FEED_ITEM_CONTEXT:
|
209
222
|
no_args:
|
210
223
|
<<: *item_deleted
|
211
224
|
get:
|
212
225
|
with_token: '{"link":"http://www.contextoptional.com/", "name": "Context Optional"}'
|
213
226
|
|
214
|
-
FEED_ITEM_CATS:
|
227
|
+
/FEED_ITEM_CATS:
|
215
228
|
no_args:
|
216
229
|
<<: *item_deleted
|
217
230
|
get:
|
218
231
|
with_token: '{"message": "the cats are asleep"}'
|
219
232
|
|
220
|
-
FEED_ITEM_DELETE:
|
233
|
+
/FEED_ITEM_DELETE:
|
221
234
|
no_args:
|
222
235
|
<<: *item_deleted
|
223
236
|
|
224
|
-
MOCK_COMMENT:
|
237
|
+
/MOCK_COMMENT:
|
225
238
|
no_args:
|
226
239
|
<<: *item_deleted
|
227
240
|
get:
|
data/spec/mock_http_service.rb
CHANGED
@@ -33,7 +33,7 @@ module Koala
|
|
33
33
|
base.class_eval do
|
34
34
|
|
35
35
|
def self.make_request(path, args, verb, options = {})
|
36
|
-
path = 'root' if path == ''
|
36
|
+
path = 'root' if path == '' || path == '/'
|
37
37
|
verb ||= 'get'
|
38
38
|
server = options[:rest_api] ? 'rest_api' : 'graph_api'
|
39
39
|
with_token = args.delete('access_token') == ACCESS_TOKEN ? 'with_token' : 'no_token'
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 9
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.9.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Alex Koppel, Chris Baclig, Rafi Jacoby, Context Optional
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-09-30 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -37,6 +37,20 @@ files:
|
|
37
37
|
- LICENSE
|
38
38
|
- Manifest
|
39
39
|
- Rakefile
|
40
|
+
- examples/oauth_playground/Capfile
|
41
|
+
- examples/oauth_playground/LICENSE
|
42
|
+
- examples/oauth_playground/Rakefile
|
43
|
+
- examples/oauth_playground/config.ru
|
44
|
+
- examples/oauth_playground/config/deploy.rb
|
45
|
+
- examples/oauth_playground/config/facebook.yml
|
46
|
+
- examples/oauth_playground/lib/load_facebook.rb
|
47
|
+
- examples/oauth_playground/lib/oauth_playground.rb
|
48
|
+
- examples/oauth_playground/readme.md
|
49
|
+
- examples/oauth_playground/spec/oauth_playground_spec.rb
|
50
|
+
- examples/oauth_playground/spec/spec_helper.rb
|
51
|
+
- examples/oauth_playground/tmp/restart.txt
|
52
|
+
- examples/oauth_playground/views/index.erb
|
53
|
+
- examples/oauth_playground/views/layout.erb
|
40
54
|
- init.rb
|
41
55
|
- koala.gemspec
|
42
56
|
- lib/koala.rb
|
@@ -51,6 +65,7 @@ files:
|
|
51
65
|
- spec/koala/graph_and_rest_api/graph_and_rest_api_with_token_tests.rb
|
52
66
|
- spec/koala/graph_api/graph_api_no_access_token_tests.rb
|
53
67
|
- spec/koala/graph_api/graph_api_with_access_token_tests.rb
|
68
|
+
- spec/koala/graph_api/graph_collection_tests.rb
|
54
69
|
- spec/koala/live_testing_data_helper.rb
|
55
70
|
- spec/koala/net_http_service_tests.rb
|
56
71
|
- spec/koala/oauth/oauth_tests.rb
|