koala 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ v0.7.1
2
+ -- Updated RealtimeUpdates#list_subscriptions and GraphAPI#get_connections to now return an
3
+ array of results directly (rather than a hash with one key)
4
+ -- Fixed a bug with Net::HTTP-based HTTP service in which the headers hash was improperly formatted
5
+ -- Updated readme
6
+
1
7
  v0.7.0
2
8
  -- Added RealtimeUpdates class, which can be used to manage subscriptions for user updates (see http://developers.facebook.com/docs/api/realtime)
3
9
  -- Added picture method to graph API, which fetches an object's picture from the redirect headers.
data/Rakefile CHANGED
@@ -4,9 +4,9 @@ require 'rake'
4
4
  require 'echoe'
5
5
 
6
6
  # gem management
7
- Echoe.new('koala', '0.7.0') do |p|
8
- p.summary = "A lightweight, flexible library for Facebook's new Graph API"
9
- p.description = "Koala is a lightweight, flexible Ruby SDK for Facebook's new Graph API. It allows read/write access to the Facebook Graph and provides OAuth URLs and cookie validation for Facebook Connect sites; it also supports access-token based interaction with the old REST API. Koala supports Net::HTTP and Typhoeus connections out of the box and can accept custom modules for other services."
7
+ Echoe.new('koala', '0.7.1') do |p|
8
+ p.summary = "A lightweight, flexible library for Facebook with support for the Graph API, the old REST API, realtime updates, and OAuth validation."
9
+ p.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."
10
10
  p.url = "http://github.com/arsduo/koala"
11
11
  p.author = ["Alex Koppel", "Chris Baclig", "Rafi Jacoby", "Context Optional"]
12
12
  p.email = "alex@alexkoppel.com"
data/koala.gemspec CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{koala}
5
- s.version = "0.7.0"
5
+ s.version = "0.7.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Alex Koppel, Chris Baclig, Rafi Jacoby, Context Optional"]
9
- s.date = %q{2010-05-26}
10
- s.description = %q{Koala is a lightweight, flexible Ruby SDK for Facebook's new Graph API. It allows read/write access to the Facebook Graph and provides OAuth URLs and cookie validation for Facebook Connect sites; it also supports access-token based interaction with the old REST API. Koala supports Net::HTTP and Typhoeus connections out of the box and can accept custom modules for other services.}
9
+ s.date = %q{2010-05-27}
10
+ s.description = %q{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.}
11
11
  s.email = %q{alex@alexkoppel.com}
12
12
  s.extra_rdoc_files = ["CHANGELOG", "lib/graph_api.rb", "lib/http_services.rb", "lib/koala.rb", "lib/realtime_updates.rb", "lib/rest_api.rb"]
13
13
  s.files = ["CHANGELOG", "Manifest", "Rakefile", "init.rb", "lib/graph_api.rb", "lib/http_services.rb", "lib/koala.rb", "lib/realtime_updates.rb", "lib/rest_api.rb", "readme.md", "spec/facebook_data.yml", "spec/koala/api_base_tests.rb", "spec/koala/graph_and_rest_api/graph_and_rest_api_no_token_tests.rb", "spec/koala/graph_and_rest_api/graph_and_rest_api_with_token_tests.rb", "spec/koala/graph_api/graph_api_no_access_token_tests.rb", "spec/koala/graph_api/graph_api_with_access_token_tests.rb", "spec/koala/live_testing_data_helper.rb", "spec/koala/net_http_service_tests.rb", "spec/koala/oauth/oauth_tests.rb", "spec/koala/realtime_updates/realtime_updates_tests.rb", "spec/koala/rest_api/rest_api_no_access_token_tests.rb", "spec/koala/rest_api/rest_api_with_access_token_tests.rb", "spec/koala_spec.rb", "spec/koala_spec_helper.rb", "spec/koala_spec_without_mocks.rb", "spec/mock_facebook_responses.yml", "spec/mock_http_service.rb", "koala.gemspec"]
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.require_paths = ["lib"]
17
17
  s.rubyforge_project = %q{koala}
18
18
  s.rubygems_version = %q{1.3.6}
19
- s.summary = %q{A lightweight, flexible library for Facebook's new Graph API}
19
+ s.summary = %q{A lightweight, flexible library for Facebook with support for the Graph API, the old REST API, realtime updates, and OAuth validation.}
20
20
 
21
21
  if s.respond_to? :specification_version then
22
22
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
data/lib/graph_api.rb CHANGED
@@ -44,7 +44,7 @@ module Koala
44
44
 
45
45
  def get_connections(id, connection_name, args = {})
46
46
  # Fetchs the connections for given object.
47
- graph_call("#{id}/#{connection_name}", args)
47
+ graph_call("#{id}/#{connection_name}", args)["data"]
48
48
  end
49
49
 
50
50
  def get_picture(object)
data/lib/http_services.rb CHANGED
@@ -32,8 +32,8 @@ module Koala
32
32
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
33
33
 
34
34
  result = http.start { |http|
35
- response, body = (verb == "post" ? http.post(path, encode_params(args)) : http.get("#{path}?#{encode_params(args)}"))
36
- Koala::Response.new(response.code.to_i, body, response.to_hash)
35
+ response, body = (verb == "post" ? http.post(path, encode_params(args)) : http.get("#{path}?#{encode_params(args)}"))
36
+ Koala::Response.new(response.code.to_i, body, response)
37
37
  }
38
38
  end
39
39
 
@@ -71,7 +71,7 @@ module Koala
71
71
  end
72
72
 
73
73
  def list_subscriptions
74
- api(subscription_path)
74
+ api(subscription_path)["data"]
75
75
  end
76
76
 
77
77
  def api(*args) # same as GraphAPI
data/readme.md CHANGED
@@ -91,9 +91,11 @@ Testing
91
91
  -----
92
92
 
93
93
  Unit tests are provided for all of Koala's methods. By default, these tests run against mock responses and hence are ready out of the box:
94
- spec koala_tests.rb
94
+ # From the spec directory
95
+ spec koala_spec.rb
95
96
 
96
97
  You can also run live tests against Facebook's servers:
97
- spec koala_tests_without_mocks.rb
98
+ # Again from the spec directory
99
+ spec koala_spec_without_mocks.rb
98
100
 
99
101
  Important Note: to run the live tests, you have to provide some of your own data: a valid OAuth access token with publish\_stream and read\_stream permissions and an OAuth code that can be used to generate an access token. You can get these data at the OAuth Playground; if you want to use your own app, remember to swap out the app ID, secret, and other values. (The file also provides valid values for other tests, which you're welcome to swap out for data specific to your own application.)
@@ -5,13 +5,13 @@
5
5
 
6
6
  # You must supply this value yourself to test the GraphAPI class.
7
7
  # Your OAuth token should have publish_stream and read_stream permissions.
8
- oauth_token: 119908831367602|2.HlL6n4vuEhDKRyF_7dSipg__.3600.1274893200-2905623|NELx9TxQgEa2uL87wfg0arHIBvk.
8
+ oauth_token: 119908831367602|2.6WkxQTbQPGFCyLblPYdsMg__.3600.1274979600-2905623|8YPVs-jBmpWC6y10pMCWzMRFrdk.
9
9
 
10
10
  # for testing the OAuth class
11
11
  # baseline app
12
12
  oauth_test_data:
13
13
  # You must supply this value yourself, since they will expire.
14
- code: 2.HlL6n4vuEhDKRyF_7dSipg__.3600.1274893200-2905623|HgKssdjuTn4tMSStxS-LsMb_p4M.
14
+ code: 2.6WkxQTbQPGFCyLblPYdsMg__.3600.1274979600-2905623|zHzbqwoONeqNxOXX7z9LZlpEGdc.
15
15
 
16
16
  # These values will work out of the box
17
17
  app_id: 119908831367602
@@ -36,7 +36,7 @@ shared_examples_for "Koala GraphAPI without an access token" do
36
36
 
37
37
  it "should be able to access connections from public Pages" do
38
38
  result = @api.get_connections("contextoptional", "likes")
39
- result["data"].should be_a(Array)
39
+ result.should be_a(Array)
40
40
  end
41
41
 
42
42
  it "should not be able to put an object" do
@@ -33,12 +33,12 @@ it "should get public data about a user" do
33
33
 
34
34
  it "should be able to access connections from users" do
35
35
  result = @api.get_connections("lukeshepard", "likes")
36
- result["data"].length.should > 0
36
+ result.length.should > 0
37
37
  end
38
38
 
39
39
  it "should be able to access connections from public Pages" do
40
40
  result = @api.get_connections("contextoptional", "likes")
41
- result["data"].should be_a(Array)
41
+ result.should be_a(Array)
42
42
  end
43
43
 
44
44
  # PUT
@@ -9,6 +9,8 @@ class NetHTTPServiceTests < Test::Unit::TestCase
9
9
  Bear.respond_to?(:make_request).should be_true
10
10
  end
11
11
 
12
+ it "should return a string for location header"
13
+
12
14
  it "should use POST if verb is not GET"
13
15
 
14
16
  it "should return a Koala::Response object"
@@ -115,7 +115,7 @@ class FacebookRealtimeUpdatesTests < Test::Unit::TestCase
115
115
  end
116
116
 
117
117
  it "should is subscriptions properly" do
118
- @updates.list_subscriptions["data"].should be_a(Array)
118
+ @updates.list_subscriptions.should be_a(Array)
119
119
  end
120
120
  end # describe "when used"
121
121
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 7
8
- - 0
9
- version: 0.7.0
8
+ - 1
9
+ version: 0.7.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Alex Koppel, Chris Baclig, Rafi Jacoby, Context Optional
@@ -14,11 +14,11 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-26 00:00:00 -07:00
17
+ date: 2010-05-27 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
21
- description: Koala is a lightweight, flexible Ruby SDK for Facebook's new Graph API. It allows read/write access to the Facebook Graph and provides OAuth URLs and cookie validation for Facebook Connect sites; it also supports access-token based interaction with the old REST API. Koala supports Net::HTTP and Typhoeus connections out of the box and can accept custom modules for other services.
21
+ 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
22
  email: alex@alexkoppel.com
23
23
  executables: []
24
24
 
@@ -95,6 +95,6 @@ rubyforge_project: koala
95
95
  rubygems_version: 1.3.6
96
96
  signing_key:
97
97
  specification_version: 3
98
- summary: A lightweight, flexible library for Facebook's new Graph API
98
+ summary: A lightweight, flexible library for Facebook with support for the Graph API, the old REST API, realtime updates, and OAuth validation.
99
99
  test_files: []
100
100