koala 1.6.0 → 1.7.0rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,12 +2,9 @@ rvm:
2
2
  - 1.8.7
3
3
  - 1.9.2
4
4
  - 1.9.3
5
- - ruby-head
5
+ - 2.0.0
6
6
  - jruby-18mode # JRuby in 1.8 mode
7
7
  - jruby-19mode # JRuby in 1.9 mode
8
8
  - rbx-18mode
9
9
  - rbx-19mode
10
- - ree
11
- matrix:
12
- allow_failures:
13
- - rvm: ruby-head
10
+ - ree
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source :rubygems
1
+ source "https://rubygems.org"
2
2
 
3
3
  group :development do
4
4
  gem "yard"
@@ -10,7 +10,6 @@ group :development, :test do
10
10
  # Testing infrastructure
11
11
  gem 'guard'
12
12
  gem 'guard-rspec'
13
- gem "parallel_tests"
14
13
 
15
14
  if RUBY_PLATFORM =~ /darwin/
16
15
  # OS X integration
@@ -1,16 +1,46 @@
1
+ v1.7
2
+ ====
3
+
4
+ New methods:
5
+ * API#debug_token allows you to examine user tokens (thanks, Cyril-sf!)
6
+ * Koala.config allows you to set Facebook servers (to use proxies, etc.) (thanks, bnorton!)
7
+
8
+ Internal improvements:
9
+ * CHANGED: Parameters can now be Arrays of non-enumerable values, which get comma-separated (thanks, csaunders!)
10
+ * CHANGED: API#put_wall_post now automatically encodes parameters hashes as JSON
11
+ * CHANGED: GraphCollections returned by batch API calls retain individual access tokens (thanks, billvieux!)
12
+ * CHANGED: Gem version restrictions have been removed, and versions updated.
13
+ * CHANGED: How support files are loaded in spec_helper has been improved.
14
+ * FIXED: API#get_picture returns nil if FB returns no result, rather than error (thanks, mtparet!)
15
+ * FIXED: Koala now uses the right grant_type value for fetching app access tokens (thanks, miv!)
16
+ * FIXED: Koala now uses the modern OAuth endpoint for generating codes (thanks, jayeff!)
17
+ * FIXED: Misc small fixes, typos, etc. (thanks, Ortuna, Crunch09, sagarbommidi!)
18
+
19
+ Testing improvements:
20
+ * FIXED: MockHTTPService compares Ruby objects rather than strings.
21
+ * FIXED: Removed deprecated usage of should_not_receive.and_return (thanks, Cyril-sf!)
22
+ * FIXED: Test suite now supports Typhoeus 0.5 (thanks, Cyril-sf!)
23
+ * CHANGED: Koala now tests against Ruby 2.0 on Travis (thanks, sanemat!)
24
+
1
25
  v1.6
26
+ ====
27
+
2
28
  New methods:
3
29
  * RealtimeUpdates#validate_update to validate the signature of a Facebook call (thanks, gaffo!)
30
+
4
31
  Updated methods:
5
32
  * Graph API methods now accepts a post processing block, see readme for examples (thanks, wolframarnold!)
6
- _Internal improvements:_
33
+
34
+ Internal improvements:
7
35
  * Koala now returns more specific and useful error classes (thanks, archfear!)
8
36
  * Switched URL parsing to addressable, which can handle unusual FB URLs (thanks, bnorton!)
9
37
  * Fixed Batch API bug that seems to have broken calls requiring post-processing
10
38
  * Bump Faraday requirement to 0.8 (thanks, jarthod!)
11
39
  * Picture and video URLs now support unicode characters (thanks, jayeff!)
40
+
12
41
  Testing improvements:
13
42
  * Cleaned up some test suites (thanks, bnorton!)
43
+
14
44
  Documentation:
15
45
  * Changelog is now markdown
16
46
  * Code highlighting in readme (thanks, sfate!)
@@ -18,11 +48,15 @@ Documentation:
18
48
  * Added permissions example for OAuth (thanks, sebastiandeutsch!)
19
49
 
20
50
  v1.5
51
+ ====
52
+
21
53
  New methods:
22
54
  * Added Koala::Utils.logger to enable debugging (thanks, KentonWhite!)
23
55
  * Expose fb_error_message and fb_error_code directly in APIError
56
+
24
57
  Updated methods:
25
58
  * GraphCollection.parse_page_url now uses the URI library and can parse any address (thanks, bnorton!)
59
+
26
60
  Internal improvements:
27
61
  * Update MultiJson dependency to support the Oj library (thanks, eckz and zinenko!)
28
62
  * Loosened Faraday dependency (thanks, rewritten and romanbsd!)
@@ -30,33 +64,44 @@ Internal improvements:
30
64
  * Switched uses of put_object to the more semantically accurate put_connections
31
65
  * Cleaned up gemspec
32
66
  * Handle invalid batch API responses better
67
+
33
68
  Documentation:
34
69
  * Added HTTP Services description for Faraday 0.8/persistent connections (thanks, romanbsd!)
35
70
  * Remove documentation of the old pre-1.2 HTTP Service options
36
71
 
37
- v.1.4.1
72
+ v1.4.1
73
+ =======
74
+
38
75
  * Update MultiJson to 1.3 and change syntax to silence warnings (thanks, eckz and masterkain!)
39
76
 
40
77
  v1.4
78
+ ====
79
+
41
80
  New methods:
42
81
  * OAuth#exchange_access_token(_info) allows you to extend access tokens you receive (thanks, etiennebarrie!)
82
+
43
83
  Updated methods:
44
84
  * HTTPServices#encode_params sorts parameters to aid in URL comparison (thanks, sholden!)
45
85
  * get_connections is now aliased as get_connection (use whichever makes sense to you)
86
+
46
87
  Internal improvements:
47
88
  * Fixed typos (thanks, brycethornton and jpemberthy!)
48
89
  * RealtimeUpdates will no longer execute challenge block unnecessarily (thanks, iainbeeston!)
90
+
49
91
  Testing improvements:
50
92
  * Added parallel_tests to development gem file
51
93
  * Fixed failing live tests
52
94
  * Koala now tests against JRuby and Rubinius in 1.9 mode on Travis-CI
53
95
 
54
96
  v1.3
97
+ ====
98
+
55
99
  New methods:
56
100
  * OAuth#url_for_dialog creates URLs for Facebook dialog pages
57
101
  * API#set_app_restrictions handles JSON-encoding app restrictions
58
102
  * GraphCollection.parse_page_url now exposes useful functionality for non-Rails apps
59
103
  * RealtimeUpdates#subscription_path and TestUsers#test_user_accounts_path are now public
104
+
60
105
  Updated methods:
61
106
  * REST API methods are now deprecated (see http://developers.facebook.com/blog/post/616/)
62
107
  * OAuth#url_for_access_token and #url_for_oauth_code now include any provided options as URL parameters
@@ -67,12 +112,14 @@ Updated methods:
67
112
  * All methods with http_options can now take :http_component => :response for the complete response
68
113
  * OAuth#get_user_info_from_cookies returns nil rather than an error if the cookies are expired (thanks, herzio)
69
114
  * TestUsers#delete_all now uses the Batch API and is much faster
115
+
70
116
  Internal improvements:
71
117
  * FQL queries now use the Graph API behind-the-scenes
72
118
  * Cleaned up file and class organization, with aliases for backward compatibility
73
119
  * Added YARD documentation throughout
74
120
  * Fixed bugs in RealtimeUpdates, TestUsers, elsewhere
75
121
  * Reorganized file and class structure non-destructively
122
+
76
123
  Testing improvements:
77
124
  * Expanded/improved test coverage
78
125
  * The test suite no longer users any hard-coded user IDs
@@ -80,27 +127,35 @@ Testing improvements:
80
127
  * Configured tests to run in random order using RSpec 2.8.0rc1
81
128
 
82
129
  v1.2.1
130
+ ======
131
+
83
132
  New methods:
84
133
  * RestAPI.set_app_properties handles JSON-encoding application properties
134
+
85
135
  Updated methods:
86
136
  * OAuth.get_user_from_cookie works with the new signed cookie format (thanks, gmccreight!)
87
137
  * Beta server URLs are now correct
88
138
  * OAuth.parse_signed_request now raises an informative error if the signed_request is malformed
139
+
89
140
  Internal improvements:
90
141
  * Koala::Multipart middleware properly encoding nested parameters (hashes) in POSTs
91
142
  * Updated readme, changelog, etc.
143
+
92
144
  Testing improvements:
93
145
  * Live tests with test users now clean up all fake users they create
94
146
  * Removed duplicate test cases
95
147
  * Live tests with test users no longer delete each object they create, speeding things up
96
148
 
97
149
  v1.2
150
+ ====
151
+
98
152
  New methods:
99
153
  * API is now the main API class, contains both Graph and REST methods
100
154
  * Old classes are aliased with deprecation warnings (non-breaking change)
101
155
  * TestUsers#update lets you update the name or password of an existing test user
102
156
  * API.get_page_access_token lets you easily fetch the access token for a page you manage (thanks, marcgg!)
103
157
  * Added version.rb (Koala::VERSION)
158
+
104
159
  Updated methods:
105
160
  * OAuth now parses Facebook's new signed cookie format
106
161
  * API.put_picture now accepts URLs to images (thanks, marcgg!)
@@ -110,6 +165,7 @@ Updated methods:
110
165
  * Non-pageable results from get_connections no longer error
111
166
  * GraphCollection.raw_results allows access to original result data
112
167
  * Koala no longer enforces any limits on the number of test users you create at once
168
+
113
169
  Internal improvements:
114
170
  * Koala now uses Faraday to make requests, replacing the HTTPServices (see wiki)
115
171
  * Koala::HTTPService.http_options allows specification of default Faraday connection options
@@ -120,6 +176,7 @@ Internal improvements:
120
176
  * RealTimeUpdates and TestUsers are no longer subclasses of API, but have their own .api objects
121
177
  * The old .graph_api accessor is aliases to .api with a deprecation warning
122
178
  * Removed deprecation warnings for pre-1.1 batch interface
179
+
123
180
  Testing improvements:
124
181
  * Live test suites now run against test users by default
125
182
  * Test suite can be repeatedly run live without having to update facebook_data.yml
@@ -131,6 +188,8 @@ Testing improvements:
131
188
  * Fixed bug with YAML parsing in Ruby 1.9
132
189
 
133
190
  v1.1
191
+ ====
192
+
134
193
  New methods:
135
194
  * Added Batch API support (thanks, seejohnrun and spiegela!)
136
195
  * includes file uploads, error handling, and FQL
@@ -139,11 +198,13 @@ New methods:
139
198
  * Added RestAPI#fql_multiquery, which simplifies the results (thanks, amrnt!)
140
199
  * HTTP services support global proxy and timeout settings (thanks, itchy!)
141
200
  * Net::HTTP supports global ca_path, ca_file, and verify_mode settings (thanks, spiegela!)
201
+
142
202
  Updated methods:
143
203
  * RealtimeUpdates now uses a GraphAPI object instead of its own API
144
204
  * RestAPI#rest_call now has an optional last argument for method, for calls requiring POST, DELETE, etc. (thanks, sshilo!)
145
205
  * Filename can now be specified when uploading (e.g. for Ads API) (thanks, sshilo!)
146
206
  * get_objects([]) returns [] instead of a Facebook error in non-batch mode (thanks, aselder!)
207
+
147
208
  Internal improvements:
148
209
  * Koala is now more compatible with other Rubies (JRuby, Rubinius, etc.)
149
210
  * HTTP services are more modular and can be changed on the fly (thanks, chadk!)
@@ -154,11 +215,14 @@ Internal improvements:
154
215
  * Fixed bugs and typos (thanks, waynn, mokevnin, and tikh!)
155
216
 
156
217
  v1.0
218
+ ====
219
+
157
220
  New methods:
158
221
  * Photo and file upload now supported through #put_picture
159
222
  * Added UploadableIO class to manage file uploads
160
223
  * Added a delete_like method (thanks to waseem)
161
224
  * Added put_connection and delete_connection convenience methods
225
+
162
226
  Updated methods:
163
227
  * Search can now search places, checkins, etc. (thanks, rickyc!)
164
228
  * You can now pass :beta => true in the http options to use Facebook's beta tier
@@ -167,6 +231,7 @@ Updated methods:
167
231
  * url_for_oauth_code can now take a :display option (thanks, netbe!)
168
232
  * Net::HTTP can now accept :timeout and :proxy options (thanks, gilles!)
169
233
  * Test users now supports using test accounts across multiple apps
234
+
170
235
  Internal improvements:
171
236
  * For public requests, Koala now uses http by default (instead of https) to improve speed
172
237
  * This can be overridden through Koala.always_use_ssl= or by passing :use_ssl => true in the options hash for an api call
@@ -178,6 +243,7 @@ Internal improvements:
178
243
  * APIError is now < StandardError, not Exception
179
244
  * Added KoalaError for non-API errors
180
245
  * Net::HTTP's SSL verification is no longer disabled by default
246
+
181
247
  Test improvements:
182
248
  * Incorporated joshk's awesome rewrite of the entire Koala test suite (thanks, joshk!)
183
249
  * Expanded HTTP service tests (added Typhoeus test suite and additional Net::HTTP test cases)
@@ -185,16 +251,22 @@ Test improvements:
185
251
  * Replaced the 50-person network test, which often took 15+ minutes to run live, with a 5-person test
186
252
 
187
253
  v0.10.0
254
+ =======
255
+
188
256
  * Added test user module
189
257
  * Fixed bug when raising APIError after Facebook fails to exchange session keys
190
258
  * Made access_token accessible via the readonly access_token property on all our API classes
191
259
 
192
260
  v0.9.1
261
+ ======
262
+
193
263
  * Tests are now compatible with Ruby 1.9.2
194
264
  * Added JSON to runtime dependencies
195
265
  * Removed examples directory (referenced from github instead)
196
266
 
197
267
  v0.9.0
268
+ ======
269
+
198
270
  * Added parse_signed_request to handle Facebook's new authentication scheme
199
271
  * note: creates dependency on OpenSSL (OpenSSL::HMAC) for decryption
200
272
  * Added GraphCollection class to provide paging support for GraphAPI get_connections and search methods (thanks to jagthedrummer)
@@ -205,14 +277,20 @@ v0.9.0
205
277
  * If Facebook returns nil for search or get_connections requests, Koala now returns nil rather than throwing an exception
206
278
 
207
279
  v0.8.0
280
+ ======
281
+
208
282
  * Breaking interface changes
209
283
  * Removed string overloading for the methods, per 0.7.3, which caused Marshaling issues
210
284
  * Removed ability to provide a string as the second argument to url_for_access_token, per 0.5.0
211
285
 
212
286
  v0.7.4
287
+ ======
288
+
213
289
  * Fixed bug with get_user_from_cookies
214
290
 
215
291
  v0.7.3
292
+ ======
293
+
216
294
  * Added support for picture sizes -- thanks thhermansen for the patch!
217
295
  * Adjusted the return values for several methods (get_access_token, get_app_access_token, get_token_from_session_key, get_tokens_from_session_keys, get_user_from_cookies)
218
296
  * These methods now return strings, rather than hashes, which makes more sense
@@ -225,18 +303,24 @@ v0.7.3
225
303
  * Added license
226
304
 
227
305
  v0.7.2
306
+ ======
307
+
228
308
  * Added support for exchanging session keys for OAuth access tokens (get_token_from_session_key for single keys, get_tokens_from_session_keys for multiple)
229
309
  * Moved Koala files into a koala/ subdirectory to minimize risk of name collisions
230
310
  * Added OAuth Playground git submodule as an example
231
311
  * Updated tests, readme, and changelog
232
312
 
233
313
  v0.7.1
314
+ ======
315
+
234
316
  * Updated RealtimeUpdates#list_subscriptions and GraphAPI#get_connections to now return an
235
317
  array of results directly (rather than a hash with one key)
236
318
  * Fixed a bug with Net::HTTP-based HTTP service in which the headers hash was improperly formatted
237
319
  * Updated readme
238
320
 
239
321
  v0.7.0
322
+ ======
323
+
240
324
  * Added RealtimeUpdates class, which can be used to manage subscriptions for user updates (see http://developers.facebook.com/docs/api/realtime)
241
325
  * Added picture method to graph API, which fetches an object's picture from the redirect headers.
242
326
  * Added _greatly_ improved testing with result mocking, which is now the default set of tests
@@ -245,16 +329,21 @@ v0.7.0
245
329
  * Much internal refactoring
246
330
  * Updated readme, changelog, etc.
247
331
 
248
-
249
332
  v0.6.0
333
+ ======
334
+
250
335
  * Added support for the old REST API thanks to cbaclig's great work
251
336
  * Updated tests to conform to RSpec standards
252
337
  * Updated changelog, readme, etc.
253
338
 
254
339
  v0.5.1
340
+ ======
341
+
255
342
  * Documentation is now on the wiki, updated readme accordingly.
256
343
 
257
344
  v0.5.0
345
+ ======
346
+
258
347
  * Added several new OAuth methods for making and parsing access token requests
259
348
  * Added test suite for the OAuth class
260
349
  * Made second argument to url_for_access_token a hash (strings still work but trigger a deprecation warning)
@@ -262,20 +351,28 @@ v0.5.0
262
351
  * Updated readme
263
352
 
264
353
  v0.4.1
354
+ ======
355
+
265
356
  * Encapsulated GraphAPI and OAuth classes in the Koala::Facebook module for clarity (and to avoid claiming the global Facebook class)
266
357
  * Moved make_request method to Koala class from GraphAPI instance (for use by future OAuth class functionality)
267
358
  * Renamed request method to api for consistancy with Javascript library
268
359
  * Updated tests and readme
269
360
 
270
361
  v0.4.0
362
+ ======
363
+
271
364
  * Adopted the Koala name
272
365
  * Updated readme and tests
273
366
  * Fixed cookie verification bug for non-expiring OAuth tokens
274
367
 
275
368
  v0.3.1
369
+ ======
370
+
276
371
  * Bug fixes.
277
372
 
278
373
  v0.3
374
+ ====
375
+
279
376
  * Renamed Graph API class from Facebook::GraphAPI to FacebookGraph::API
280
377
  * Created FacebookGraph::OAuth class for tokens and OAuth URLs
281
378
  * Updated method for including HTTP service (think we've got it this time)
@@ -283,12 +380,18 @@ v0.3
283
380
  * Added CHANGELOG and gemspec
284
381
 
285
382
  v0.2
383
+ ====
384
+
286
385
  * Gemified the project
287
386
  * Split out HTTP services into their own file, and adjusted inclusion method
288
387
 
289
388
  v0.1
389
+ ====
390
+
290
391
  * Added modular support for Typhoeus
291
392
  * Added tests
292
393
 
293
394
  v0.0
294
- * Hi from F8! Basic read/write from the graph is working
395
+ ====
396
+
397
+ * Hi from F8! Basic read/write from the graph is working
@@ -20,9 +20,9 @@ Gem::Specification.new do |gem|
20
20
  gem.extra_rdoc_files = ["readme.md", "changelog.md"]
21
21
  gem.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Koala"]
22
22
 
23
- gem.add_runtime_dependency(%q<multi_json>, ["~> 1.3"])
24
- gem.add_runtime_dependency(%q<faraday>, ["~> 0.8"])
25
- gem.add_runtime_dependency(%q<addressable>, ["~> 2.2"])
26
- gem.add_development_dependency(%q<rspec>, ["~> 2.8"])
27
- gem.add_development_dependency(%q<rake>, ["~> 0.8"])
23
+ gem.add_runtime_dependency("multi_json")
24
+ gem.add_runtime_dependency("faraday")
25
+ gem.add_runtime_dependency("addressable")
26
+ gem.add_development_dependency("rspec")
27
+ gem.add_development_dependency("rake")
28
28
  end
@@ -15,20 +15,29 @@ require 'koala/http_service'
15
15
  # miscellaneous
16
16
  require 'koala/utils'
17
17
  require 'koala/version'
18
+ require 'ostruct'
18
19
 
19
20
  module Koala
20
21
  # A Ruby client library for the Facebook Platform.
21
22
  # See http://github.com/arsduo/koala/wiki for a general introduction to Koala
22
23
  # and the Graph API.
23
-
24
+
24
25
  # Making HTTP requests
25
26
  class << self
26
- # Control which HTTP service framework Koala uses.
27
+ # Control which HTTP service framework Koala uses.
27
28
  # Primarily used to switch between the mock-request framework used in testing
28
29
  # and the live framework used in real life (and live testing).
29
30
  # In theory, you could write your own HTTPService module if you need different functionality,
30
31
  # but since the switch to {https://github.com/arsduo/koala/wiki/HTTP-Services Faraday} almost all such goals can be accomplished with middleware.
31
32
  attr_accessor :http_service
33
+
34
+ def configure
35
+ yield config
36
+ end
37
+
38
+ def config
39
+ @config ||= OpenStruct.new(HTTPService::DEFAULT_SERVERS)
40
+ end
32
41
  end
33
42
 
34
43
  # @private
@@ -39,14 +48,14 @@ module Koala
39
48
  # if this is a deprecated module, support the old interface
40
49
  # by changing the default adapter so the right library is used
41
50
  # we continue to use the single HTTPService module for everything
42
- service.deprecated_interface
51
+ service.deprecated_interface
43
52
  else
44
53
  # if it's a real http_service, use it
45
54
  @http_service = service
46
55
  end
47
56
  end
48
57
 
49
- # An convenenient alias to Koala.http_service.make_request.
58
+ # An convenenient alias to Koala.http_service.make_request.
50
59
  def self.make_request(path, args, verb, options = {})
51
60
  http_service.make_request(path, args, verb, options)
52
61
  end