koala 1.5.0 → 1.6.0.rc1

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