lib/koala.rb in koala-0.9.1 vs lib/koala.rb in koala-0.10.0

- old
+ new

@@ -15,12 +15,16 @@ require 'koala/graph_api' # add REST API methods require 'koala/rest_api' +# add realtime update methods require 'koala/realtime_updates' +# add test user methods +require 'koala/test_users' + module Koala module Facebook # Ruby client library for the Facebook Platform. # Copyright 2010 Facebook @@ -46,10 +50,11 @@ class API # initialize with an access token def initialize(access_token = nil) @access_token = access_token end + attr_reader :access_token def api(path, args = {}, verb = "get", options = {}, &error_checking_block) # Fetches the given path in the Graph API. args["access_token"] = @access_token || @app_access_token if @access_token || @app_access_token @@ -96,10 +101,16 @@ class RealtimeUpdates < API include RealtimeUpdateMethods end + class TestUsers < API + include TestUserMethods + # make the Graph API accessible in case someone wants to make other calls to interact with their users + attr_reader :graph_api + end + class APIError < Exception attr_accessor :fb_error_type def initialize(details = {}) self.fb_error_type = details["type"] super("#{fb_error_type}: #{details["message"]}") @@ -221,10 +232,13 @@ :sessions => sessions.join(",") }, true, "exchange_sessions") # Facebook returns an empty body in certain error conditions if response == "" - raise APIError.new("ArgumentError", "get_token_from_session_key received an error (empty response body) for sessions #{sessions.inspect}!") + raise APIError.new({ + "type" => "ArgumentError", + "message" => "get_token_from_session_key received an error (empty response body) for sessions #{sessions.inspect}!" + }) end JSON.parse(response) end