koala 1.5.0 → 1.6.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/.gitignore CHANGED
@@ -4,4 +4,5 @@ Gemfile.lock
4
4
  .rvmrc
5
5
  *.rbc
6
6
  *~
7
- .yardoc/
7
+ .yardoc/
8
+ .DS_Store
data/.travis.yml CHANGED
@@ -7,4 +7,7 @@ rvm:
7
7
  - jruby-19mode # JRuby in 1.9 mode
8
8
  - rbx-18mode
9
9
  - rbx-19mode
10
- - ree
10
+ - ree
11
+ matrix:
12
+ allow_failures:
13
+ - rvm: ruby-head
data/Gemfile CHANGED
@@ -15,7 +15,7 @@ group :development, :test do
15
15
  if RUBY_PLATFORM =~ /darwin/
16
16
  # OS X integration
17
17
  gem "ruby_gntp"
18
- gem "rb-fsevent", "~> 0.4.3.1"
18
+ gem "rb-fsevent"
19
19
  end
20
20
  end
21
21
 
data/changelog.md ADDED
@@ -0,0 +1,294 @@
1
+ v1.6
2
+ New methods:
3
+ * RealtimeUpdates#validate_update to validate the signature of a Facebook call (thanks, gaffo!)
4
+ Updated methods:
5
+ * Graph API methods now accepts a post processing block, see readme for examples (thanks, wolframarnold!)
6
+ _Internal improvements:_
7
+ * Koala now returns more specific and useful error classes (thanks, archfear!)
8
+ * Switched URL parsing to addressable, which can handle unusual FB URLs (thanks, bnorton!)
9
+ * Fixed Batch API bug that seems to have broken calls requiring post-processing
10
+ * Bump Faraday requirement to 0.8 (thanks, jarthod!)
11
+ * Picture and video URLs now support unicode characters (thanks, jayeff!)
12
+ Testing improvements:
13
+ * Cleaned up some test suites (thanks, bnorton!)
14
+ Documentation:
15
+ * Changelog is now markdown
16
+ * Code highlighting in readme (thanks, sfate!)
17
+ * Added Graph API explorer link in readme (thanks, jch!)
18
+ * Added permissions example for OAuth (thanks, sebastiandeutsch!)
19
+
20
+ v1.5
21
+ New methods:
22
+ * Added Koala::Utils.logger to enable debugging (thanks, KentonWhite!)
23
+ * Expose fb_error_message and fb_error_code directly in APIError
24
+ Updated methods:
25
+ * GraphCollection.parse_page_url now uses the URI library and can parse any address (thanks, bnorton!)
26
+ Internal improvements:
27
+ * Update MultiJson dependency to support the Oj library (thanks, eckz and zinenko!)
28
+ * Loosened Faraday dependency (thanks, rewritten and romanbsd!)
29
+ * Fixed typos (thanks, nathanbertram!)
30
+ * Switched uses of put_object to the more semantically accurate put_connections
31
+ * Cleaned up gemspec
32
+ * Handle invalid batch API responses better
33
+ Documentation:
34
+ * Added HTTP Services description for Faraday 0.8/persistent connections (thanks, romanbsd!)
35
+ * Remove documentation of the old pre-1.2 HTTP Service options
36
+
37
+ v.1.4.1
38
+ * Update MultiJson to 1.3 and change syntax to silence warnings (thanks, eckz and masterkain!)
39
+
40
+ v1.4
41
+ New methods:
42
+ * OAuth#exchange_access_token(_info) allows you to extend access tokens you receive (thanks, etiennebarrie!)
43
+ Updated methods:
44
+ * HTTPServices#encode_params sorts parameters to aid in URL comparison (thanks, sholden!)
45
+ * get_connections is now aliased as get_connection (use whichever makes sense to you)
46
+ Internal improvements:
47
+ * Fixed typos (thanks, brycethornton and jpemberthy!)
48
+ * RealtimeUpdates will no longer execute challenge block unnecessarily (thanks, iainbeeston!)
49
+ Testing improvements:
50
+ * Added parallel_tests to development gem file
51
+ * Fixed failing live tests
52
+ * Koala now tests against JRuby and Rubinius in 1.9 mode on Travis-CI
53
+
54
+ v1.3
55
+ New methods:
56
+ * OAuth#url_for_dialog creates URLs for Facebook dialog pages
57
+ * API#set_app_restrictions handles JSON-encoding app restrictions
58
+ * GraphCollection.parse_page_url now exposes useful functionality for non-Rails apps
59
+ * RealtimeUpdates#subscription_path and TestUsers#test_user_accounts_path are now public
60
+ Updated methods:
61
+ * REST API methods are now deprecated (see http://developers.facebook.com/blog/post/616/)
62
+ * OAuth#url_for_access_token and #url_for_oauth_code now include any provided options as URL parameters
63
+ * APIError#raw_response allows access to the raw error response received from Facebook
64
+ * Utils.deprecate only prints each message once (no more spamming)
65
+ * API#get_page_access_token now accepts additional arguments and HTTP options (like other calls)
66
+ * TestUsers and RealtimeUpdates methods now take http_options arguments
67
+ * All methods with http_options can now take :http_component => :response for the complete response
68
+ * OAuth#get_user_info_from_cookies returns nil rather than an error if the cookies are expired (thanks, herzio)
69
+ * TestUsers#delete_all now uses the Batch API and is much faster
70
+ Internal improvements:
71
+ * FQL queries now use the Graph API behind-the-scenes
72
+ * Cleaned up file and class organization, with aliases for backward compatibility
73
+ * Added YARD documentation throughout
74
+ * Fixed bugs in RealtimeUpdates, TestUsers, elsewhere
75
+ * Reorganized file and class structure non-destructively
76
+ Testing improvements:
77
+ * Expanded/improved test coverage
78
+ * The test suite no longer users any hard-coded user IDs
79
+ * KoalaTest.test_user_api allows access to the TestUsers instance
80
+ * Configured tests to run in random order using RSpec 2.8.0rc1
81
+
82
+ v1.2.1
83
+ New methods:
84
+ * RestAPI.set_app_properties handles JSON-encoding application properties
85
+ Updated methods:
86
+ * OAuth.get_user_from_cookie works with the new signed cookie format (thanks, gmccreight!)
87
+ * Beta server URLs are now correct
88
+ * OAuth.parse_signed_request now raises an informative error if the signed_request is malformed
89
+ Internal improvements:
90
+ * Koala::Multipart middleware properly encoding nested parameters (hashes) in POSTs
91
+ * Updated readme, changelog, etc.
92
+ Testing improvements:
93
+ * Live tests with test users now clean up all fake users they create
94
+ * Removed duplicate test cases
95
+ * Live tests with test users no longer delete each object they create, speeding things up
96
+
97
+ v1.2
98
+ New methods:
99
+ * API is now the main API class, contains both Graph and REST methods
100
+ * Old classes are aliased with deprecation warnings (non-breaking change)
101
+ * TestUsers#update lets you update the name or password of an existing test user
102
+ * API.get_page_access_token lets you easily fetch the access token for a page you manage (thanks, marcgg!)
103
+ * Added version.rb (Koala::VERSION)
104
+ Updated methods:
105
+ * OAuth now parses Facebook's new signed cookie format
106
+ * API.put_picture now accepts URLs to images (thanks, marcgg!)
107
+ * Bug fixes to put_picture, parse_signed_request, and the test suite (thanks, johnbhall and Will S.!)
108
+ * Smarter GraphCollection use
109
+ * Any pageable result will now become a GraphCollection
110
+ * Non-pageable results from get_connections no longer error
111
+ * GraphCollection.raw_results allows access to original result data
112
+ * Koala no longer enforces any limits on the number of test users you create at once
113
+ Internal improvements:
114
+ * Koala now uses Faraday to make requests, replacing the HTTPServices (see wiki)
115
+ * Koala::HTTPService.http_options allows specification of default Faraday connection options
116
+ * Koala::HTTPService.faraday_middleware allows custom middleware configurations
117
+ * Koala now defaults to Net::HTTP rather than Typhoeus
118
+ * Koala::NetHTTPService and Koala::TyphoeusService modules no longer exist
119
+ * Koala no longer automatically switches to Net::HTTP when uploading IO objects to Facebook
120
+ * RealTimeUpdates and TestUsers are no longer subclasses of API, but have their own .api objects
121
+ * The old .graph_api accessor is aliases to .api with a deprecation warning
122
+ * Removed deprecation warnings for pre-1.1 batch interface
123
+ Testing improvements:
124
+ * Live test suites now run against test users by default
125
+ * Test suite can be repeatedly run live without having to update facebook_data.yml
126
+ * OAuth code and session key tests cannot be run against test users
127
+ * Faraday adapter for live tests can be specified with ADAPTER=[your adapter] in the rspec command
128
+ * Live tests can be run against the beta server by specifying BETA=true in the rspec command
129
+ * Tests now pass against all rubies on Travis CI
130
+ * Expanded and refactored test coverage
131
+ * Fixed bug with YAML parsing in Ruby 1.9
132
+
133
+ v1.1
134
+ New methods:
135
+ * Added Batch API support (thanks, seejohnrun and spiegela!)
136
+ * includes file uploads, error handling, and FQL
137
+ * Added GraphAPI#put_video
138
+ * Added GraphAPI#get_comments_for_urls (thanks, amrnt!)
139
+ * Added RestAPI#fql_multiquery, which simplifies the results (thanks, amrnt!)
140
+ * HTTP services support global proxy and timeout settings (thanks, itchy!)
141
+ * Net::HTTP supports global ca_path, ca_file, and verify_mode settings (thanks, spiegela!)
142
+ Updated methods:
143
+ * RealtimeUpdates now uses a GraphAPI object instead of its own API
144
+ * RestAPI#rest_call now has an optional last argument for method, for calls requiring POST, DELETE, etc. (thanks, sshilo!)
145
+ * Filename can now be specified when uploading (e.g. for Ads API) (thanks, sshilo!)
146
+ * get_objects([]) returns [] instead of a Facebook error in non-batch mode (thanks, aselder!)
147
+ Internal improvements:
148
+ * Koala is now more compatible with other Rubies (JRuby, Rubinius, etc.)
149
+ * HTTP services are more modular and can be changed on the fly (thanks, chadk!)
150
+ * Includes support for uploading StringIOs and other non-files via Net::HTTP even when using TyphoeusService
151
+ * Koala now uses multi_json to improve compatibility with Rubinius and other Ruby versions
152
+ * Koala now uses the modern Typhoeus API (thanks, aselder!)
153
+ * Koala now uses the current modern Net::HTTP interface (thanks, romanbsd!)
154
+ * Fixed bugs and typos (thanks, waynn, mokevnin, and tikh!)
155
+
156
+ v1.0
157
+ New methods:
158
+ * Photo and file upload now supported through #put_picture
159
+ * Added UploadableIO class to manage file uploads
160
+ * Added a delete_like method (thanks to waseem)
161
+ * Added put_connection and delete_connection convenience methods
162
+ Updated methods:
163
+ * Search can now search places, checkins, etc. (thanks, rickyc!)
164
+ * You can now pass :beta => true in the http options to use Facebook's beta tier
165
+ * TestUser#befriend now requires user info hashes (id and access token) due to Facebook API changes (thanks, pulsd and kbighorse!)
166
+ * All methods now accept an http_options hash as their optional last parameter (thanks, spiegela!)
167
+ * url_for_oauth_code can now take a :display option (thanks, netbe!)
168
+ * Net::HTTP can now accept :timeout and :proxy options (thanks, gilles!)
169
+ * Test users now supports using test accounts across multiple apps
170
+ Internal improvements:
171
+ * For public requests, Koala now uses http by default (instead of https) to improve speed
172
+ * This can be overridden through Koala.always_use_ssl= or by passing :use_ssl => true in the options hash for an api call
173
+ * Read-only REST API requests now go through the faster api-read server
174
+ * Replaced parse_signed_request with a version from Facebook that also supports the new signed params proposal
175
+ * Note: invalid requests will now raise exceptions rather than return nil, in keeping with other SDKs
176
+ * Delete methods will now raise an error if there's no access token (like put_object and delete_like)
177
+ * Updated parse_signed_request to match Facebook's current implementation (thanks, imajes!)
178
+ * APIError is now < StandardError, not Exception
179
+ * Added KoalaError for non-API errors
180
+ * Net::HTTP's SSL verification is no longer disabled by default
181
+ Test improvements:
182
+ * Incorporated joshk's awesome rewrite of the entire Koala test suite (thanks, joshk!)
183
+ * Expanded HTTP service tests (added Typhoeus test suite and additional Net::HTTP test cases)
184
+ * Live tests now verify that the access token has the necessary permissions before starting
185
+ * Replaced the 50-person network test, which often took 15+ minutes to run live, with a 5-person test
186
+
187
+ v0.10.0
188
+ * Added test user module
189
+ * Fixed bug when raising APIError after Facebook fails to exchange session keys
190
+ * Made access_token accessible via the readonly access_token property on all our API classes
191
+
192
+ v0.9.1
193
+ * Tests are now compatible with Ruby 1.9.2
194
+ * Added JSON to runtime dependencies
195
+ * Removed examples directory (referenced from github instead)
196
+
197
+ v0.9.0
198
+ * Added parse_signed_request to handle Facebook's new authentication scheme
199
+ * note: creates dependency on OpenSSL (OpenSSL::HMAC) for decryption
200
+ * Added GraphCollection class to provide paging support for GraphAPI get_connections and search methods (thanks to jagthedrummer)
201
+ * Added get_page method to easily fetch pages of results from GraphCollections
202
+ * Exchanging sessions for tokens now works properly when provided invalid/expired session keys
203
+ * You can now include a :typhoeus_options key in TyphoeusService#make_request's options hash to control the Typhoeus call (for example, to set :disable_ssl_peer_verification => true)
204
+ * All paths provided to HTTP services start with leading / to improve compatibility with stubbing libraries
205
+ * If Facebook returns nil for search or get_connections requests, Koala now returns nil rather than throwing an exception
206
+
207
+ v0.8.0
208
+ * Breaking interface changes
209
+ * Removed string overloading for the methods, per 0.7.3, which caused Marshaling issues
210
+ * Removed ability to provide a string as the second argument to url_for_access_token, per 0.5.0
211
+
212
+ v0.7.4
213
+ * Fixed bug with get_user_from_cookies
214
+
215
+ v0.7.3
216
+ * Added support for picture sizes -- thanks thhermansen for the patch!
217
+ * 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
+ * These methods now return strings, rather than hashes, which makes more sense
219
+ * The strings are overloaded with an [] method for backwards compatibility (Ruby is truly amazing)
220
+ * Using those methods triggers a deprecation warning
221
+ * This will be removed by 1.0
222
+ * There are new info methods (get_access_token_info, get_app_access_token_info, get_token_info_from_session_keys, and get_user_info_from_cookies) that natively return hashes, for when you want the expiration date
223
+ * Responses with HTTP status 500+ now properly throw errors under Net::HTTP
224
+ * Updated changelog
225
+ * Added license
226
+
227
+ v0.7.2
228
+ * 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
+ * Moved Koala files into a koala/ subdirectory to minimize risk of name collisions
230
+ * Added OAuth Playground git submodule as an example
231
+ * Updated tests, readme, and changelog
232
+
233
+ v0.7.1
234
+ * Updated RealtimeUpdates#list_subscriptions and GraphAPI#get_connections to now return an
235
+ array of results directly (rather than a hash with one key)
236
+ * Fixed a bug with Net::HTTP-based HTTP service in which the headers hash was improperly formatted
237
+ * Updated readme
238
+
239
+ v0.7.0
240
+ * Added RealtimeUpdates class, which can be used to manage subscriptions for user updates (see http://developers.facebook.com/docs/api/realtime)
241
+ * Added picture method to graph API, which fetches an object's picture from the redirect headers.
242
+ * Added _greatly_ improved testing with result mocking, which is now the default set of tests
243
+ * Renamed live testing spec to koala_spec_without_mocks.rb
244
+ * Added Koala::Response class, which encapsulates HTTP results since Facebook sometimes sends data in the status or headers
245
+ * Much internal refactoring
246
+ * Updated readme, changelog, etc.
247
+
248
+
249
+ v0.6.0
250
+ * Added support for the old REST API thanks to cbaclig's great work
251
+ * Updated tests to conform to RSpec standards
252
+ * Updated changelog, readme, etc.
253
+
254
+ v0.5.1
255
+ * Documentation is now on the wiki, updated readme accordingly.
256
+
257
+ v0.5.0
258
+ * Added several new OAuth methods for making and parsing access token requests
259
+ * Added test suite for the OAuth class
260
+ * Made second argument to url_for_access_token a hash (strings still work but trigger a deprecation warning)
261
+ * Added fields to facebook_data.yml
262
+ * Updated readme
263
+
264
+ v0.4.1
265
+ * Encapsulated GraphAPI and OAuth classes in the Koala::Facebook module for clarity (and to avoid claiming the global Facebook class)
266
+ * Moved make_request method to Koala class from GraphAPI instance (for use by future OAuth class functionality)
267
+ * Renamed request method to api for consistancy with Javascript library
268
+ * Updated tests and readme
269
+
270
+ v0.4.0
271
+ * Adopted the Koala name
272
+ * Updated readme and tests
273
+ * Fixed cookie verification bug for non-expiring OAuth tokens
274
+
275
+ v0.3.1
276
+ * Bug fixes.
277
+
278
+ v0.3
279
+ * Renamed Graph API class from Facebook::GraphAPI to FacebookGraph::API
280
+ * Created FacebookGraph::OAuth class for tokens and OAuth URLs
281
+ * Updated method for including HTTP service (think we've got it this time)
282
+ * Updated tests
283
+ * Added CHANGELOG and gemspec
284
+
285
+ v0.2
286
+ * Gemified the project
287
+ * Split out HTTP services into their own file, and adjusted inclusion method
288
+
289
+ v0.1
290
+ * Added modular support for Typhoeus
291
+ * Added tests
292
+
293
+ v0.0
294
+ * Hi from F8! Basic read/write from the graph is working
data/koala.gemspec CHANGED
@@ -17,11 +17,12 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
 
20
- gem.extra_rdoc_files = ["readme.md", "CHANGELOG"]
20
+ gem.extra_rdoc_files = ["readme.md", "changelog.md"]
21
21
  gem.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Koala"]
22
22
 
23
23
  gem.add_runtime_dependency(%q<multi_json>, ["~> 1.3"])
24
- gem.add_runtime_dependency(%q<faraday>, ["~> 0.7"])
24
+ gem.add_runtime_dependency(%q<faraday>, ["~> 0.8"])
25
+ gem.add_runtime_dependency(%q<addressable>, ["~> 2.2"])
25
26
  gem.add_development_dependency(%q<rspec>, ["~> 2.8"])
26
27
  gem.add_development_dependency(%q<rake>, ["~> 0.8"])
27
28
  end
@@ -25,7 +25,7 @@ module Koala
25
25
 
26
26
  process_binary_args
27
27
 
28
- raise Koala::KoalaError, "Batch operations require an access token, none provided." unless @access_token
28
+ raise AuthenticationError.new(nil, nil, "Batch operations require an access token, none provided.") unless @access_token
29
29
  end
30
30
 
31
31
  def to_batch_params(main_access_token)