koala 1.2.0beta1 → 1.2.0
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 +12 -2
- data/koala.gemspec +7 -8
- data/lib/koala/graph_api.rb +11 -22
- data/lib/koala/graph_batch_api.rb +11 -1
- data/lib/koala/graph_collection.rb +7 -2
- data/lib/koala/http_service.rb +0 -1
- data/lib/koala/oauth.rb +32 -22
- data/lib/koala/realtime_updates.rb +1 -1
- data/lib/koala/test_users.rb +1 -2
- data/lib/koala/uploadable_io.rb +2 -1
- data/lib/koala/version.rb +3 -0
- data/lib/koala.rb +7 -2
- data/readme.md +27 -7
- data/spec/cases/{api_base_spec.rb → api_spec.rb} +25 -0
- data/spec/cases/graph_and_rest_api_spec.rb +0 -26
- data/spec/cases/graph_api_batch_spec.rb +12 -30
- data/spec/cases/graph_api_spec.rb +0 -20
- data/spec/cases/graph_collection_spec.rb +116 -0
- data/spec/cases/koala_spec.rb +7 -3
- data/spec/cases/oauth_spec.rb +130 -43
- data/spec/cases/test_users_spec.rb +11 -23
- data/spec/cases/uploadable_io_spec.rb +28 -0
- data/spec/fixtures/facebook_data.yml +3 -2
- data/spec/fixtures/mock_facebook_responses.yml +5 -5
- data/spec/support/graph_api_shared_examples.rb +23 -70
- data/spec/support/koala_test.rb +30 -6
- data/spec/support/mock_http_service.rb +2 -1
- metadata +19 -29
data/spec/support/koala_test.rb
CHANGED
|
@@ -3,7 +3,7 @@ module KoalaTest
|
|
|
3
3
|
|
|
4
4
|
class << self
|
|
5
5
|
attr_accessor :oauth_token, :app_id, :secret, :app_access_token, :code, :session_key
|
|
6
|
-
attr_accessor :oauth_test_data, :subscription_test_data
|
|
6
|
+
attr_accessor :oauth_test_data, :subscription_test_data, :search_time
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
# Test setup
|
|
@@ -35,6 +35,8 @@ module KoalaTest
|
|
|
35
35
|
rescue LoadError
|
|
36
36
|
puts "Unable to load adapter #{adapter}, using Net::HTTP."
|
|
37
37
|
end
|
|
38
|
+
|
|
39
|
+
Koala.http_service.http_options[:beta] = true if ENV["beta"] || ENV["BETA"]
|
|
38
40
|
|
|
39
41
|
# use a test user unless the developer wants to test against a real profile
|
|
40
42
|
unless token = KoalaTest.oauth_token
|
|
@@ -82,6 +84,9 @@ module KoalaTest
|
|
|
82
84
|
self.secret = data["oauth_test_data"]["secret"]
|
|
83
85
|
self.code = data["oauth_test_data"]["code"]
|
|
84
86
|
self.session_key = data["oauth_test_data"]["session_key"]
|
|
87
|
+
|
|
88
|
+
# fix the search time so it can be used in the mock responses
|
|
89
|
+
self.search_time = data["search_time"] || (Time.now - 3600).to_s
|
|
85
90
|
end
|
|
86
91
|
|
|
87
92
|
def self.testing_permissions
|
|
@@ -95,15 +100,34 @@ module KoalaTest
|
|
|
95
100
|
print "Setting up test users..."
|
|
96
101
|
@test_user_api = Koala::Facebook::TestUsers.new(:app_id => self.app_id, :secret => self.secret)
|
|
97
102
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
+
RSpec.configure do |config|
|
|
104
|
+
config.before :all do
|
|
105
|
+
# before each test module, create two test users with specific names and befriend them
|
|
106
|
+
KoalaTest.create_test_users
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
config.after :all do
|
|
110
|
+
# after each test module, delete the test users to avoid cluttering up the application
|
|
111
|
+
KoalaTest.destroy_test_users
|
|
112
|
+
end
|
|
113
|
+
end
|
|
103
114
|
|
|
104
115
|
puts "done."
|
|
105
116
|
end
|
|
106
117
|
|
|
118
|
+
def self.create_test_users
|
|
119
|
+
@live_testing_user = @test_user_api.create(true, KoalaTest.testing_permissions, :name => KoalaTest.user1_name)
|
|
120
|
+
@live_testing_friend = @test_user_api.create(true, KoalaTest.testing_permissions, :name => KoalaTest.user2_name)
|
|
121
|
+
@test_user_api.befriend(@live_testing_user, @live_testing_friend)
|
|
122
|
+
self.oauth_token = @live_testing_user["access_token"]
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def self.destroy_test_users
|
|
126
|
+
[@live_testing_user, @live_testing_friend].each do |u|
|
|
127
|
+
puts "Unable to delete test user #{u.inspect}" if u && !(@test_user_api.delete(u) rescue false)
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
107
131
|
def self.validate_user_info(token)
|
|
108
132
|
print "Validating permissions for live testing..."
|
|
109
133
|
# make sure we have the necessary permissions
|
|
@@ -18,7 +18,8 @@ module Koala
|
|
|
18
18
|
TEST_DATA = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'fixtures', 'facebook_data.yml'))
|
|
19
19
|
TEST_DATA.merge!('oauth_token' => Koala::MockHTTPService::ACCESS_TOKEN)
|
|
20
20
|
TEST_DATA['oauth_test_data'].merge!('code' => Koala::MockHTTPService::OAUTH_CODE)
|
|
21
|
-
|
|
21
|
+
TEST_DATA['search_time'] = (Time.now - 3600).to_s
|
|
22
|
+
|
|
22
23
|
# Useful in mock_facebook_responses.yml
|
|
23
24
|
OAUTH_DATA = TEST_DATA['oauth_test_data']
|
|
24
25
|
OAUTH_DATA.merge!({
|
metadata
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: koala
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 1.2.0
|
|
5
|
+
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Alex Koppel, Chris Baclig, Rafi Jacoby, Context Optional
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2011-
|
|
13
|
-
default_executable:
|
|
12
|
+
date: 2011-09-27 00:00:00.000000000Z
|
|
14
13
|
dependencies:
|
|
15
14
|
- !ruby/object:Gem::Dependency
|
|
16
15
|
name: multi_json
|
|
17
|
-
requirement: &
|
|
16
|
+
requirement: &70248641333480 !ruby/object:Gem::Requirement
|
|
18
17
|
none: false
|
|
19
18
|
requirements:
|
|
20
19
|
- - ~>
|
|
@@ -22,32 +21,21 @@ dependencies:
|
|
|
22
21
|
version: '1.0'
|
|
23
22
|
type: :runtime
|
|
24
23
|
prerelease: false
|
|
25
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *70248641333480
|
|
26
25
|
- !ruby/object:Gem::Dependency
|
|
27
26
|
name: faraday
|
|
28
|
-
requirement: &
|
|
27
|
+
requirement: &70248641333000 !ruby/object:Gem::Requirement
|
|
29
28
|
none: false
|
|
30
29
|
requirements:
|
|
31
30
|
- - ~>
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.7.
|
|
32
|
+
version: 0.7.0
|
|
34
33
|
type: :runtime
|
|
35
34
|
prerelease: false
|
|
36
|
-
version_requirements: *
|
|
37
|
-
- !ruby/object:Gem::Dependency
|
|
38
|
-
name: faraday-stack
|
|
39
|
-
requirement: &70190931200940 !ruby/object:Gem::Requirement
|
|
40
|
-
none: false
|
|
41
|
-
requirements:
|
|
42
|
-
- - ~>
|
|
43
|
-
- !ruby/object:Gem::Version
|
|
44
|
-
version: 0.1.3
|
|
45
|
-
type: :runtime
|
|
46
|
-
prerelease: false
|
|
47
|
-
version_requirements: *70190931200940
|
|
35
|
+
version_requirements: *70248641333000
|
|
48
36
|
- !ruby/object:Gem::Dependency
|
|
49
37
|
name: rspec
|
|
50
|
-
requirement: &
|
|
38
|
+
requirement: &70248641332520 !ruby/object:Gem::Requirement
|
|
51
39
|
none: false
|
|
52
40
|
requirements:
|
|
53
41
|
- - ~>
|
|
@@ -55,10 +43,10 @@ dependencies:
|
|
|
55
43
|
version: '2.5'
|
|
56
44
|
type: :development
|
|
57
45
|
prerelease: false
|
|
58
|
-
version_requirements: *
|
|
46
|
+
version_requirements: *70248641332520
|
|
59
47
|
- !ruby/object:Gem::Dependency
|
|
60
48
|
name: rake
|
|
61
|
-
requirement: &
|
|
49
|
+
requirement: &70248641332040 !ruby/object:Gem::Requirement
|
|
62
50
|
none: false
|
|
63
51
|
requirements:
|
|
64
52
|
- - ~>
|
|
@@ -66,7 +54,7 @@ dependencies:
|
|
|
66
54
|
version: 0.8.7
|
|
67
55
|
type: :development
|
|
68
56
|
prerelease: false
|
|
69
|
-
version_requirements: *
|
|
57
|
+
version_requirements: *70248641332040
|
|
70
58
|
description: Koala is a lightweight, flexible Ruby SDK for Facebook. It allows read/write
|
|
71
59
|
access to the social graph via the Graph and REST APIs, as well as support for realtime
|
|
72
60
|
updates and OAuth and Facebook Connect authentication. Koala is fully tested and
|
|
@@ -101,12 +89,14 @@ files:
|
|
|
101
89
|
- lib/koala/test_users.rb
|
|
102
90
|
- lib/koala/uploadable_io.rb
|
|
103
91
|
- lib/koala/utils.rb
|
|
92
|
+
- lib/koala/version.rb
|
|
104
93
|
- readme.md
|
|
105
|
-
- spec/cases/
|
|
94
|
+
- spec/cases/api_spec.rb
|
|
106
95
|
- spec/cases/error_spec.rb
|
|
107
96
|
- spec/cases/graph_and_rest_api_spec.rb
|
|
108
97
|
- spec/cases/graph_api_batch_spec.rb
|
|
109
98
|
- spec/cases/graph_api_spec.rb
|
|
99
|
+
- spec/cases/graph_collection_spec.rb
|
|
110
100
|
- spec/cases/http_service_spec.rb
|
|
111
101
|
- spec/cases/koala_spec.rb
|
|
112
102
|
- spec/cases/oauth_spec.rb
|
|
@@ -127,7 +117,6 @@ files:
|
|
|
127
117
|
- spec/support/ordered_hash.rb
|
|
128
118
|
- spec/support/rest_api_shared_examples.rb
|
|
129
119
|
- spec/support/uploadable_io_shared_examples.rb
|
|
130
|
-
has_rdoc: true
|
|
131
120
|
homepage: http://github.com/arsduo/koala
|
|
132
121
|
licenses: []
|
|
133
122
|
post_install_message:
|
|
@@ -146,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
146
135
|
version: '0'
|
|
147
136
|
segments:
|
|
148
137
|
- 0
|
|
149
|
-
hash:
|
|
138
|
+
hash: 2837078681376474267
|
|
150
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
140
|
none: false
|
|
152
141
|
requirements:
|
|
@@ -155,17 +144,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
155
144
|
version: '1.2'
|
|
156
145
|
requirements: []
|
|
157
146
|
rubyforge_project:
|
|
158
|
-
rubygems_version: 1.
|
|
147
|
+
rubygems_version: 1.8.8
|
|
159
148
|
signing_key:
|
|
160
149
|
specification_version: 3
|
|
161
150
|
summary: A lightweight, flexible library for Facebook with support for the Graph API,
|
|
162
151
|
the REST API, realtime updates, and OAuth authentication.
|
|
163
152
|
test_files:
|
|
164
|
-
- spec/cases/
|
|
153
|
+
- spec/cases/api_spec.rb
|
|
165
154
|
- spec/cases/error_spec.rb
|
|
166
155
|
- spec/cases/graph_and_rest_api_spec.rb
|
|
167
156
|
- spec/cases/graph_api_batch_spec.rb
|
|
168
157
|
- spec/cases/graph_api_spec.rb
|
|
158
|
+
- spec/cases/graph_collection_spec.rb
|
|
169
159
|
- spec/cases/http_service_spec.rb
|
|
170
160
|
- spec/cases/koala_spec.rb
|
|
171
161
|
- spec/cases/oauth_spec.rb
|