koala 1.3.0 → 1.4.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,27 +25,27 @@ shared_examples_for "Koala GraphAPI" do
25
25
  Koala.stub(:make_request).and_return(Koala::HTTPService::Response.new(500, {"error" => "An error occurred!"}, {}))
26
26
  lambda { @api.graph_call(KoalaTest.user1, {}) }.should raise_exception(Koala::Facebook::APIError)
27
27
  end
28
-
28
+
29
29
  it "passes the results through GraphCollection.evaluate" do
30
30
  result = {}
31
31
  @api.stub(:api).and_return(result)
32
32
  Koala::Facebook::GraphCollection.should_receive(:evaluate).with(result, @api)
33
33
  @api.graph_call("/me")
34
34
  end
35
-
35
+
36
36
  it "returns the results of GraphCollection.evaluate" do
37
37
  expected = {}
38
38
  @api.stub(:api).and_return([])
39
39
  Koala::Facebook::GraphCollection.should_receive(:evaluate).and_return(expected)
40
40
  @api.graph_call("/me").should == expected
41
41
  end
42
-
42
+
43
43
  it "returns the post_processing block's results if one is supplied" do
44
44
  other_result = [:a, 2, :three]
45
45
  block = Proc.new {|r| other_result}
46
46
  @api.stub(:api).and_return({})
47
47
  @api.graph_call("/me", {}, "get", {}, &block).should == other_result
48
- end
48
+ end
49
49
  end
50
50
 
51
51
  # SEARCH
@@ -121,15 +121,15 @@ shared_examples_for "Koala GraphAPI" do
121
121
  @api.should_receive(:graph_call).with(*query)
122
122
  @api.get_page(query)
123
123
  end
124
-
124
+
125
125
  # Beta tier
126
126
  it "can use the beta tier" do
127
127
  result = @api.get_object(KoalaTest.user1, {}, :beta => true)
128
128
  # the results should have an ID and a name, among other things
129
129
  (result["id"] && result["name"]).should_not be_nil
130
130
  end
131
-
132
- # FQL
131
+
132
+ # FQL
133
133
  describe "#fql_query" do
134
134
  it "makes a request to /fql" do
135
135
  @api.should_receive(:get_object).with("fql", anything, anything)
@@ -225,7 +225,7 @@ shared_examples_for "Koala GraphAPI with an access token" do
225
225
  end
226
226
 
227
227
  it "can delete likes" do
228
- result = @api.put_wall_post("Hello, world, from the test suite delete method!")
228
+ result = @api.put_wall_post("Hello, world, from the test suite delete like method!")
229
229
  @temporary_object_id = result["id"]
230
230
  @api.put_like(@temporary_object_id)
231
231
  delete_like_result = @api.delete_like(@temporary_object_id)
@@ -248,7 +248,7 @@ shared_examples_for "Koala GraphAPI with an access token" do
248
248
  @temporary_object_id = result["id"]
249
249
  @temporary_object_id.should_not be_nil
250
250
  end
251
-
251
+
252
252
  it "can post a message whose attachment has a properties dictionary" do
253
253
  url = KoalaTest.oauth_test_data["callback_url"]
254
254
  options = {
@@ -259,14 +259,14 @@ shared_examples_for "Koala GraphAPI with an access token" do
259
259
  "properties" => [
260
260
  {"name" => "Link1'", "text" => "Left", "href" => url},
261
261
  {"name" => "other", "text" => "Straight ahead"}
262
- ]
262
+ ]
263
263
  }
264
264
 
265
265
  result = @api.put_wall_post("body", options)
266
266
  @temporary_object_id = result["id"]
267
267
  @temporary_object_id.should_not be_nil
268
268
  end
269
-
269
+
270
270
 
271
271
  describe "#put_picture" do
272
272
  it "can post photos to the user's wall with an open file object" do
@@ -403,13 +403,13 @@ shared_examples_for "Koala GraphAPI with an access token" do
403
403
  @api.should_receive(:api).with("my_page", hash_including({:fields => "access_token"}), "get", anything)
404
404
  @api.get_page_access_token("my_page")
405
405
  end
406
-
406
+
407
407
  it "merges in any other arguments" do
408
408
  # we can't test this live since test users (or random real users) can't be guaranteed to have pages to manage
409
409
  args = {:a => 3}
410
410
  @api.should_receive(:api).with("my_page", hash_including(args), "get", anything)
411
411
  @api.get_page_access_token("my_page", args)
412
- end
412
+ end
413
413
  end
414
414
 
415
415
  describe "#set_app_restrictions" do
@@ -424,32 +424,30 @@ shared_examples_for "Koala GraphAPI with an access token" do
424
424
  @app_api.should_receive(:graph_call).with(KoalaTest.app_id, anything, "post", anything)
425
425
  @app_api.set_app_restrictions(KoalaTest.app_id, @restrictions)
426
426
  end
427
-
427
+
428
428
  it "JSON-encodes the restrictions" do
429
429
  @app_api.should_receive(:graph_call).with(anything, hash_including(:restrictions => MultiJson.encode(@restrictions)), anything, anything)
430
430
  @app_api.set_app_restrictions(KoalaTest.app_id, @restrictions)
431
431
  end
432
-
432
+
433
433
  it "includes the other arguments" do
434
434
  args = {:a => 2}
435
435
  @app_api.should_receive(:graph_call).with(anything, hash_including(args), anything, anything)
436
436
  @app_api.set_app_restrictions(KoalaTest.app_id, @restrictions, args)
437
437
  end
438
-
438
+
439
439
  it "works" do
440
440
  @app_api.set_app_restrictions(KoalaTest.app_id, @restrictions).should be_true
441
441
  end
442
442
  end
443
443
 
444
- it "changes tests to first_name when FB repairs its bug"
445
-
446
444
  it "can access public information via FQL" do
447
445
  result = @api.fql_query("select uid, first_name from user where uid = #{KoalaTest.user2_id}")
448
446
  result.size.should == 1
449
- # result.first['first_name'].should == KoalaTest.user2_name
447
+ result.first['first_name'].should == KoalaTest.user2_name
450
448
  result.first['uid'].should == KoalaTest.user2_id.to_i
451
449
  end
452
-
450
+
453
451
  it "can access public information via FQL.multiquery" do
454
452
  result = @api.fql_multiquery(
455
453
  :query1 => "select uid, first_name from user where uid = #{KoalaTest.user2_id}",
@@ -623,7 +621,7 @@ shared_examples_for "Koala GraphAPI without an access token" do
623
621
  it "can't delete a like" do
624
622
  lambda { @api.delete_like("7204941866_119776748033392") }.should raise_error(Koala::Facebook::APIError)
625
623
  end
626
-
624
+
627
625
  # FQL_QUERY
628
626
  describe "when making a FQL request" do
629
627
  it "can access public information via FQL" do
@@ -19,7 +19,7 @@ module Koala
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
23
  # Useful in mock_facebook_responses.yml
24
24
  OAUTH_DATA = TEST_DATA['oauth_test_data']
25
25
  OAUTH_DATA.merge!({
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: koala
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
5
- prerelease:
4
+ version: 1.4.0.rc1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Alex Koppel, Chris Baclig, Rafi Jacoby, Context Optional
@@ -13,7 +13,7 @@ date: 2011-10-04 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
16
- requirement: &70194747941160 !ruby/object:Gem::Requirement
16
+ requirement: &70302319320000 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70194747941160
24
+ version_requirements: *70302319320000
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: faraday
27
- requirement: &70194747940100 !ruby/object:Gem::Requirement
27
+ requirement: &70302319318660 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.7.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70194747940100
35
+ version_requirements: *70302319318660
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70194747938880 !ruby/object:Gem::Requirement
38
+ requirement: &70302319317360 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.8.0rc1
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70194747938880
46
+ version_requirements: *70302319317360
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
- requirement: &70194747937740 !ruby/object:Gem::Requirement
49
+ requirement: &70302319316620 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 0.8.7
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70194747937740
57
+ version_requirements: *70302319316620
58
58
  description: Koala is a lightweight, flexible Ruby SDK for Facebook. It allows read/write
59
59
  access to the social graph via the Graph and REST APIs, as well as support for realtime
60
60
  updates and OAuth and Facebook Connect authentication. Koala is fully tested and
@@ -104,6 +104,7 @@ files:
104
104
  - spec/cases/graph_collection_spec.rb
105
105
  - spec/cases/http_service_spec.rb
106
106
  - spec/cases/koala_spec.rb
107
+ - spec/cases/koala_test_spec.rb
107
108
  - spec/cases/legacy_spec.rb
108
109
  - spec/cases/multipart_request_spec.rb
109
110
  - spec/cases/oauth_spec.rb
@@ -142,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
143
  version: '0'
143
144
  segments:
144
145
  - 0
145
- hash: 3741350754426721879
146
+ hash: -1082598694545129071
146
147
  required_rubygems_version: !ruby/object:Gem::Requirement
147
148
  none: false
148
149
  requirements:
@@ -163,6 +164,7 @@ test_files:
163
164
  - spec/cases/graph_collection_spec.rb
164
165
  - spec/cases/http_service_spec.rb
165
166
  - spec/cases/koala_spec.rb
167
+ - spec/cases/koala_test_spec.rb
166
168
  - spec/cases/legacy_spec.rb
167
169
  - spec/cases/multipart_request_spec.rb
168
170
  - spec/cases/oauth_spec.rb