lib/koala.rb in koala-1.1.0rc2 vs lib/koala.rb in koala-1.1.0rc3

- old
+ new

@@ -1,20 +1,22 @@ require 'cgi' require 'digest/md5' -require 'json' +require 'multi_json' # OpenSSL and Base64 are required to support signed_request require 'openssl' require 'base64' # include koala modules require 'koala/http_services' require 'koala/http_services/net_http_service' require 'koala/oauth' require 'koala/graph_api' -require 'koala/graph_api_batch' +require 'koala/graph_batch_api' +require 'koala/batch_operation' +require 'koala/graph_collection' require 'koala/rest_api' require 'koala/realtime_updates' require 'koala/test_users' require 'koala/http_services' @@ -51,12 +53,12 @@ # in the case of a server error raise APIError.new({"type" => "HTTP #{result.status.to_s}", "message" => "Response body: #{result.body}"}) if result.status >= 500 # parse the body as JSON and run it through the error checker (if provided) # Note: Facebook sometimes sends results like "true" and "false", which aren't strictly objects - # and cause JSON.parse to fail -- so we account for that by wrapping the result in [] - body = JSON.parse("[#{result.body.to_s}]")[0] + # and cause MultiJson.decode to fail -- so we account for that by wrapping the result in [] + body = MultiJson.decode("[#{result.body.to_s}]")[0] yield body if error_checking_block # if we want a component other than the body (e.g. redirect header for images), return that options[:http_component] ? result.send(options[:http_component]) : body end @@ -64,12 +66,15 @@ # APIs class GraphAPI < API include GraphAPIMethods - include GraphAPIBatchMethods end + class GraphBatchAPI < GraphAPI + include GraphBatchAPIMethods + end + class RestAPI < API include RestAPIMethods end class GraphAndRestAPI < API