koala 0.9.0 → 1.0.0.beta
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/CHANGELOG +33 -7
- data/Manifest +6 -14
- data/Rakefile +4 -3
- data/koala.gemspec +13 -8
- data/lib/koala/graph_api.rb +16 -3
- data/lib/koala/http_services.rb +100 -16
- data/lib/koala/rest_api.rb +73 -6
- data/lib/koala/test_users.rb +72 -0
- data/lib/koala.rb +101 -71
- data/readme.md +14 -13
- data/spec/facebook_data.yml +14 -8
- data/spec/koala/api_base_tests.rb +7 -0
- data/spec/koala/assets/beach.jpg +0 -0
- data/spec/koala/graph_and_rest_api/graph_and_rest_api_no_token_tests.rb +5 -1
- data/spec/koala/graph_and_rest_api/graph_and_rest_api_with_token_tests.rb +9 -4
- data/spec/koala/graph_api/graph_api_no_access_token_tests.rb +10 -61
- data/spec/koala/graph_api/graph_api_tests.rb +86 -0
- data/spec/koala/graph_api/graph_api_with_access_token_tests.rb +130 -126
- data/spec/koala/graph_api/graph_collection_tests.rb +2 -2
- data/spec/koala/live_testing_data_helper.rb +40 -12
- data/spec/koala/net_http_service_tests.rb +401 -152
- data/spec/koala/oauth/oauth_tests.rb +41 -72
- data/spec/koala/rest_api/rest_api_no_access_token_tests.rb +7 -76
- data/spec/koala/rest_api/rest_api_tests.rb +118 -0
- data/spec/koala/rest_api/rest_api_with_access_token_tests.rb +6 -4
- data/spec/koala/test_users/test_users_tests.rb +208 -0
- data/spec/koala/typhoeus_service_tests.rb +156 -0
- data/spec/koala_spec_helper.rb +43 -4
- data/spec/koala_spec_without_mocks.rb +4 -4
- data/spec/mock_facebook_responses.yml +69 -3
- data/spec/mock_http_service.rb +16 -1
- metadata +49 -23
- data/examples/oauth_playground/Capfile +0 -2
- data/examples/oauth_playground/LICENSE +0 -22
- data/examples/oauth_playground/Rakefile +0 -4
- data/examples/oauth_playground/config/deploy.rb +0 -39
- data/examples/oauth_playground/config/facebook.yml +0 -13
- data/examples/oauth_playground/config.ru +0 -27
- data/examples/oauth_playground/lib/load_facebook.rb +0 -3
- data/examples/oauth_playground/lib/oauth_playground.rb +0 -187
- data/examples/oauth_playground/readme.md +0 -8
- data/examples/oauth_playground/spec/oauth_playground_spec.rb +0 -35
- data/examples/oauth_playground/spec/spec_helper.rb +0 -36
- data/examples/oauth_playground/tmp/restart.txt +0 -0
- data/examples/oauth_playground/views/index.erb +0 -206
- data/examples/oauth_playground/views/layout.erb +0 -39
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
require 'koala/http_services'
|
|
2
|
+
class TyphoeusServiceTests < Test::Unit::TestCase
|
|
3
|
+
module Bear
|
|
4
|
+
include Koala::TyphoeusService
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
describe "TyphoeusService module holder class Bear" do
|
|
8
|
+
before :each do
|
|
9
|
+
# reset the always_use_ssl parameter
|
|
10
|
+
Bear.always_use_ssl = nil
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "should define a make_request static module method" do
|
|
14
|
+
Bear.respond_to?(:make_request).should be_true
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should include the Koala::HTTPService module defining common features" do
|
|
18
|
+
Bear.included_modules.include?(Koala::HTTPService).should be_true
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe "when making a request" do
|
|
22
|
+
before(:each) do
|
|
23
|
+
# Setup stubs for make_request to execute without exceptions
|
|
24
|
+
@mock_body = stub('Typhoeus response body')
|
|
25
|
+
@mock_headers_hash = stub({:value => "headers hash"})
|
|
26
|
+
@mock_http_response = stub(Typhoeus::Response, :code => 1, :headers_hash => @mock_headers_hash, :body => @mock_body)
|
|
27
|
+
|
|
28
|
+
# Typhoeus is an included module, so we stub methods on Bear itself
|
|
29
|
+
Bear.stub(:post).and_return(@mock_http_response)
|
|
30
|
+
Bear.stub(:get).and_return(@mock_http_response)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "should use POST if verb is not GET" do
|
|
34
|
+
Bear.should_receive(:post).and_return(@mock_http_response)
|
|
35
|
+
Bear.make_request('anything', {}, 'anything')
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "should use GET if that verb is specified" do
|
|
39
|
+
Bear.should_receive(:get).and_return(@mock_http_response)
|
|
40
|
+
Bear.make_request('anything', {}, 'get')
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe "the connection" do
|
|
44
|
+
it "should use SSL if the request has an access token" do
|
|
45
|
+
Bear.should_receive(:post).with(/https\:/, anything)
|
|
46
|
+
|
|
47
|
+
Bear.make_request('anything', {"access_token" => "123"}, 'anything')
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it "should use SSL if always_use_ssl is true, even if there's no token" do
|
|
51
|
+
Bear.should_receive(:post).with(/https\:/, anything)
|
|
52
|
+
|
|
53
|
+
Bear.always_use_ssl = true
|
|
54
|
+
Bear.make_request('anything', {}, 'anything')
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it "should use SSL if the :use_ssl option is provided, even if there's no token" do
|
|
58
|
+
Bear.should_receive(:post).with(/https\:/, anything)
|
|
59
|
+
|
|
60
|
+
Bear.always_use_ssl = true
|
|
61
|
+
Bear.make_request('anything', {}, 'anything', :use_ssl => true)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it "should not use SSL if always_use_ssl is false and there's no token" do
|
|
65
|
+
Bear.should_receive(:post).with(/http\:/, anything)
|
|
66
|
+
|
|
67
|
+
Bear.make_request('anything', {}, 'anything')
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it "should use the graph server by default" do
|
|
71
|
+
Bear.should_receive(:post).with(Regexp.new(Koala::Facebook::GRAPH_SERVER), anything)
|
|
72
|
+
|
|
73
|
+
Bear.make_request('anything', {}, 'anything')
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it "should use the REST server if the :rest_api option is true" do
|
|
77
|
+
Bear.should_receive(:post).with(Regexp.new(Koala::Facebook::REST_SERVER), anything)
|
|
78
|
+
|
|
79
|
+
Bear.make_request('anything', {}, 'anything', :rest_api => true)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it "should pass the arguments to Typhoeus under the :params key" do
|
|
84
|
+
args = {:a => 2}
|
|
85
|
+
Bear.should_receive(:post).with(anything, hash_including(:params => args))
|
|
86
|
+
|
|
87
|
+
Bear.make_request('anything', args, "post")
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it "should add the method to the arguments if the method isn't get or post" do
|
|
91
|
+
method = "telekenesis"
|
|
92
|
+
Bear.should_receive(:post).with(anything, hash_including(:params => {:method => method}))
|
|
93
|
+
|
|
94
|
+
Bear.make_request('anything', {}, method)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
it "should pass :typhoeus_options to Typhoeus if provided" do
|
|
98
|
+
t_options = {:a => :b}
|
|
99
|
+
Bear.should_receive(:post).with(anything, hash_including(t_options))
|
|
100
|
+
|
|
101
|
+
Bear.make_request("anything", {}, "post", :typhoeus_options => t_options)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
it "should include the path in the request" do
|
|
105
|
+
path = "/a/b/c/1"
|
|
106
|
+
Bear.should_receive(:post).with(Regexp.new(path), anything)
|
|
107
|
+
|
|
108
|
+
Bear.make_request(path, {}, "post")
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
describe "the returned value" do
|
|
112
|
+
before(:each) do
|
|
113
|
+
@response = Bear.make_request('anything', {}, 'anything')
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
it "should return a Koala::Response object" do
|
|
117
|
+
@response.class.should == Koala::Response
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
it "should return a Koala::Response with the right status" do
|
|
121
|
+
@response.status.should == @mock_http_response.code
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
it "should reutrn a Koala::Response with the right body" do
|
|
125
|
+
@response.body.should == @mock_body
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
it "should return a Koala::Response with the Net::HTTPResponse object as headers" do
|
|
129
|
+
@response.headers.should == @mock_headers_hash
|
|
130
|
+
end
|
|
131
|
+
end # describe return value
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
describe "with file upload" do
|
|
135
|
+
it "should include an interface to NetHTTPService called NetHTTPInterface" do
|
|
136
|
+
# we should be able to access it
|
|
137
|
+
lambda { Koala::TyphoeusService::NetHTTPInterface }.should_not raise_exception(Exception)
|
|
138
|
+
Koala::TyphoeusService::NetHTTPInterface.included_modules.include?(Koala::NetHTTPService).should be_true
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
it "should call the NetHTTPInterface if multipart is required" do
|
|
142
|
+
method = "any_method"
|
|
143
|
+
args = {}
|
|
144
|
+
verb = "get"
|
|
145
|
+
options = {}
|
|
146
|
+
|
|
147
|
+
Bear.stub(:params_require_multipart?).and_return(true)
|
|
148
|
+
Koala::TyphoeusService::NetHTTPInterface.should_receive(:make_request).with(method, args, verb, options)
|
|
149
|
+
|
|
150
|
+
Bear.make_request(method, args, verb, options)
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# for live tests, run the Graph API tests with Typhoues, which will run file uploads
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
end
|
data/spec/koala_spec_helper.rb
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
require '
|
|
3
|
-
require '
|
|
1
|
+
if defined?(RUBY_VERSION) && RUBY_VERSION =~ /1\.9/
|
|
2
|
+
require 'test/unit'
|
|
3
|
+
require 'rspec'
|
|
4
|
+
|
|
5
|
+
Rspec.configure do |c|
|
|
6
|
+
c.mock_with :rspec
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
else
|
|
10
|
+
# Ruby 1.8.x
|
|
11
|
+
require 'test/unit'
|
|
12
|
+
require 'rubygems'
|
|
13
|
+
|
|
14
|
+
require 'spec/test/unit'
|
|
15
|
+
end
|
|
4
16
|
|
|
5
17
|
# load the libraries
|
|
6
18
|
require 'koala'
|
|
@@ -11,10 +23,12 @@ require 'koala/live_testing_data_helper'
|
|
|
11
23
|
# API tests
|
|
12
24
|
require 'koala/api_base_tests'
|
|
13
25
|
|
|
26
|
+
require 'koala/graph_api/graph_api_tests'
|
|
14
27
|
require 'koala/graph_api/graph_collection_tests'
|
|
15
28
|
require 'koala/graph_api/graph_api_no_access_token_tests'
|
|
16
29
|
require 'koala/graph_api/graph_api_with_access_token_tests'
|
|
17
30
|
|
|
31
|
+
require 'koala/rest_api/rest_api_tests'
|
|
18
32
|
require 'koala/rest_api/rest_api_no_access_token_tests'
|
|
19
33
|
require 'koala/rest_api/rest_api_with_access_token_tests'
|
|
20
34
|
|
|
@@ -27,5 +41,30 @@ require 'koala/oauth/oauth_tests'
|
|
|
27
41
|
# Subscriptions tests
|
|
28
42
|
require 'koala/realtime_updates/realtime_updates_tests'
|
|
29
43
|
|
|
44
|
+
# Test users tests
|
|
45
|
+
require 'koala/test_users/test_users_tests'
|
|
46
|
+
|
|
30
47
|
# Services tests
|
|
31
|
-
require 'koala/net_http_service_tests'
|
|
48
|
+
require 'koala/net_http_service_tests'
|
|
49
|
+
begin
|
|
50
|
+
require 'koala/typhoeus_service_tests'
|
|
51
|
+
rescue LoadError
|
|
52
|
+
puts "Typhoeus tests will not be run because Typhoeus is not installed."
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
module KoalaTest
|
|
56
|
+
def self.validate_user_info(token)
|
|
57
|
+
print "Validating permissions for live testing..."
|
|
58
|
+
# make sure we have the necessary permissions
|
|
59
|
+
api = Koala::Facebook::GraphAndRestAPI.new(token)
|
|
60
|
+
uid = api.get_object("me")["id"]
|
|
61
|
+
perms = api.fql_query("select read_stream, publish_stream, user_photos from permissions where uid = #{uid}")[0]
|
|
62
|
+
perms.each_pair do |perm, value|
|
|
63
|
+
unless value == 1
|
|
64
|
+
puts "failed!\n" # put a new line after the print above
|
|
65
|
+
raise ArgumentError, "Your access token must have the read_stream, publish_stream, and user_photos permissions. You have: #{perms.inspect}"
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
puts "done!"
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -6,8 +6,6 @@ require 'koala_spec_helper'
|
|
|
6
6
|
# specs to run. See facebook_data.yml for more information.
|
|
7
7
|
|
|
8
8
|
# load testing data (see note in readme.md)
|
|
9
|
-
# I'm seeing a bug with spec and gets where the facebook_test_suite.rb file gets read in when gets is called
|
|
10
|
-
# until that's solved, we'll need to store/update tokens in the access_token file
|
|
11
9
|
$testing_data = YAML.load_file(File.join(File.dirname(__FILE__), 'facebook_data.yml')) rescue {}
|
|
12
10
|
|
|
13
11
|
unless $testing_data["oauth_token"]
|
|
@@ -15,5 +13,7 @@ unless $testing_data["oauth_token"]
|
|
|
15
13
|
end
|
|
16
14
|
|
|
17
15
|
unless $testing_data["oauth_test_data"] && $testing_data["oauth_test_data"]["code"] && $testing_data["oauth_test_data"]["secret"]
|
|
18
|
-
puts "
|
|
19
|
-
end
|
|
16
|
+
puts "OAuth code tests will fail until you store valid data for the user's OAuth code and the app secret in facebook_data.yml"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
KoalaTest.validate_user_info $testing_data["oauth_token"]
|
|
@@ -46,6 +46,10 @@ graph_api:
|
|
|
46
46
|
# Subscription error response
|
|
47
47
|
verification_error: &verification_error
|
|
48
48
|
with_token: '{"error": {"type": "OAuthException", "message": "Error validating verification code."}}'
|
|
49
|
+
|
|
50
|
+
test_user_no_perms: &test_user_no_perms
|
|
51
|
+
post:
|
|
52
|
+
with_token: '{"id": "777777777", "access_token":"119908831367602|o3wswWQ88LYjEC9-ukR_gjRIOMw.", "login_url":"https://www.facebook.com/platform/test_account.."}'
|
|
49
53
|
|
|
50
54
|
# -- Stubbed Responses --
|
|
51
55
|
root:
|
|
@@ -78,7 +82,15 @@ graph_api:
|
|
|
78
82
|
link=http://www.contextoptional.com/&message=Hello, world, from the test suite again!&name=Context Optional:
|
|
79
83
|
post:
|
|
80
84
|
with_token: '{"id": "FEED_ITEM_CONTEXT"}'
|
|
81
|
-
|
|
85
|
+
/me/photos:
|
|
86
|
+
source=[FILE]:
|
|
87
|
+
post:
|
|
88
|
+
<<: *token_required
|
|
89
|
+
with_token: '{"id": "MOCK_PHOTO"}'
|
|
90
|
+
message=This is the test message&source=[FILE]:
|
|
91
|
+
post:
|
|
92
|
+
<<: *token_required
|
|
93
|
+
with_token: '{"id": "MOCK_PHOTO"}'
|
|
82
94
|
/koppel:
|
|
83
95
|
no_args:
|
|
84
96
|
get:
|
|
@@ -233,9 +245,63 @@ graph_api:
|
|
|
233
245
|
/FEED_ITEM_DELETE:
|
|
234
246
|
no_args:
|
|
235
247
|
<<: *item_deleted
|
|
236
|
-
|
|
248
|
+
|
|
249
|
+
/FEED_ITEM_DELETE/likes:
|
|
250
|
+
no_args:
|
|
251
|
+
<<: *item_deleted
|
|
252
|
+
post:
|
|
253
|
+
with_token: 'true'
|
|
254
|
+
|
|
237
255
|
/MOCK_COMMENT:
|
|
238
256
|
no_args:
|
|
239
257
|
<<: *item_deleted
|
|
240
258
|
get:
|
|
241
|
-
with_token: "{\"message\": \"it\'s my comment!\"}"
|
|
259
|
+
with_token: "{\"message\": \"it\'s my comment!\"}"
|
|
260
|
+
/MOCK_PHOTO:
|
|
261
|
+
no_args:
|
|
262
|
+
<<: *item_deleted
|
|
263
|
+
get:
|
|
264
|
+
with_token: "{\"name\": \"This is the test message\"}"
|
|
265
|
+
|
|
266
|
+
# -- Mock Test User Responses --
|
|
267
|
+
/<%= APP_ID %>/accounts/test-users:
|
|
268
|
+
installed=false:
|
|
269
|
+
<<: *test_user_no_perms
|
|
270
|
+
installed=false&permissions=read_stream:
|
|
271
|
+
<<: *test_user_no_perms
|
|
272
|
+
installed=true&permissions=read_stream:
|
|
273
|
+
post:
|
|
274
|
+
with_token: '{"id": "999999999", "access_token":"119908831367602|o3wswWQ88LYjEC9-ukR_gjRIOMw.", "login_url":"https://www.facebook.com/platform/test_account.."}'
|
|
275
|
+
installed=true&permissions=read_stream,user_interests:
|
|
276
|
+
post:
|
|
277
|
+
with_token: '{"id": "888888888", "access_token":"119908831367602|o3wswWQ88LYjEC9-ukR_gjRIOMw.", "login_url":"https://www.facebook.com/platform/test_account.."}'
|
|
278
|
+
no_args:
|
|
279
|
+
get:
|
|
280
|
+
with_token: '{"data":[{"id": "999999999", "access_token":"119908831367602|o3wswWQ88LYjEC9-ukR_gjRIOMw.", "login_url":"https://www.facebook.com/platform/test_account.."}, {"id": "888888888", "access_token":"119908831367602|o3wswWQ88LYjEC9-ukR_gjRIOMw.", "login_url":"https://www.facebook.com/platform/test_account.."}]}'
|
|
281
|
+
|
|
282
|
+
/999999999:
|
|
283
|
+
no_args:
|
|
284
|
+
<<: *item_deleted
|
|
285
|
+
|
|
286
|
+
/9999999991:
|
|
287
|
+
no_args:
|
|
288
|
+
delete:
|
|
289
|
+
with_token: '{"error": {"type": "OAuthException", "message": "Error validating verification code."}}'
|
|
290
|
+
|
|
291
|
+
/888888888:
|
|
292
|
+
no_args:
|
|
293
|
+
<<: *item_deleted
|
|
294
|
+
|
|
295
|
+
/777777777:
|
|
296
|
+
no_args:
|
|
297
|
+
<<: *item_deleted
|
|
298
|
+
|
|
299
|
+
/999999999/friends/888888888:
|
|
300
|
+
no_args:
|
|
301
|
+
get:
|
|
302
|
+
with_token: 'true'
|
|
303
|
+
|
|
304
|
+
/888888888/friends/999999999:
|
|
305
|
+
no_args:
|
|
306
|
+
get:
|
|
307
|
+
with_token: 'true'
|
data/spec/mock_http_service.rb
CHANGED
|
@@ -4,6 +4,7 @@ require 'yaml'
|
|
|
4
4
|
module Koala
|
|
5
5
|
module MockHTTPService
|
|
6
6
|
# Mocks all HTTP requests for with koala_spec_with_mocks.rb
|
|
7
|
+
IS_MOCK = true # this lets our tests figure out if we want to stub methods
|
|
7
8
|
|
|
8
9
|
# Mocked values to be included in TEST_DATA used in specs
|
|
9
10
|
ACCESS_TOKEN = '*'
|
|
@@ -32,6 +33,8 @@ module Koala
|
|
|
32
33
|
def self.included(base)
|
|
33
34
|
base.class_eval do
|
|
34
35
|
|
|
36
|
+
include Koala::HTTPService
|
|
37
|
+
|
|
35
38
|
def self.make_request(path, args, verb, options = {})
|
|
36
39
|
path = 'root' if path == '' || path == '/'
|
|
37
40
|
verb ||= 'get'
|
|
@@ -42,7 +45,7 @@ module Koala
|
|
|
42
45
|
args.delete('format')
|
|
43
46
|
|
|
44
47
|
# Create a hash key for the arguments
|
|
45
|
-
args = args
|
|
48
|
+
args = create_params_key(args)
|
|
46
49
|
|
|
47
50
|
begin
|
|
48
51
|
response = RESPONSES[server][path][args][verb][with_token]
|
|
@@ -75,6 +78,18 @@ module Koala
|
|
|
75
78
|
response_object
|
|
76
79
|
end
|
|
77
80
|
|
|
81
|
+
protected
|
|
82
|
+
def self.create_params_key(params_hash)
|
|
83
|
+
if params_hash.empty?
|
|
84
|
+
'no_args'
|
|
85
|
+
else
|
|
86
|
+
params_hash.sort{ |a,b| a[0].to_s <=> b[0].to_s}.map do |arr|
|
|
87
|
+
arr[1] = '[FILE]' if arr[1].kind_of?(File) || is_valid_file_hash?(arr[1])
|
|
88
|
+
arr.join('=')
|
|
89
|
+
end.join('&')
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
78
93
|
end # class_eval
|
|
79
94
|
end # included
|
|
80
95
|
end
|
metadata
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: koala
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
4
|
+
hash: 31098193
|
|
5
|
+
prerelease: 6
|
|
5
6
|
segments:
|
|
7
|
+
- 1
|
|
6
8
|
- 0
|
|
7
|
-
- 9
|
|
8
9
|
- 0
|
|
9
|
-
|
|
10
|
+
- beta
|
|
11
|
+
version: 1.0.0.beta
|
|
10
12
|
platform: ruby
|
|
11
13
|
authors:
|
|
12
14
|
- Alex Koppel, Chris Baclig, Rafi Jacoby, Context Optional
|
|
@@ -14,10 +16,39 @@ autorequire:
|
|
|
14
16
|
bindir: bin
|
|
15
17
|
cert_chain: []
|
|
16
18
|
|
|
17
|
-
date:
|
|
19
|
+
date: 2011-01-26 00:00:00 +01:00
|
|
18
20
|
default_executable:
|
|
19
|
-
dependencies:
|
|
20
|
-
|
|
21
|
+
dependencies:
|
|
22
|
+
- !ruby/object:Gem::Dependency
|
|
23
|
+
name: json
|
|
24
|
+
prerelease: false
|
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
26
|
+
none: false
|
|
27
|
+
requirements:
|
|
28
|
+
- - ">="
|
|
29
|
+
- !ruby/object:Gem::Version
|
|
30
|
+
hash: 15
|
|
31
|
+
segments:
|
|
32
|
+
- 1
|
|
33
|
+
- 0
|
|
34
|
+
version: "1.0"
|
|
35
|
+
type: :runtime
|
|
36
|
+
version_requirements: *id001
|
|
37
|
+
- !ruby/object:Gem::Dependency
|
|
38
|
+
name: multipart-post
|
|
39
|
+
prerelease: false
|
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
42
|
+
requirements:
|
|
43
|
+
- - ">="
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
hash: 15
|
|
46
|
+
segments:
|
|
47
|
+
- 1
|
|
48
|
+
- 0
|
|
49
|
+
version: "1.0"
|
|
50
|
+
type: :runtime
|
|
51
|
+
version_requirements: *id002
|
|
21
52
|
description: Koala is a lightweight, flexible Ruby SDK for Facebook. It allows read/write access to the social graph via the Graph API and the older REST API, as well as support for realtime updates and OAuth and Facebook Connect authentication. Koala is fully tested and supports Net::HTTP and Typhoeus connections out of the box and can accept custom modules for other services.
|
|
22
53
|
email: alex@alexkoppel.com
|
|
23
54
|
executables: []
|
|
@@ -32,25 +63,12 @@ extra_rdoc_files:
|
|
|
32
63
|
- lib/koala/http_services.rb
|
|
33
64
|
- lib/koala/realtime_updates.rb
|
|
34
65
|
- lib/koala/rest_api.rb
|
|
66
|
+
- lib/koala/test_users.rb
|
|
35
67
|
files:
|
|
36
68
|
- CHANGELOG
|
|
37
69
|
- LICENSE
|
|
38
70
|
- Manifest
|
|
39
71
|
- 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
|
|
54
72
|
- init.rb
|
|
55
73
|
- koala.gemspec
|
|
56
74
|
- lib/koala.rb
|
|
@@ -58,12 +76,15 @@ files:
|
|
|
58
76
|
- lib/koala/http_services.rb
|
|
59
77
|
- lib/koala/realtime_updates.rb
|
|
60
78
|
- lib/koala/rest_api.rb
|
|
79
|
+
- lib/koala/test_users.rb
|
|
61
80
|
- readme.md
|
|
62
81
|
- spec/facebook_data.yml
|
|
63
82
|
- spec/koala/api_base_tests.rb
|
|
83
|
+
- spec/koala/assets/beach.jpg
|
|
64
84
|
- spec/koala/graph_and_rest_api/graph_and_rest_api_no_token_tests.rb
|
|
65
85
|
- spec/koala/graph_and_rest_api/graph_and_rest_api_with_token_tests.rb
|
|
66
86
|
- spec/koala/graph_api/graph_api_no_access_token_tests.rb
|
|
87
|
+
- spec/koala/graph_api/graph_api_tests.rb
|
|
67
88
|
- spec/koala/graph_api/graph_api_with_access_token_tests.rb
|
|
68
89
|
- spec/koala/graph_api/graph_collection_tests.rb
|
|
69
90
|
- spec/koala/live_testing_data_helper.rb
|
|
@@ -71,7 +92,10 @@ files:
|
|
|
71
92
|
- spec/koala/oauth/oauth_tests.rb
|
|
72
93
|
- spec/koala/realtime_updates/realtime_updates_tests.rb
|
|
73
94
|
- spec/koala/rest_api/rest_api_no_access_token_tests.rb
|
|
95
|
+
- spec/koala/rest_api/rest_api_tests.rb
|
|
74
96
|
- spec/koala/rest_api/rest_api_with_access_token_tests.rb
|
|
97
|
+
- spec/koala/test_users/test_users_tests.rb
|
|
98
|
+
- spec/koala/typhoeus_service_tests.rb
|
|
75
99
|
- spec/koala_spec.rb
|
|
76
100
|
- spec/koala_spec_helper.rb
|
|
77
101
|
- spec/koala_spec_without_mocks.rb
|
|
@@ -87,21 +111,23 @@ rdoc_options:
|
|
|
87
111
|
- --inline-source
|
|
88
112
|
- --title
|
|
89
113
|
- Koala
|
|
90
|
-
- --main
|
|
91
|
-
- readme.md
|
|
92
114
|
require_paths:
|
|
93
115
|
- lib
|
|
94
116
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
117
|
+
none: false
|
|
95
118
|
requirements:
|
|
96
119
|
- - ">="
|
|
97
120
|
- !ruby/object:Gem::Version
|
|
121
|
+
hash: 3
|
|
98
122
|
segments:
|
|
99
123
|
- 0
|
|
100
124
|
version: "0"
|
|
101
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
|
+
none: false
|
|
102
127
|
requirements:
|
|
103
128
|
- - ">="
|
|
104
129
|
- !ruby/object:Gem::Version
|
|
130
|
+
hash: 11
|
|
105
131
|
segments:
|
|
106
132
|
- 1
|
|
107
133
|
- 2
|
|
@@ -109,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
109
135
|
requirements: []
|
|
110
136
|
|
|
111
137
|
rubyforge_project: koala
|
|
112
|
-
rubygems_version: 1.
|
|
138
|
+
rubygems_version: 1.4.2
|
|
113
139
|
signing_key:
|
|
114
140
|
specification_version: 3
|
|
115
141
|
summary: A lightweight, flexible library for Facebook with support for the Graph API, the old REST API, realtime updates, and OAuth validation.
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2010 Alex Koppel
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person
|
|
4
|
-
obtaining a copy of this software and associated documentation
|
|
5
|
-
files (the "Software"), to deal in the Software without
|
|
6
|
-
restriction, including without limitation the rights to use,
|
|
7
|
-
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
copies of the Software, and to permit persons to whom the
|
|
9
|
-
Software is furnished to do so, subject to the following
|
|
10
|
-
conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be
|
|
13
|
-
included in all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
17
|
-
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
19
|
-
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
20
|
-
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
21
|
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
-
OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
set :application, "oauth_playground"
|
|
2
|
-
set :repository, "git://github.com/arsduo/oauth_playground.git"
|
|
3
|
-
set :domain, "oauth.twoalex.com"
|
|
4
|
-
set :deploy_to, "$HOME/rails_apps/#{application}/"
|
|
5
|
-
|
|
6
|
-
# authentication
|
|
7
|
-
set :scm, "git"
|
|
8
|
-
set :user, "alexkm"
|
|
9
|
-
set :use_sudo, false
|
|
10
|
-
ssh_options[:forward_agent] = true
|
|
11
|
-
|
|
12
|
-
# web server
|
|
13
|
-
role :web, "oauth.twoalex.com" # Your HTTP server, Apache/etc
|
|
14
|
-
role :app, "oauth.twoalex.com" # This may be the same as your `Web` server
|
|
15
|
-
role :db, "oauth.twoalex.com", :primary => true # This is where Rails migrations will run
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
# other git-related commands
|
|
19
|
-
set :branch, "master"
|
|
20
|
-
default_run_options[:pty] = true
|
|
21
|
-
# cache the repository locally to speed updates
|
|
22
|
-
set :repository_cache, "git_cache"
|
|
23
|
-
set :deploy_via, :remote_cache
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
# passenger-specific deploy tasks
|
|
27
|
-
namespace :deploy do
|
|
28
|
-
task :start do
|
|
29
|
-
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
task :stop do
|
|
33
|
-
# nothing
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
task :restart, :roles => :app, :except => { :no_release => true } do
|
|
37
|
-
run "touch #{File.join(current_path,'tmp','restart.txt')}"
|
|
38
|
-
end
|
|
39
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
development:
|
|
2
|
-
api_key: 171e3563d4fee42e0ba27450838bba32
|
|
3
|
-
secret_key: c81302ccef57cbdd2e68b2229e54cd2f
|
|
4
|
-
app_id: 119347844754245
|
|
5
|
-
|
|
6
|
-
test:
|
|
7
|
-
api_key:
|
|
8
|
-
secret_key:
|
|
9
|
-
|
|
10
|
-
production:
|
|
11
|
-
api_key: 25e1cec0df2b3bfa781da3ed78da3a1e
|
|
12
|
-
secret_key: e45e55a333eec232d4206d2703de1307
|
|
13
|
-
app_id: 119908831367602
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# gems
|
|
2
|
-
require 'sinatra'
|
|
3
|
-
require 'logger'
|
|
4
|
-
require 'yaml'
|
|
5
|
-
|
|
6
|
-
# app files
|
|
7
|
-
require 'koala'
|
|
8
|
-
require File.join(File.dirname(__FILE__), 'lib', 'load_facebook.rb')
|
|
9
|
-
require File.join(File.dirname(__FILE__), 'lib', 'oauth_playground.rb')
|
|
10
|
-
|
|
11
|
-
# LOGGING
|
|
12
|
-
# set up the logfile
|
|
13
|
-
Dir.mkdir('log') unless File.exists?('log')
|
|
14
|
-
log_filename = File.join(File.dirname(__FILE__), "log", "sinatra.log")
|
|
15
|
-
log = File.new(log_filename, "a+")
|
|
16
|
-
|
|
17
|
-
# log requests
|
|
18
|
-
use Rack::CommonLogger, log
|
|
19
|
-
# log application-generated code
|
|
20
|
-
LOGGER = Logger.new(log_filename)
|
|
21
|
-
# log output to stdout and stderr as well
|
|
22
|
-
$stdout.reopen(log)
|
|
23
|
-
$stderr.reopen(log)
|
|
24
|
-
|
|
25
|
-
# activate the app
|
|
26
|
-
disable :run
|
|
27
|
-
run OAuthPlayground
|