koala 1.2.0beta4 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1 -0
- data/koala.gemspec +4 -2
- data/lib/koala/version.rb +1 -1
- data/readme.md +21 -14
- data/spec/support/koala_test.rb +1 -1
- metadata +68 -84
data/CHANGELOG
CHANGED
@@ -13,6 +13,7 @@ Updated methods:
|
|
13
13
|
-- Any pageable result will now become a GraphCollection
|
14
14
|
-- Non-pageable results from get_connections no longer error
|
15
15
|
-- GraphCollection.raw_results allows access to original result data
|
16
|
+
-- Koala no longer enforces any limits on the number of test users you create at once
|
16
17
|
Internal improvements:
|
17
18
|
-- Koala now uses Faraday to make requests, replacing the HTTPServices (see wiki)
|
18
19
|
-- Koala::HTTPService.http_options allows specification of default Faraday connection options
|
data/koala.gemspec
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
3
|
+
require 'koala/version'
|
2
4
|
|
3
5
|
Gem::Specification.new do |s|
|
4
6
|
s.name = %q{koala}
|
5
|
-
s.version =
|
6
|
-
s.date = %q{2011-09-
|
7
|
+
s.version = Koala::VERSION
|
8
|
+
s.date = %q{2011-09-27}
|
7
9
|
|
8
10
|
s.summary = %q{A lightweight, flexible library for Facebook with support for the Graph API, the REST API, realtime updates, and OAuth authentication.}
|
9
11
|
s.description = %q{Koala is a lightweight, flexible Ruby SDK for Facebook. It allows read/write access to the social graph via the Graph and REST APIs, 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.}
|
data/lib/koala/version.rb
CHANGED
data/readme.md
CHANGED
@@ -9,32 +9,41 @@ Koala
|
|
9
9
|
* Flexible: Koala should be useful to everyone, regardless of their current configuration. (We support JRuby, Rubinius, and REE as well as vanilla Ruby, and use the Faraday library to provide complete flexibility over how HTTP requests are made.)
|
10
10
|
* Tested: Koala should have complete test coverage, so you can rely on it. (Our test coverage is complete and can be run against either mocked responses or the live Facebook servers.)
|
11
11
|
|
12
|
+
Facebook Changes on October 1, 2011
|
13
|
+
---
|
14
|
+
|
15
|
+
**Koala 1.2 supports all of Facebook's new authentication schemes**, which will be introduced on October 1, 2011; the old Javascript library and older authentication schemes will be deprecated at the same time.
|
16
|
+
|
17
|
+
To test your application, upgrade to the latest version of Koala (see below) and configure your application according to Facebook's [OAuth 2.0 and HTTPS Migration](https://developers.facebook.com/docs/oauth2-https-migration/) guide. If you have the appropriate calls to get_user_info_from_cookies (apps using the Javascript SDK) and/or parse_signed_params (for Canvas and tab apps), your application should work without a hitch.
|
18
|
+
|
19
|
+
_Note_: in their new secure cookie format, Facebook provides an OAuth code, which Koala automatically exchanges for an access token. Because this involves a call to Facebook's servers, you should consider storing the user's access token in their session and only calling get_user_info_from_cookies when necessary (access_token not present, you discover it's expired, etc.). Otherwise, you'll be calling out to Facebook each time the user loads a page, slowing down your site. (As we figure out best practices for this, we'll update the wiki.)
|
20
|
+
|
12
21
|
Installation
|
13
22
|
---
|
14
23
|
|
15
24
|
Easy:
|
16
25
|
|
17
|
-
[sudo|rvm] gem install koala
|
18
|
-
[sudo|rvm] gem install koala # for 1.1
|
26
|
+
[sudo|rvm] gem install koala
|
19
27
|
|
20
28
|
Or in Bundler:
|
21
29
|
|
22
|
-
gem "koala"
|
23
|
-
gem "koala" # for 1.1
|
30
|
+
gem "koala"
|
24
31
|
|
25
32
|
Graph API
|
26
33
|
----
|
27
34
|
The Graph API is the simple, slick new interface to Facebook's data. Using it with Koala is quite straightforward:
|
28
35
|
|
29
|
-
# 1.2beta and above
|
30
36
|
@graph = Koala::Facebook::API.new(oauth_access_token)
|
31
|
-
# 1.1 or earlier
|
32
|
-
@graph = Koala::Facebook::GraphAPI.new(oauth_access_token)
|
37
|
+
# in 1.1 or earlier, use GraphAPI instead of API
|
33
38
|
|
34
39
|
profile = @graph.get_object("me")
|
35
40
|
friends = @graph.get_connections("me", "friends")
|
36
41
|
@graph.put_object("me", "feed", :message => "I am writing on my wall!")
|
37
42
|
|
43
|
+
# you can even use the new Timeline API
|
44
|
+
# see https://developers.facebook.com/docs/beta/opengraph/tutorial/
|
45
|
+
@graph.put_connections("me", "namespace:action", :object => object_url)
|
46
|
+
|
38
47
|
The response of most requests is the JSON data returned from the Facebook servers as a Hash.
|
39
48
|
|
40
49
|
When retrieving data that returns an array of results (for example, when calling API#get_connections or API#search) a GraphCollection object will be returned, which makes it easy to page through the results:
|
@@ -65,10 +74,8 @@ Where the Graph API and the old REST API overlap, you should choose the Graph AP
|
|
65
74
|
|
66
75
|
Fortunately, Koala supports the REST API using the very same interface; to use this, instantiate an API:
|
67
76
|
|
68
|
-
# 1.2beta and above
|
69
77
|
@rest = Koala::Facebook::API.new(oauth_access_token)
|
70
|
-
# 1.1 or earlier
|
71
|
-
@rest = Koala::Facebook::RestAPI.new(oauth_access_token)
|
78
|
+
# in 1.1 or earlier, use RestAPI instead of API
|
72
79
|
|
73
80
|
@rest.fql_query(my_fql_query) # convenience method
|
74
81
|
@rest.fql_multiquery(fql_query_hash) # convenience method
|
@@ -76,10 +83,8 @@ Fortunately, Koala supports the REST API using the very same interface; to use t
|
|
76
83
|
|
77
84
|
Of course, you can use the Graph API methods on the same object -- the power of two APIs right in the palm of your hand.
|
78
85
|
|
79
|
-
# 1.2beta and above
|
80
86
|
@api = Koala::Facebook::API.new(oauth_access_token)
|
81
|
-
# 1.1 or earlier
|
82
|
-
@api = Koala::Facebook::GraphAndRestAPI.new(oauth_access_token)
|
87
|
+
# in 1.1 or earlier, use GraphAndRestAPI instead of API
|
83
88
|
|
84
89
|
@api = Koala::Facebook::API.new(oauth_access_token)
|
85
90
|
fql = @api.fql_query(my_fql_query)
|
@@ -105,7 +110,7 @@ You can also get your application's own access token, which can be used without
|
|
105
110
|
@oauth.get_app_access_token
|
106
111
|
|
107
112
|
For those building apps on Facebook, parsing signed requests is simple:
|
108
|
-
@oauth.parse_signed_request(
|
113
|
+
@oauth.parse_signed_request(signed_request_string)
|
109
114
|
|
110
115
|
Or, if for some horrible reason, you're still using session keys, despair not! It's easy to turn them into shiny, modern OAuth tokens:
|
111
116
|
@oauth.get_token_from_session_key(session_key)
|
@@ -171,5 +176,7 @@ You can also run live tests against Facebook's servers:
|
|
171
176
|
|
172
177
|
# Again from anywhere in the project directory:
|
173
178
|
LIVE=true bundle exec rake spec
|
179
|
+
# you can also test against Facebook's beta tier
|
180
|
+
LIVE=true BETA=true bundle exec rake spec
|
174
181
|
|
175
182
|
By default, the live tests are run against test users, so you can run them as frequently as you want. If you want to run them against a real user, however, you can fill in the OAuth token, code, and access\_token values in spec/fixtures/facebook_data.yml. See the wiki for more details.
|
data/spec/support/koala_test.rb
CHANGED
@@ -36,7 +36,7 @@ module KoalaTest
|
|
36
36
|
puts "Unable to load adapter #{adapter}, using Net::HTTP."
|
37
37
|
end
|
38
38
|
|
39
|
-
Koala.http_service.http_options[:beta] = true if ENV["beta"]
|
39
|
+
Koala.http_service.http_options[:beta] = true if ENV["beta"] || ENV["BETA"]
|
40
40
|
|
41
41
|
# use a test user unless the developer wants to test against a real profile
|
42
42
|
unless token = KoalaTest.oauth_token
|
metadata
CHANGED
@@ -1,86 +1,72 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: koala
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 2
|
8
|
-
- 0beta4
|
9
|
-
version: 1.2.0beta4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.0
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Alex Koppel, Chris Baclig, Rafi Jacoby, Context Optional
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
22
|
-
requirements:
|
23
|
-
- - ~>
|
24
|
-
- !ruby/object:Gem::Version
|
25
|
-
segments:
|
26
|
-
- 1
|
27
|
-
- 0
|
28
|
-
version: "1.0"
|
12
|
+
date: 2011-09-27 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
29
15
|
name: multi_json
|
30
|
-
|
16
|
+
requirement: &70248641333480 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.0'
|
31
22
|
type: :runtime
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70248641333480
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: faraday
|
27
|
+
requirement: &70248641333000 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
36
30
|
- - ~>
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
segments:
|
39
|
-
- 0
|
40
|
-
- 7
|
41
|
-
- 0
|
31
|
+
- !ruby/object:Gem::Version
|
42
32
|
version: 0.7.0
|
43
|
-
name: faraday
|
44
|
-
prerelease: false
|
45
33
|
type: :runtime
|
46
|
-
version_requirements: *id002
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
49
|
-
requirements:
|
50
|
-
- - ~>
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
segments:
|
53
|
-
- 2
|
54
|
-
- 5
|
55
|
-
version: "2.5"
|
56
|
-
name: rspec
|
57
34
|
prerelease: false
|
35
|
+
version_requirements: *70248641333000
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &70248641332520 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '2.5'
|
58
44
|
type: :development
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70248641332520
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: &70248641332040 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
63
52
|
- - ~>
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
segments:
|
66
|
-
- 0
|
67
|
-
- 8
|
68
|
-
- 7
|
53
|
+
- !ruby/object:Gem::Version
|
69
54
|
version: 0.8.7
|
70
|
-
name: rake
|
71
|
-
prerelease: false
|
72
55
|
type: :development
|
73
|
-
|
74
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70248641332040
|
58
|
+
description: Koala is a lightweight, flexible Ruby SDK for Facebook. It allows read/write
|
59
|
+
access to the social graph via the Graph and REST APIs, as well as support for realtime
|
60
|
+
updates and OAuth and Facebook Connect authentication. Koala is fully tested and
|
61
|
+
supports Net::HTTP and Typhoeus connections out of the box and can accept custom
|
62
|
+
modules for other services.
|
75
63
|
email: alex@alexkoppel.com
|
76
64
|
executables: []
|
77
|
-
|
78
65
|
extensions: []
|
79
|
-
|
80
|
-
extra_rdoc_files:
|
66
|
+
extra_rdoc_files:
|
81
67
|
- readme.md
|
82
68
|
- CHANGELOG
|
83
|
-
files:
|
69
|
+
files:
|
84
70
|
- .autotest
|
85
71
|
- .gitignore
|
86
72
|
- .travis.yml
|
@@ -131,41 +117,39 @@ files:
|
|
131
117
|
- spec/support/ordered_hash.rb
|
132
118
|
- spec/support/rest_api_shared_examples.rb
|
133
119
|
- spec/support/uploadable_io_shared_examples.rb
|
134
|
-
has_rdoc: true
|
135
120
|
homepage: http://github.com/arsduo/koala
|
136
121
|
licenses: []
|
137
|
-
|
138
122
|
post_install_message:
|
139
|
-
rdoc_options:
|
123
|
+
rdoc_options:
|
140
124
|
- --line-numbers
|
141
125
|
- --inline-source
|
142
126
|
- --title
|
143
127
|
- Koala
|
144
|
-
require_paths:
|
128
|
+
require_paths:
|
145
129
|
- lib
|
146
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
segments:
|
151
137
|
- 0
|
152
|
-
|
153
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
- 2
|
160
|
-
version: "1.2"
|
138
|
+
hash: 2837078681376474267
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '1.2'
|
161
145
|
requirements: []
|
162
|
-
|
163
146
|
rubyforge_project:
|
164
|
-
rubygems_version: 1.
|
147
|
+
rubygems_version: 1.8.8
|
165
148
|
signing_key:
|
166
149
|
specification_version: 3
|
167
|
-
summary: A lightweight, flexible library for Facebook with support for the Graph API,
|
168
|
-
|
150
|
+
summary: A lightweight, flexible library for Facebook with support for the Graph API,
|
151
|
+
the REST API, realtime updates, and OAuth authentication.
|
152
|
+
test_files:
|
169
153
|
- spec/cases/api_spec.rb
|
170
154
|
- spec/cases/error_spec.rb
|
171
155
|
- spec/cases/graph_and_rest_api_spec.rb
|